#clojure logs

2012-08-20

00:09bubba424242hi any recommendation of a framework for building restful webservices -- similar to cherrypy
00:13triggernzA lot of the requirement for ordered maps is simply presentational
00:14triggernzI love to see maps in order in my repl , but otherwise I don't care
00:14triggernzAm I the only one?
00:14nsxtbubba424242: compojure?
00:15bubba424242@nsxt ... looking @ compojure now ... I'm new to clojure :-)
00:17technomancyGnosis-: just export LEIN_JVM_OPTS instead
00:17technomancybubba424242: compojure is definitely the place to start
00:18technomancybubba424242: or just ring if you don't have complicated routes
00:18amalloytriggernz: so, do you hate me for making maps print as #ordered/map ([1 2]) instead of as {1 2}?
00:18bubba424242thanks @technomancy
00:19amalloyjust ring, man? possible but kinda rough even for the simplest apps, i'd imagine
00:20technomancyif you have <4 endpoints it's great
00:21xeqiI use net.cgrand/mustache for small endpoints
00:22technomancyhttps://github.com/technomancy/chortles/blob/master/src/chortles/web.clj
00:23xeqiwell if you only have one handler ....
00:24xeqi~chortle
00:24clojurebotexcusez-moi
00:25technomancyor two; adding (if (= :post (:method req)) ...) isn't horrible
00:26technomancyor even three with a cond, but with more than 4 you'd end up reinventing compojure
00:28triggernzNo I don't mind at all
00:30axle_512basically, compojure has a small dsl to deal with the task of parsing information from the request map, right?
00:37xeqirouting, and destructuring the request map
00:38xeqithough I guess routing is a special case of parsing information out
00:39axle_512xeqi: thanks
00:45triggernzamalloy: where can I find ordered?
00:45amalloy$google github flatland ordered
00:45lazybot[flatland/ordered · GitHub] https://github.com/flatland/ordered
00:48triggernzCool cool
00:49axle_512For scraping sites, I really like enlive. I haven't tried it for rendering html. Anyone tried using it instead of hiccup?
00:52Gnosis-technomancy: so there's no problem with the flag itself, though?
00:52Gnosis-I asked because it seems like lein repl uses a lot of memory
01:00amalloyGnosis-: 128MB is still way more than you'll need in most real-life apps. if i were worried about memory usage in my repl, i'd (a) set Xmx to like 30m, and (b) make sure to `lein trampoline repl`
01:01Raynesaxle_512: I prefer Mustache over enlive.
01:01RaynesFor templating, I mean.
01:01RaynesI imagine enlive is nice for scraping.
01:01Gnosis-amalloy: ah, thanks
01:01Gnosis-I'll try 30m and see if it breaks anything
01:04axle_512Raynes: thanks… I'll have a look at mustache. (Not to be confused with cgrand/moustache, eh?)
01:05amalloyGnosis-: unless you're working with large data structures, 30m is probably file; 4clojure runs on 60m because the server is a little cramped
01:16michaelr`good morning!
01:28mkmichaelr`: mornin'
02:20michaelr`i need something like (with-auth-approved-user (do-stuff)), in case user is not approved it should be redirected somewhere else
02:20michaelr`is this a good case to use a macro?
02:20michaelr`to implement with-auth-approved-user
02:28xeqimichaelr`: you could either take a function, or make a macro
02:28clj_newb_235242is there any record of anyone doing HFT with clojure? or does the Java GC just kill the possibility
02:29xeqihttps://github.com/cemerick/friend/ chooses the macro direction if you want a comparison
02:33michaelr`xeqi: yeah, the syntax is more
02:33michaelr`friendly
02:33michaelr`:)
02:35michaelr`haha
02:36michaelr`clojure is really crazy (in the good sense) when refactoring
04:33augustlin ring, is it possible to make the nested params middleware add the data to something other than :params?
04:33augustl:params also contains URL parameters etc, I just want the nested params from the body, and not the URL params
04:33augustlit seems that :params is hard-coded, but I thought I'd ask anyway..
04:34weavejesteraugustl: No, I don't believe so. Nested-params needs a bit of an overhaul, really.
04:34weavejesteraugustl: Unless you wrote middleware to wrap nested-params, or created your own nested-params.
04:35augustlah, I could wrap it, good idea
04:41ideamonkHow does one go about passing an operator as argument to a funciton ? I'd like to extract combine fn out and pass +/- as an argument to it here - http://cljbin.com/paste/5031f6d2e4b0ce7c4f973b53
04:42llasramideamonk: There's no such thing as an "operator" in Clojure. + and - are in fact functions you can pass as arguments :-)
04:42algernonideamonk: (defn combine [f & l]), and then use (reduce f ...)
04:42ideamonkllasram algernon , trying
04:43nbeloglazovideamonk: nested defn is a bad idea, why do use them?
04:43llasramideamonk: BTW, looking at your code, nested `defn`s are almost certainly not what you want. Unlike `define` in scheme, the `defn` form explicitly always creates a var interned in the namespace -- ie, a top-level function
04:44ideamonknbeloglazov new here :)
04:44ideamonkllasram oh! didn't know this about defn
04:45ideamonkNice, so I end up with this - http://pastebin.com/raw.php?i=vFcvEE8V
04:46llasramLookin' good!
04:46ideamonkThx
04:47llasramMinor suggestion, (apply str ...) is more common than (reduce str ...). The latter will call `str` multiple times with each added substring, whereas the form will call it once with the lazy sequence of all the substrings
04:48llasrams,form,former,
04:50ideamonkI'm pretty new to clojure, is there a way to see the call chain to compare multiple ways of doing things ?
04:52llasramWell, you can use the standard Java profiling tools, maybe? I'm not sure really. What would be an example of what you have in mind, for some other language?
04:53nbeloglazovideamonk: I also have 2 style suggestions. Dash-separated-lowercase-words names are used for functiona and variables in clojure. So 'value-for' and 'encryption-key' more idiomatic
04:54ideamonkllasram I actually meant best practices, I guess looking at apply & reduce implementations could help there
04:55ideamonknbeloglaznov thx
05:09nkkarthikin the repl, how can i quickly find out what a function does?
05:09clgvnkkarthik: using `doc` for once
05:10nkkarthikI mean in clojure I can do (doc symbol?) in repl
05:10eddie_Hi #clojure. I've written a little toy script... I'm just learning Clojure. What's the best place to request an easy code review? stackexchange? the ClojureMailingList?
05:10nkkarthikclgv: oops... sorry... this is meant for #racket... wrong window
05:10nkkarthiksorry folks
05:10clgveddie_: make a paste and postz it here. someone usually will look at it
05:11llasrameddie_: Probably here, I'd say
05:11llasramSee, two people can't both be wrong!
05:11clgveddie_: if not and you have problems with the code try the ML
05:11amalloyideamonk: there's more repetition in your encrypt/decrypt than i'd like - you might consider https://gist.github.com/3402511 instead
05:11nkkarthikclgv: thank you
05:11ideamonkyup, just removed that :)
05:12ideamonkamalloy http://pastebin.com/raw.php?i=BKE3VXZj
05:13ideamonkamalloy yours looks much better
05:13amalloymeh. yours prints better docstrings
05:14amalloyi'm not really sure about my decision to turn combine into a function-returning-lambda, since the only point there was to avoid typing #(combine f %1 %2), which is no longer repeated
05:15ro_stthis looks interesting http://cell-lang.org/
05:15eddie_Here I put my simple script... if someone would find a few minutes for some advice, it would be really appreciated:: http://pastebin.com/DegSUaaE
05:17amalloyeddie_: you need function names or variable names that describe what you're doing. it just looks like so much gibberish without an explanation
05:17clgveddie_: you should always add info what you are trying to do, as well as afew examples that show what output you expect for what input
05:18clgveddie_: and do not use the old deprecated clojure.contrib lib
05:18eddie_thank!
05:18eddie_thanks!
05:18amalloyand foo looks like a reimplementation of ##(doc iterate), since all you're doing is applying a function to s N times
05:18lazybot⇒ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
05:45bjarteHi - has anyone a good solution for getting the cl/quicklisp and clojure to work well together in Emacs?
05:57nz-is there tool for emacs that would tell when my parenthesis are not balanced?
06:09clgvnz-: rainbow parrens?
06:14nz-clgv: http://www.emacswiki.org/emacs/RainbowDelimiters ?
06:15clgvnz-: idk, I am no emacs guys - but it has rainbow parens as far as I heard - probably some clojure-mode
06:15Raynesnz-: paredit will prevent them from ever becoming imbalanced in the first place if you don't mind a bit of a learning curve.
06:15Raynesbjarte: Don't use SLIME. Use nrepl.el instead.
06:15Raynesbjarte: Then you can continue having your cl configuration just the way you like.
06:16nz-Raynes: I tried paredit and didn't like it
06:16RaynesIf you use SLIME with Clojure, you're going to have to use an old version of SLIME because of incompatibilities with swank-clojure and the fact that the SLIME team apparently does everything imaginable to make it impossible to follow development.
06:16Raynesnz-: Try longer.
06:18ro_stnz-: try longer, definitely. it makes lisp editing sane
06:19RaynesThe day I need to think about whether or not my parens are balanced is the day I stop coding until my Emacs is fixed.
06:19ro_sti even use monger with clojure-swank (haven't gone nrepl.el yet) in emacs as a mongodb shell instead of the one mongo provides precisely because of paredit
06:20cemerickro_st: more like, I wish other languages had parens too, so I could edit them as easily as Clojure with paredit-style features.
06:20Raynescemerick: I've found paredit to be fairly useful with javascript and other languages with arg list parens.
06:20ro_styes! i get so lost when i have to edit php because i can't select by form (C-M-space in emacs/paredit)
06:21antares_I used to not like/get paredit, now I use it all the time
06:21Raynescemerick: How do you get a library into maven central?
06:21ro_stM-r in paredit is also a huge help - replace parent form with current form
06:21cemerickEclipse has an expand-selection command that mostly works across languages, but that's about it.
06:21cemerickRaynes: https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md#deploying-to-maven-central
06:27Raynescemerick: Do I need to send them a blood sample too to get registered?
06:28cemerickRaynes: Hah. It's a fair bit easier than many bizarre hoops one must jump through here and there.
07:10robermannhi, I'm trying "lein new noir my-website" but I get the error: "Could not transfer metadata noir:lein-template/maven-metadata.xml from/to clojars (http://clojars.org/repo/): Connection to http://clojars.org refused"
07:10robermannfollowed by: "Could not transfer metadata noir:lein-template/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Connection to http://repo1.maven.org refused"
07:11robermannDo you know if there is any problem with maven/clojars repos?
07:12clgvrobermann: do you have some nasty firewall in-between?
07:13robermannyes, this being the second trouble option. I'm behind a HTTP proxy.
07:15clgvrobermann: that's probably the reason. creating a noir project and running it worked like a charm overhere
07:16clgvone access to clojars was made
07:23robermannok thank you clgv
07:38robermannok, i got it.
07:39robermannon Windows: "set http_proxy=http://username:pwd@proxy.com:port&quot; then "lein new noir test-noir"
07:39robermannthanks to https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj#L81
07:50clgvrobermann: good to know. maybe that should be written into the FAQ. searching it in source is not pretty userfriendly
08:04robermannclgv: of course you are right, I added the last entry on https://github.com/technomancy/leiningen/wiki
08:05clgvrobermann: great! :)
08:05clgv(inc robermann)
08:05clgv$inc robermann
08:05clgvdamn. doesnt work anymore ;)
08:05lazybot⇒ 1
08:05lazybot⇒ 2
08:06clgvuuuh. that's a hell of a timeout for such a simple task ^^
08:07robermann:)
08:16SomeGuyHello, anyone home?
08:16clgv~anyone
08:16clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
08:17SomeGuyI'm having a small problem completing problem 90 (cartesian product, http://www.4clojure.com/problem/90) on 4clojure and was hoping to get someone's advice on it.
08:18SomeGuyThere are 3 tests cases listed and I started having a go at the second one and seem to have got most of the way there but I'm falling short at the last hurdle. Here is my current test
08:18SomeGuy((fn [l r] (mapcat #(map (fn [a] (vector a %1)) l) r)) #{1 2 3} #{4 5})
08:18SomeGuyThis produces ([1 4] [2 4] [3 4] [1 5] [2 5] [3 5])
08:19clgvSomeGuy: how much of a hint do you want?
08:19SomeGuythat would depend on how wrong I'm doing it
08:20SomeGuyif I'm not far off a small hint would do but I'm very much stabbing in the dark at the moment.
08:20SomeGuyI've tried creating a set from the results I have but it re-orders the result.
08:20clgvI mean I can name you the function/macro that does the main job with small code size
08:21SomeGuyGo for it I'm basically doing the exercisess to try and learn the functions anyway
08:21clgvto not spoil it for anyone I message you in private
08:22SomeGuyok, not sure if it will work as I'm at work so I'm using a web client so it depends how sophisticated it is I suppose.
08:23SomeGuyI will see if I can get a client installed instead.
08:24clgvlinux? macos? windowS?
08:25SomeGuyWindows
08:25clgvah well. if you are not already an emacs guy, you can get setup pretty quickly with eclipse and counterclockwise
08:26SomeGuyI've just started using emacs but I haven't quite finished setting everything up yet.
08:27bjarteRaynes: thank you.
08:28SomeGuyHmm acutally think work might be blocking me so I'll have to log back on later from home but thank you anyway.
08:30kralnamaste
09:01azkeszHi, is there a function/macro already defined for checking if a number is within a certain range ie. [0 to 10)
09:01azkeszlike (and (>= n 0) (< n 10))
09:01clgvazkesz: how about (<= 0 5 10)
09:01@Chouser(< -1 n 10)
09:02clgv&(<= 0 5 10)
09:02clgv,(<= 0 5 10)
09:02clojurebottrue
09:02clgvlazybot seems to have a bad day ^^
09:03azkeszthat's what I was looking for, thank you!
09:03bendlasHey folks!
09:03azkeszso powerful
09:04bendlasI just wondered: Is there an apply for keyword functions to maps?
09:04bendlasHere is my definition for you to play around with:
09:04@Chouseri have wished for an actual inclusive/exclusive fn before, though.
09:04bendlas(defn apply-kw [f & args-kws]
09:04bendlas (let [args (butlast args-kws)
09:04bendlas kws (last args-kws)]
09:04bendlas (apply f (apply concat args kws))))
09:06clgvbendlas: what? try it the other way round - what do you want to do? input -> output?
09:06azkesz,(<= 0 9)
09:06clojurebottrue
09:06@Chouserbendlas: I don't know of one, and it does seem like an awkward omission
09:07bendlasclgv: i want to apply a function with that takes keywords onto a map
09:07azkesz,(pmap #(str (cond (<= 0 % 9) "0") %) [-1 0 1 9 10])
09:07clojurebot#<SecurityException java.lang.SecurityException: no threads please>
09:07azkesz,(map #(str (cond (<= 0 % 9) "0") %) [-1 0 1 9 10])
09:07clojurebot("-1" "00" "01" "09" "10")
09:08bendlasChouser: has it come up before and turned down, or can I ask for a ticket at the mailing list
09:08clgv,(map #(str (when (<= 0 % 9) "0") %) [-1 0 1 9 10])
09:08clojurebot("-1" "00" "01" "09" "10")
09:08@Chouserbendlas: I'm not aware of it being turned down.
09:08azkeszis when better?
09:08azkeszor preferred?
09:09clgvyou dont have a second clause in your cond, so yes ^^
09:09azkeszit makes sense, thank you clgv=)
09:09@Chouserbendlas: I'd have some questions about inputs. A seq with a map at the end, like your example? or maybe a seq and a separate map...
09:09jkkramer~mapply
09:09clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
09:10clgvbendlas: you do this all for options?
09:12bendlasChouser: i'd do varargs with a map at the end, as in my example, because it stays true to the spirit of apply itself
09:12bendlasand also it works for fns like (fn [arg1 arg2 & {:keys [kwa1 kwa2]}] ...)
09:13bendlasjkkramer: oh, so at least clojurebot already thought of it ^^
09:13bendlasclgv: um ... yes?
09:14clgvbendlas: then you might wanna checkout clojure.options on github
09:16azkesz,(map #(str (when (<= 0 % 9) "0") (int %)) [-2.1 -1 0 1 8.1 9 9.2 10 10.2])
09:16clojurebot("-2" "-1" "00" "01" "08" ...)
09:17bendlasclgv: thanks, but I'm not looking for a new syntax, right now ;-)
09:17azkesz,(map #(str (when (<= 0 % 9) "0") (int %)) [9 9.2 10])
09:17clojurebot("09" "9" "10")
09:17azkeszlooks like I'm back to using and?
09:17clgvbendlas: it's more than that - the additional syntax symbol was jsut needed for clean separation
09:18azkesz,(map #(str (when (and (<= 0 %) (< % 10)) "0") (int %)) [9 9.2 10])
09:18clojurebot("09" "09" "10")
09:19azkeszstill awesome:)
09:19clgvazkesz: why?
09:20azkeszI don't know, I would need [0..10) range
09:20bendlasclgv: still. I'm very happy with the way you *define* kw fns
09:20bendlasI just want to be able to easily apply them to maps, that's all
09:21clgvbendlas: passing options transitively and easily was another goal. the biggest was documentation of parameters though
09:22azkeszclgv, 0 inclusive, 10 exclusive, can't use only one operator (<= 0 n 10)
09:22clgvazkesz: if you need it often just make a function out of it ;)
09:23azkeszclgv, good idea but how would I represent the inclusive/exclusive?
09:23azkeszclgv, when as parameters
09:23azkesz(inrange n [0 10))
09:23azkeszxD
09:24clgvhumm thats one of the things you cant do literally, even with macros. the read wont like it ^^
09:24clgv*reader
09:24S11001001azkesz: I guess you are looking for common lisp? :)
09:24azkeszcan't do it with macros? lol no way S11
09:24S11001001azkesz: you need reader macros to change the read syntax
09:25azkeszI see what you mean, clojure doesn't support that right?
09:25clgvazkesz: either you make several functions, or you provide one or two parameters for the inclusion/exclusion info
09:25cshellIs there a trick to getting clojure.repl/source to work in the repl? When I use it with repl defined functions, it returns nil
09:25azkeszclgv, (in-range n \[ 0 10 \) ) ?
09:26clgvcshell: it needs access to the source files -so no. but there is serializable-fn
09:26azkeszclhv, but it's kinda ugly
09:26clgvazkesz: that would do. but is that better than adiditional parameters?
09:26cshellclgv: thanks, what namespace is that in?
09:27clgv$google clojure serializable-fn
09:27lazybot[technomancy/serializable-fn · GitHub] https://github.com/technomancy/serializable-fn/
09:27azkeszclgv, I don't know, how would the additional parameters look like? (in-range n incl 0 excl 10) ?
09:27azkeszclgv, or as keywords? :incl :excl ?
09:27@Chouser(between 5 <= n < 10)
09:28bendlasclgv: thanks for pointing me to it, but I'll pass. 300+ locs + new syntax is just too much complexity for my taste ...
09:28azkeszChouser that looks way better :O
09:28cshellclgv, ah not in a clojure core one - so there's no clojure core way to get the source of the functions back in the repl without serializable-fn?
09:28clgvChouser: I thought of that as well, but wont save much then
09:28@Chousercshell: correct
09:28clgvbendlas: dont feel forced to - just a suggestion ;)
09:28cshellChouser: thanks!
09:29azkeszChouser would that have to be a macro or a function?
09:29clojurebotchouser: I really did wonder why you had all those photobombers on slide 2.... audio is so useful :)
09:29@Chouserrepl/source is more of a cute hack than a real solution.
09:30clgvclojurebot: lol what??
09:30lazybotclgv: Definitely not.
09:30clojurebotGabh mo leithsc?al?
09:30azkeszlol
09:30@Chouserazkesz: 'between' could be a function
09:30azkeszok I'll try that
09:30@ChouserI think clojurebot's talking about my Strange Loop talk from a couple years ago. Don't know why.
09:31cshellChouser?
09:31clojurebotWhy are you asking *him*
09:31azkeszS11001001, 201 from http://www.asciitable.com/index/extend.gif =) I don't get it
09:32S11001001azkesz: http://csserver.evansville.edu/~sc87/s11-faq
09:32cshellI wonder what triggered clojurebot to say that
09:32jcrossley3cshell: the singularity?
09:33clgvcshell: he seems to feel lonely ^^
09:33cshellhaha
09:33azkeszS11001001, that's awesome, thanks:)
09:33cshelldoes anyone have a need for a pure Clojure k-means clusterer? Or is there already one out there that I just haven't found yet?
09:33azkeszit was this: <azkesz> Chouser would that have to be a macro or a function?
09:34azkeszthe trigger I mean, cshell
09:35cshellazkesz: cool, I didn't know he could trigger off more than one word
09:35clgvcshell: there is one on github afair
09:40cshellclgv: thanks - thet best one looks like clojure-cluster but it only seems to work with vectors and euclidean distance
09:40cshellI'm in the middle of making one that uses protocols so you can plug in different distance measures (ie. polar) and non vectors
09:41azkesz(defn between [num1 op1 num2 op2 num3] (if (and (op1 num1 num2) (op2 num2 num3)) true false))
09:42azkeszoh i don't need the if?
09:42azkeszawesome!
09:42azkeszbut can I make it accept infinite parameters? minimum of 3 and they have to be odd
09:43clgvazkesz: by using every? with your new built predicate?
09:43clgvazkesz: or do you meant sth different?
09:44azkeszI don't really get either
09:44cshellAlso, I've been using IntelliJ/LaClojure for Clojure development - would it be better to learn Emacs/SLIME or stick with LaClojure and spend my time making that better?
09:44nDuffazkesz: (defn between [num1 op1 & rest] (and (apply op1 num1 rest) (apply op2 rest)))
09:44cshellI basically want the best REPL experience possible
09:45nDuffcshell: I'd suggest looking at Emacs Live
09:45cshellnDuff: by overtone?
09:45mdeboardcshell: If you want the best REPL experience possible, and you have to do work to make LaClojure better, then I'd say LaClojure wouldn't be the best REPL experience possible.
09:45nDuffcshell: Overtone is the project that prompted it, same maintainer, yes
09:45mdeboardOr of course you could just download Light Table playground :P
09:46@Chousercshell: I love vim bindings, so I prefer emacs+evil. But I'm sad that the visual output available is so much more constrained than what IntelliJ could theoretically provide.
09:46cshellnDuff: How does Emacs Live compare to technomancy's starter kit?
09:46@Chouserazkesz: You can do infinite parameters
09:47azkesznDuff, maybe that's not what I want? something like (between 0 <= n <10 <= x < 20 >= y >=-1 )
09:47cshellmdeboard: lighttable looks sweet, but what is the best REPL experience today?
09:47azkeszChouser, forsure but I'm trying to figure out how to process them
09:47nDuffazkesz: Indeed, that doesn't look like what you want, then.
09:47mdeboardcshell: "best" is unbelievably subjective.
09:47cshellChanServ: yeah, IntelliJ could be really awesome, and it's one area where I think could use some help that I could provide cause LaClojure seems to be kinda dead right now
09:48mdeboardChanserv
09:48mdeboardlol :P
09:48cshellOops, Chouser I meant :)
09:48@Chousercshell: If you like IDEs, you might find the eclipse plugin to be more active.
09:49azkeszclgv, I'm exploring your every? sugestion :)
09:49cshellmdeboard: agreed, and poor choice of words by myself :) The REPL in intellij is nice, but it can lock up and lose state - I want to experience that REPL where it's up for days and evolves and that's where you do all of your coding - Now, I just type into a file then run tests against it
09:49@Chouserlpetite is actually sponsored part-time by Relevance to work on counter-clockwise
09:49cshellChouser: you mean counter clockwise? That's the one that's supported by Relevance, right?
09:49@Chouser:-)
09:50cshellhaha
09:50@Chouserazkesz: you might want the 3-argument for of partition as well
09:51@Chouserform
09:51clgv(inc CounterClockWise) ;)
09:51lazybot⇒ 1
09:51azkeszchouser, that makes sense now=)
09:52clgvazkesz: oh, in the case you posted - forget my `every?` suggestion - I thought you had one range and multiple values to check against it
09:52azkeszok
09:52mdeboardcshell: That's my normal workflow with Emacs/slime
09:53cshellmdeboard: How do you go back and get all the functions you've defined over that period? Is it just scrolling back through the buffer?
09:54cshellmdeboard: or did you mean you're entering into a file then running tests?
09:54@Chousercshell: Maybe lighttable will get there, but no repl environment I've seen for Clojure helps as much as it seems like it could to transition "scratch" code entered at the repl into "saved" code in a project.
09:55roma1n_pHi everyone, is there a Clojurescript xml parser that would let me treat xml fragments as a clojure data structure? (sort of like hiccup/crate in reverse)?
09:55cshellChouser: exactly what I'm looking for - it seems that that would be very useful if you're doing days of dev in a REPL
09:55@ChouserInstead, I enter new functions I think I'll want later into a file (and eval them with a keystroke), and then test them at the repl
09:55archaicI wonder is it a goal of lighttable to be extensible in clojure, like emacs with elisp
09:55mdeboardarchaic: I believe that it is, yes
09:55cshellChouser: yeah, that's what I've been doing too - are you using emacs too?
09:56@Chousersometimes I guess wrong and a "throwaway" function that I entered at the repl needs to be saved, and I end up copy-pasting
09:56@Chousercshell: yes, emacs+evil
09:56nz-is there some good video tutorial on how to properly use repl/slime in development?
09:56archaicdo you use paredit with evil?
09:56mdeboardcshell: I use a file as 'scratch', highlight, then slime-eval-buffer so I have access to it in the repl.]
09:57@Chouserarchaic: yes
09:57archaicso do I, I think there is room for much better integration between them
09:57@Chousermdeboard: does your repl buffer then only contain outputs, not the forms that generated them?
09:57archaicI have been thinking of a paredit type mode
09:59@ChouserYeah, I switched to emacs expecting to be blown away by the slime repl environment. I wasn't. It's incrementally better than having a good text editor in one window and a console repl in another.
09:59mdeboardChouser: I don't have the function bodies if that's what you're asking. (I've never been clear on what a form is in Clojure terms)
10:00azkesz~form
10:00clojurebot(String/format "%s is (.format "%s
10:01cmiles74Just catching up on this conversation; my two cents: I also write the function in my file, then evaluate, then test in the SLIME repl. Wash, rinse, repeat.
10:01azkeszlooks broken, even if that's not what I wanted=)
10:01mdeboardbut nothing can beat what Light Table is *aiming* for
10:01@Chousermdeboard: I just mean if you type (prn foo) in your scratch buffer and send it, your repl buffer contains the *contents* of foo, but that is not preceded by the "(prn foo)". I'm just wondering if it gets confusing trying to remember what a particular chunk of otput came from.
10:01mdeboardRight now I'm using the InstaRepl in light table, after connecting to an existing project, and using my existing project's code to instantly evaluate the code I'm typing into the InstaRepl pane
10:01mdeboardChouser: Yes it does confusing
10:02cmiles74I would also like to see Light Table interleave scratch code and it's evaluated output.
10:02mdeboardhttp://ubuntuone.com/7RlW0Hth3sWo3Tx6aNCGxy
10:03mdeboardThat's what I'm doing atm
10:03mdeboard(the last two lines are actual code, not toy)
10:03hyPiRion&(format "%s" :without-the-dot!)
10:03lazybot⇒ ":without-the-dot!"
10:03@Chouserwe pair a lot at work, and right now nothing beats sharing a tmix session for that. Unfortunately that means we prefer tools that run nicely in a terminal.
10:03@Chouseremacs wins
10:03mdeboardhaving it instantly evaluate is heaps better than the clojure-mode workflow.
10:03@ChouserLighttable would need explicit pairing support, I think, before we could seriously consider it.
10:04wmealing_vnc aint cool ?
10:04wmealing_or nx
10:04mdeboardhonestly I'm a little freaked out that I can `(use)' the project I'm connected to via the Table, I didn't know it oculd do that already. That's amazing.
10:04cemerickchouser: what do you mean re: "(prn foo)", etc?
10:04cshellChouser: I was thinking of going to Emacs because I thought the REPL would blow me away as well - I also am interested in the pairing abilities
10:05hyPiRionThe lighttable-stuff should be possible to do in emacs though.
10:05cemericki.e. does SLIME not echo the expression that is evaluated?
10:05hyPiRionOr well, parts of it
10:05mdeboardhyPiRion: Exactly, parts of it
10:05@Chouserwmealing_: no, our attempts to use vnc haven't gone well.
10:05mdeboardhyPiRion: vim can do parts of it to, and intellij and eclipse and all.
10:05@Chousercemerick: depends on how you use it. That's why I was asking.
10:05wmealing_Chouser: is it vnc.. or something else
10:06cshellit's too bad that LaClojure can't "jack-in" to a remote repl like emacs
10:06mdeboardclojure-mode can jack in to a remote repl?
10:06cemerickchouser: Sorry, missed the beginning of the conversation. It seems like it should be able to…certainly a must have for a REPL IMO.
10:06cshellCan counter clockwise "jack-in" to remote repls?
10:07cshellit must if relevance is using it for their paired development
10:07cemerickcshell: yes; it uses the same REPL backend as leiningen, reply, and nrepl.el
10:07@Chousercemerick: yes, thank you for apologizing for not being on #clojure *constantly*, or at the very least reading everything that's been said since you were last here, before posting.
10:07@Chouseryour apology is accepted. Try to do better.
10:07mdeboardlol
10:08cshellI've noticed that cemerick responds whenever you explicitly type his name
10:08wmealing_and if you say it three times
10:08wmealing_he appears behind you
10:08cshellhaha
10:08wmealing_but only if you say it "chass" not "chase"
10:09wmealing_(i think its chas, right ?)
10:09cemerickwmealing_: I wish people would stop doing that; I have work to do, and phasing all over the world to spook people wears me out. :-P
10:09hyPiRionmdeboard: exactly. I'd really like something like http://vimeo.com/36579366#t=1008
10:10mdeboardhyPiRion: I think the vision ibdknox has for Light Table is dead on :)
10:10@Chousercemerick: there is a fn provided by slime that evaluate a form and display the return value temporarily on a status line. I find I never use that fn.
10:10cemerickwmealing_: Yes, it's pronounced like "chaz" (though with a softer 'z' than if it were actually spelled that way, I'd say). It's hilarious when people pronounce it "chase".
10:10cshellCouldn't we put a hook on some of the def functions and capture everything that gets defined in the REPL and then have a function that spits it all back to us?
10:10mdeboardI pronounce it "Chuck"
10:10cemerick…or when people refer to my handle as if it had only three syllables, i.e. "semmerick"
10:11@Chousercemerick: that's your name in my head
10:11mdeboardtumeric
10:11cemerickchouser: that's ok, I still don't have you and Chousuke straight in my head :-P
10:11cshellcemerick: I think of it as 'C-Em-er-ick'
10:11@Chouserheh
10:11mdeboardThey're not hte same person?
10:11mdeboardhuh.
10:11hyPiRionmdeboard: I was kind of let down by the 0.10-update, especially when one of the subtitles are "A new double click experience for Clojure"
10:11wmealing_is that an emacs key combo there cshell ?
10:11mdeboardhyPiRion: Why
10:12@Chouserwait, when did I get capitalized?
10:12cshellwmealing_: haha, we should implement one to be
10:13hyPiRionmdeboard: I never use my mouse when I'm programming anymore - just a decent window manager and emacs, and I'm there
10:13cshellI always thought chouser stood for channel operator user and was just a bot until I saw him typing in chat :)
10:13mdeboardhyPiRion: I think he means you can double-click the jar file and be ready to go
10:13magopiani guess most of the people here are using emacs then?
10:13mdeboardhyPiRion: No other installation required
10:13@chousercshell: ha!
10:13mdeboardhyPiRion: That's waht I took from it.
10:14magopianman, i really can't get back to emacs, i'm too deep in vim now
10:14mdeboardmagopian: You know it's not zero-sum right
10:14magopian(haven't tried using it with clojure yet though, i'm using light table most of the time)
10:14magopianmdeboard: didn't get that
10:14mdeboardmagopian: You can use both :P
10:14magopianmdeboard: oh ok
10:14chousermagopian: use the "evil" package. eetsveryniiiice
10:15magopianwell, i'm pretty sure my brain would overload, and my fingers would just finished all mixed up for good
10:15hyPiRionmdeboard: Ah. I felt the screenshot in that subsection refered to clicking on projects in leiningen: http://www.chris-granger.com/images/lightable/projects.png
10:15cemerickMaybe someone that knows the incantation(s) can map ~survey? or something to http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/ so that an easy answer can be given to anyone asking about preferred editors/etc?
10:16magopianoh nice cemerick thanks i'll read that ;)
10:16cemerickmagopian: :-)
10:16mdeboardDamn light table is cool, constantly impressed.
10:17azkesz~paste
10:17clojurebotpaste is not gist.github.com
10:17hyPiRion~gist
10:17clojurebotgist is forget ~paste
10:17azkeszclojurebot which one is it then?
10:17hyPiRionheheh.
10:17chouserclojurebot: survey?
10:17clojurebotsurvey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
10:18chouserbrb
10:18hyPiRion~survey
10:18clojurebotsurvey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
10:18cemerickstellar, thanks chouser
10:18hyPiRionthere you go.
10:18cemerickor hyPiRion or whoever did it :-)
10:18azkeszchouser
10:18hyPiRioncemerick: I didn't.
10:19azkeszcljbin is dreaming
10:19hyPiRion"there you go." was probably a bad choice of words :)
10:19scriptor_so…clojurebot did it on its own?
10:19mdeboardIt's learning.
10:19mdeboard~makemeasandwich
10:19clojurebotExcuse me?
10:19mdeboarddarn.
10:19azkeszlol
10:20azkeszanyway, I did the between function but I don't like it because it's recursing, maybe I should use loop/recur or something
10:21magopianmdeboard: you missed the "sudo"
10:21mdeboardcurses
10:21chouserazkesz: I have a version here that uses only every?, fn, and partition
10:22azkeszI didn't know how to use partition=)
10:22magopianpartition <3
10:22scriptorpartition's fairly straightforward
10:22scriptor,doc partition
10:22clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>
10:22chouser,(partition 3 2 '(1 a 2 b 3 c 4))
10:22clojurebot((1 a 2) (2 b 3) (3 c 4))
10:22mdeboard##(doc partition)
10:22lazybot⇒ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to co... https://www.refheap.com/paste/4504
10:22mdeboardSee
10:22azkeszoh
10:22mdeboardThose docs need to get cleaned up imo.
10:22azkeszi used the 2 param one :/
10:22mdeboardImpossible.
10:23azkeszthe 3 param one which you said I should've used looks amazing, chouser
10:23chouseryep, pretty handy
10:24hyPiRion,(map (fn [[a b]] (- b a)) (partition 2 1 (map #(*%%) (range))))
10:24clojurebot(1 3 5 7 9 ...)
10:24azkeszthere should be a site that gives newbies small "missions" to code certain things, would be awesome motivation to learn
10:25hyPiRionazkesz: like 4clojure?
10:26scriptorhttp://www.4clojure.com/
10:26azkeszyeah like that but a bit better=)
10:26nbeloglazovazkesz: in what way?
10:26chouserazkesz: your mission, should you choose to accept it, is to write the clojure code necessary to make 4clojure better.
10:26hyPiRionazkesz: I'm pretty sure they're open for comments, so if you have any suggestions, you should fire away
10:26azkeszchouser, that's a big mission=)
10:27scriptorazkesz: better in what way though, different kinds of exercises?
10:27azkesznbeloglazov, hyPiRion, I'll think about it, but something along the lines of what I was trying to do here, doing small things in more than 1 ways
10:27mefestoHey everyone :-)
10:28hyPiRionazkesz: Ah, so more than one way of doing things?
10:28scriptora lot of the 4clojure exercises can be solved in different ways
10:29scriptorfor example, there's the way I usually do it, and then there's the good way
10:29azkeszhyPiRion, yeah for starters, but usually starting from one problem you can get ramnifications into other things you could be doing
10:29magopianscriptor: haha, same here ;)
10:29mefestoIs it possible with clojure.tools.cli to support multi-valued options like this? $ java -jar myapp.jar -c config.clj -H k1=v1 -H k2=v2 ...
10:29mdeboardHow do you articulate to your fellow devs that a project could be handled better by using a language that lends itself to concurrent programming?
10:29hyPiRionIt's usually the emacs way, the unix way, and the wrong way.
10:29nbeloglazovWhat does '(map #(*%%) (range))' do? I mean anonymous function?
10:29mefestoso that when i check the opts it has a vector representing all the -H options uses?
10:29mefestoused*
10:30hyPiRionnbeloglazov: #(*%%) = #(* % %)
10:30azkesz,(#(*%%) 2 3)
10:30clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval113$fn>
10:30mdeboardnbeloglazov: I dunno what #(*%%) does but -- yeah
10:30mdeboardwhat they said.
10:30hyPiRionAll the squares.
10:30azkesz,(#(*%%) 2)
10:30clojurebot4
10:30azkeszhow come it works without spaces?
10:30hyPiRionBecause percent.
10:30nbeloglazovhyPiRion: hm, thanks. I always thought parser will parse *%% as 1 token
10:30scriptorazkesz: the reader considers each percent a separate thing
10:30hyPiRion,[*%%]
10:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0)>
10:31hyPiRionoh dangit.
10:31hyPiRion,'[*%%]
10:31clojurebot[* % %]
10:31scriptor,(#(*%1%2) 1 2)
10:31clojurebot2
10:31nbeloglazov,'[*%a%b%c%&]
10:31clojurebot[* %a %b %c %&]
10:31nbeloglazov,'[*%a%b%cbb%&]
10:31clojurebot[* %a %b %cbb %&]
10:32hyPiRionTreat every occurence of "%" as " %".
10:32nbeloglazovHm, but why? :)
10:32mdeboardunless it's preceded by a space already.
10:32scriptornbeloglazov: because the reader does it for you, each % gets put into a separate token
10:33hyPiRionmdeboard: " " and " " are semantically equivalent ;)
10:33mdeboardu rite
10:34nbeloglazovscriptor: I don't understand why reader does this. Who needs it? I think #(* % %) better than #(*%%)
10:34azkesz,(#(*%1%%2) 4 5)
10:34clojurebot80
10:34azkesz,(#(*%%1%%2) 4 5)
10:34clojurebot320
10:34scriptornbeloglazov: I doubt it was intentional, just a by-product of how it was written, '%%' will never be used to represent a single value, so why not?
10:35scriptornbeloglazov: also, I don't think code like #(*%%) is actually used much
10:35hyPiRionI really hope it isn't.
10:35nDuffscriptor: ...well, there _is_ a valid "why not", because you're limiting the set of potentially available syntax for new reader features to be added later without breaking backwards compatibility with documented parts of the language.
10:37magopiananybody working for relevance here?
10:39hyPiRionMy personal opinion is that the reader has been kind of muddy lately.
10:40chouserhyPiRion: lately? has something changed to make it worse?
10:41hyPiRion,(let [z# 10] `(~z# z#))
10:41clojurebot(10 z__87__auto__)
10:41hyPiRionchouser: Well, maybe not muddy, but there are a lot of special cases not documented.
10:42chouserthe official line has always been, I think, that one should only depend on what's documented. Everything else is subject to change.
10:43chouserSo I wouldn't recommend #(*%%) in code you want to still work in future versions of Clojure.
10:45hyPiRionchouser: Well, inc' and dec' are names which according to the current documentation are invalid, yet they're in core. I don't know whether that means it's okay to create functions named foo' or not.
10:46hyPiRionMind you, I don't feel that the reader is bad, but I just believe the special cases should be documented, so that we know what to expect and what not to.
10:46chouserwell, that's a nice example. Perhaps the docs need to be updated.
10:47casionhyPiRion: why are those invalid?
10:47hyPiRioncasion: From the doc: "Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined)"
10:47luciancasion: i think it's because 'foo is reader for (quote foo)
10:49cemerickhyPiRion: No part of Clojure (including the reader) has a spec associated with it, which is what I think you're after.
10:50chouserwell, that and generally things that are outside the scope of defined behavior are left undefined rather than explicitly erroring out.
10:50cemerickI suppose that's splitting semantic hairs, but oh well.
10:50`fogusHi everyone!
10:50casionhyPiRion: I was under the understanding that the arbitrary precision operators were going to change
10:50chouser`fogus: hi!
10:50casionthat's why they are with the '
10:51casionthey'll be removed at some future time and replaced with a different implementation
10:51hyPiRionOh, many c's here now.
10:51cemerickcasion: How did you get that impression?
10:51`foguscasion: They will?
10:52casioncemerick: I can't recall where I read it, but an example of using them I found online noted that
10:52casionwhich of course could be incorrect
10:52casionlet me see if I can crawl my history and find it
10:53azkeszhow do I check if something is a function aka IFn?
10:53chouserazkesz: ifn?
10:53hyPiRionifn? or fn?
10:54azkeszIFn I guess
10:54chouserheh
10:54azkeszaka the interface?
10:54azkeszcause I'm trying to give relevant error when this happens: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn
10:54azkesz,(class defn)
10:54chouserThe function "fn?" will return true for > but false for :keyword
10:54clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defn, compiling:(NO_SOURCE_PATH:0)>
10:54casiongreat, my browser search ignores single quote
10:55magopianazkesz: i think you're looking for "function?" aren't you?
10:55azkesz,(fn? +)
10:55clojurebottrue
10:55azkeszyes thank you
10:55magopianwhat's the difference between fn? and function?
10:56hyPiRionmagopian: function? doesn't exist, whereas fn? does
10:56hyPiRionI suppose.
10:56magopianhyPiRion: http://clojuredocs.org/clojure_core/clojure.test/function_q
10:57azkeszok i did it, chouser=) that between function with partition
10:57chouserazkesz: nice.
10:57hyPiRionmagopian: Ah, I've never poked around in clojure.test
10:58scriptormagopian: looks like function? also checks if it's not a macro
10:58azkeszI wonder if I can limit the functions passed to only those relevant, like passing + instead of > wouldn't make sense, should I have a list of allowed functions ?
10:58scriptorfrom glancing at its source
10:58hyPiRion,(clojure.test/function? 'concat)
10:58clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.test>
10:59hyPiRionWell, function? seems to resolve symbols.
10:59magopianhyPiRion: i just found it using the quicksearch on clojuredocs, i'm a noob ;)
10:59cemerickhah
10:59cemerickI blame stuartsierra ;-)
10:59stuartsierraWait what?
10:59cemericklol
10:59chouserhah
10:59azkeszthis is what I mean, with 4closure, start with one problem and then expand from it until there are not many variants that you'd like to follow , the root of the tree would be the problem, then expand from it (I should get a specific example)
11:00cemerickWhere's that scoreboard!? :-D
11:00cemerickstuartsierra: s'ok, my fingerprints are all over it too :-P
11:00azkesz,(fn? concat)
11:00clojurebottrue
11:00azkesz,(fn? 'concat)
11:00clojurebotfalse
11:00stuartsierraThe internals of clojure.test are a wild hairy ball of cruft and ill-applied macrology.
11:00casioncemerick: ah damnit, my info was from 1.3 development… since it's been added it's standard now I guess
11:01stuartsierraI was under the influence of too much time on my hands. I take no responsibility.
11:01cemerickstuartsierra: and despite that, it keeps on chugging along…
11:01casionand according to this post by rich: ' is now a constituent character. That means it may appear as a character in symbols in other than the first position, as can #
11:01hyPiRionI was kind of hoping that "too much time" would lead to a good design.
11:01stuartsierraI know. Too big to fail now.
11:02cemerickstuartsierra: Better start pitching "Clojure 2.0" with breaking changes while you've got your hands in the gears.
11:02stuartsierraOh I have a list.
11:02cemerick…or, caught in the gears? ;-)
11:03azkesz,(clojure.test/function? concat)
11:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.test>
11:03azkeszis that ns not loaded or something?
11:03hyPiRionseems like it's not.
11:03cemerick,(require 'clojure.test)
11:03clojurebotnil
11:03chousertry the other bot
11:03chouseroh. or that.
11:03cemerick,(clojure.test/function? 'concat)
11:03clojurebottrue
11:04azkeszlol you loaded itnice
11:04hyPiRionseems scary
11:05azkesz,(clojure.test/function? `'`'`'`'`'`'`'`''`concat)
11:05azkeszyeah I got the same :)
11:05clojurebotExecution Timed Out
11:06azkeszlol I didn't get that
11:06azkeszwonder how I stop it
11:06nbeloglazov,`concat
11:06clojurebotclojure.core/concat
11:06nbeloglazov,`'concat
11:06clojurebot(quote clojure.core/concat)
11:06nbeloglazov,```concat
11:06clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (quote clojure.core/concat))))
11:07azkeszoh i see what happens
11:07nbeloglazovNice
11:07hyPiRion,(require '[clojure.test :rename {function? fn?} :refer [function?]])
11:07clojurebot#<SecurityException java.lang.SecurityException: denied>
11:07hyPiRiongood.
11:08azkeszis there a deep count of elements in case of lists inside lists aka tree?
11:09chouser(count (flatten tree))
11:09chouserone of those few valid uses of flatten
11:10cemerick…except maps are incredibly common tree nodes
11:11cemerickzippers subsume all, per usual
11:11chouseror just tree-seq
11:11chouserwait, zippers work across mixed collection types?
11:11azkeszany chance I could make this count in real time? since it doesn't seem to ever end the computation: (count (flatten '(clojure.test/function? `'`'`'`'`'`'`'`''`concat)))
11:12azkeszor something like have another thread report the current counter
11:12azkeszonly if I make my own tree parser?
11:13cemerickchouser: sure
11:13cemerickenlive is built on top of zippers
11:13chouseroh, but it provides its own zipper fns then. The ones in clojure.zip don't handle mixed, just xml and vectors I think
11:14azkesznvm, it won't work anyway: ##((count (flatten '(clojure.test/function? `'`'`'`''`concat))))
11:14lazybotjava.lang.ClassFormatError: Invalid method Code length 162965 in class file sandbox29188$eval38558
11:14cemerickright, yes
11:17casion,(time (count (re-seq #"\w+" (str '(:A (:B (:D) (:E)) (:C (:F)))))))
11:17clojurebot"Elapsed time: 75.789067 msecs"
11:17clojurebot6
11:17casion,(time (count (flatten '(:A (:B (:D) (:E)) (:C (:F))))))
11:17clojurebot"Elapsed time: 0.391996 msecs"
11:17clojurebot6
11:17casionlol
11:18azkeszmaybe it's because of the regex thingy?
11:18casionthe weird str version is always faster locally here
11:18casionby about 4-5%
11:19casionI'd assume it works correctly as collections are formatted properly?
11:19chouserone string with a space in it would break everything
11:20chousermaps would give different counts
11:20azkeszin this form: (= __ true) is it possible to get the exact value after the ___ and return it in place of the ___ ? by changing only the ___ ?
11:20casionchouser: there we go
11:20pepijndevosHow can I make a synth that slides up/down when you change the freq?
11:20casionchouser: but if you know those aren't true, it does seem to be faster :)
11:20azkeszfor example if "true" was "3"
11:20nbeloglazov,(doc =)
11:20clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
11:20casionpepijndevos: how are you generating the waveform?
11:20chousercasion: I'd be surprised if that were generally true. clojure printer is pretty slow
11:21nbeloglazovazkesz: = returns only true or false. You can't return 3
11:21casionchouser: I made a few tests with just nested collections of symbols and it's always faster here
11:21casionit's a silly idea anyway obviously
11:22azkesznbeloglazov, but if I wanted to place some code in place of the ___ which would make any such form (= ___ x) where x can be anything, always return true
11:22chouserah, yes.
11:22chouserazkesz: you're trying to trick 4clojure?
11:22azkesznbeloglazov, doesn't seem to can be done by changing only the ___
11:22azkeszlol
11:23mdeboardgangnam style
11:23azkeszchouser, I'm expanding a tree from the root problem of (= ___ true) :D that's just what I normally think of when I saw that
11:23casionoppan gungnam style!
11:23casionwhoop whoop
11:23chouserazkesz: http://clojure-log.n01se.net/date/2011-09-19.html#14:21
11:24mdeboardchouser: wow, lol. That is amazing.
11:25casionmdeboard: 안녕히 주무셨어요?
11:25hyPiRionhirr.
11:26wmealing_casion: been going through my head, ALL DAY
11:26wmealing_thanks for the reminder
11:26mdeboardcasion: Nope
11:26casion:(
11:26casionI feel priviledged to have watched the premier of gungnam style
11:27casionand laughed my ass off for about 30 minutes, missing the first set
11:27mdeboardchouser: Can you just make that link the result for ~abstraction
11:27mdeboard~abstraction
11:27clojurebotPardon?
11:27casiongangnam*
11:27chouserwhy "abstraction"?
11:28mdeboardchouser: Aren't those "general solution" forms abstractions of all correct answers into a general form (for that solution 'signature')
11:28mdeboard##(doc reify)
11:28lazybot⇒ "Macro ([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodNa... https://www.refheap.com/paste/4507
11:29mdeboard(reminding myself of reify)
11:30chouserah, abstraction of 4clojure solutions. sure.
11:35azkeszI fail to understand this: #(reify Object (equals [_ _] (= %&))) but I've to admit initially I thought it would change .equals() to always return true regardless
11:36chouserazkesz: why did you stop thinking that?
11:36azkeszI didn't but I got stuck at %& no idea what that does
11:37chouserah, yes. that's just a golfing trick.
11:37azkeszoh and also, I tried the (= 1 2) and false-d:)
11:37azkeszok I guess, I did stop thinking that :/ I stand corrected lol
11:37TimMc,'#(%&) ; azkesz here's the expansion
11:37clojurebot(fn* [& rest__27#] (rest__27#))
11:37TimMcso that makes the fn literal take any number of arguments
11:38azkeszand use uniquely named var?
11:38TimMcSure, but that's just for hygiene.
11:38azkeszwhat would you use if you didn't want it to be uniquely named?
11:39TimMc(= _) will always return true. (= %&) is a trick to both return true and make the fn literal take any # of args.
11:39TimMcazkesz: You wouldn't use a fn literal...
11:39TimMc(fn [& azkesz] (count azkesz))
11:40azkeszoh
11:40scriptorohh, I have no idea why I was thinking (= %&) would be equivalent to (apply = %&)
11:40scriptorit's still just one value, a list
11:40chouserscriptor: right
11:40TimMc,(= 5)
11:40clojurebottrue
11:40azkeszscriptor, that's quite helpful, was thinking the same
11:40azkesz,(= (1 2 3))
11:40clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:41azkesz,(= '(1 2 3))
11:41clojurebottrue
11:41scriptorwhy can't it just return true? Or does it have to explicitly use %& somewhere?
11:41TimMcazkesz: The non-golfed version would be something like (fn [& ignore] (reify Object (equals [this other] true)))
11:42TimMcscriptor: The latter, otherwise it is nullary.
11:42azkeszhow do you test that the reify worked? and would it work only for = or non overriden equals-es in subclasses (in case of using java methods)
11:43azkeszoh wait, it returns a function?
11:44chouserright, because 4clojure wants functions
11:44azkeszoh i see, it does reify and returns the true
11:44TimMcNo, it returns a reified Object.
11:44azkeszok i lost it
11:44chousermost 4clojure problems want a function of 1 or more args that returns a value that is equal to some test value
11:44TimMcThe reified object's .equals returns true.
11:44azkesztimmc, ok i got it now=)
11:45azkeszok so in my test case of (= ___ true) would not work :)
11:45chouseryeah, for that you'd just need the reify part, not the whole #(...)
11:46chouserexcept I'm not sure I quite understand what you want yet.
11:46chouserwhy does true work for ___?
11:46chouserdoesn't
11:46mk4clojure does a straight replacement. So sometimes you'll see answers where people give fragments. Presumably even something like "...))((..." would compile.
11:47TimMcmk: Yes, I was quite annoyed when I discovered that one of the solutions was "+ 2".
11:47scriptorheh, right, it pretty much takes anything could follow '('
11:47TimMcIt hink it has to be one or more valid forms, though.
11:47gtrakhey, is there a ring testing lib that has things like 'has-header?'
11:48chouserditto. but once you accept that as the mechanism used, it opens a world of possibilities...
11:48azkeszchouser, I only mean that I was testing your code wrongly: 1. running it then testing (= 1 2) then 2. testing it on 4clojure for (= ___ true) problem, (but I didn't understand your last question)
11:49mkTimMc: amusing. Yeah, I think the best way to look at it is as "what would you type here" and not "pass me a function"
11:52azkesz,(.equals #(reify Object (equals [_ _] (= %&))) 1)
11:52clojurebotfalse
11:52azkeszwhat am I missing?:)
11:53chouser,(.equals (reify Object (equals [_ _] true)) 1)
11:53clojurebotWARNING: = already refers to: #'clojure.core/= in namespace: sandbox, being replaced by: #'clojure.core/=
11:53clojurebottrue
11:53mdeboard,(= #(reify Object (equals [_ _] (= %&))) 1)
11:53chouserwhoa
11:53clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/=>
11:53mdeboardacked
11:53mdeboardhacked
11:53hyPiRionSorry
11:53hyPiRionmy fault, I uninterned =
11:53hyPiRionor wait
11:54hyPiRionnevermind.
11:54chouser,(.equals (reify Object (equals [_ _] true)) 1)
11:54clojurebottrue
11:54mdeboard,(= 1 1)
11:54clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/=>
11:54mdeboardsomeone broke clojurebot
11:54mdeboard##(= 1 1)
11:54lazybot⇒ true
11:54chouser,(require 'clojure.core)
11:54clojurebotnil
11:54chouser,(= 1 1)
11:54clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/=>
11:54chouser,(require 'clojure.core :reload)
11:54clojurebotnil
11:54nbeloglazov,=
11:54clojurebot#<Unbound Unbound: #'clojure.core/=>
11:54chouser,(= 1 1)
11:54clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/=>
11:54chousershoot
11:54mdeboard:|
11:55SegFaultAXNeeds a restart?
11:56mdeboard,(.enumerate (reify Object (equals [_ _] true)) 1)
11:56clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: enumerate for class sandbox$eval773$reify__774>
11:57jsabeaudryAnyone has had JVM
11:57jsabeaudryoops
11:58chouser,(= 1 1)
11:58clojurebottrue
11:58chousersomeone fixed it
11:58chouser,(= (reify Object (equals [_ _] true)) 1)
11:58clojurebottrue
11:58jsabeaudryAnyone has had a jvm crash on libc frexp? Like such: http://pastebin.ca/2196808
12:00azkeszok i got it, the # form returned a function which in turn returned the reified object, and the form without the # (and the golf) returned just the object
12:00azkesz(.equals (#(reify Object (equals [_ _] (= %&)))) 3)
12:00azkesz,(.equals (#(reify Object (equals [_ _] (= %&)))) 3)
12:00clojurebottrue
12:00azkesz,(.equals (reify Object (equals [_ _] true)) 3)
12:00clojurebottrue
12:02mdeboardchouser: Can you explain what happened there
12:02mdeboard,(.equals (reify Object (equals [_ _] true)) 1)
12:02clojurebottrue
12:02chouserazkesz: right
12:03azkesz,(reify Object (equals [_ _] true))
12:03clojurebot#<sandbox$eval468$reify__469 sandbox$eval468$reify__469@79dd630a>
12:03chousermdeboard: what part are you missing?
12:04azkeszwhat's this #<a b> ?
12:04mdeboardchouser: How that line you typed re-bound (?) the = symbol
12:04mdeboard,#<"a" "b">
12:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unreadable form>
12:04hyPiRion,(boo?)
12:04clojurebottrue
12:04hyPiRionhmm...
12:04azkeszlol
12:04hyPiRion,(booboo?)
12:04clojurebottrue
12:04nbeloglazov:)
12:04azkesz,(fn? booboo?)
12:04clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
12:04hyPiRionheh.
12:05azkesz,(macro? 'booboo?)
12:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macro? in this context, compiling:(NO_SOURCE_PATH:0)>
12:05nbeloglazov,boo?
12:05clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
12:05azkesz,(fn? 'booboo?)
12:05clojurebotfalse
12:05azkesz,(class 'booboo?)
12:05clojurebotclojure.lang.Symbol
12:05azkesz,(class booboo?)
12:05clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
12:05chousermdeboard: I didn't do anything to clojure.core/= It was somehow unbound in clojurebot and then fixed again. I don't know what happened.
12:05mdeboardIRC bots are kind of like kittens.
12:05azkeszoh right, macro is no class=)
12:05mdeboardchouser: Weird
12:05hyPiRionRead the exception.
12:06nbeloglazov,(and true false)
12:06clojurebotfalse
12:06azkesz,(source booboo?)
12:06clojurebotSource not found
12:06mdeboard,(or (and true false) (and false false))
12:06clojurebotfalse
12:06hyPiRion,(= 1 1)
12:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: = in this context, compiling:(NO_SOURCE_PATH:0)>
12:07azkeszagain?
12:07hyPiRionOkay, so I can in fact unintern it.
12:07chouser,(meta #'booboo?)
12:07clojurebot{:macro true, :ns #<Namespace clojure.core>, :name and, :arglists ([] [x] [x & next]), :added "1.0", ...}
12:07azkeszlol
12:07mdeboardhyPiRion: Are you using some admin command or?
12:07hyPiRionmdeboard: Nope, just clojure commands.
12:07azkesz,#'booboo?
12:07clojurebot#'clojure.core/and
12:08azkeszI need to lookup what #' does
12:08chouser,(var boo?)
12:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: boo? in this context, compiling:(NO_SOURCE_PATH:0)>
12:08chouser,(var booboo?)
12:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: booboo? in this context, compiling:(NO_SOURCE_PATH:0)>
12:08chouserheh, he got rid of it
12:08chouserazkesz: #'foo is just short for (var foo)
12:08hyPiRion,(var boo?)
12:08clojurebot#'clojure.core/and
12:09azkeszoh thanks
12:09chouservar is a special operator
12:09azkeszyou can talk to clojurebot on private ?
12:09chouserlike if and quote
12:09chouserazkesz: yes, presumably that's what hyPiRion is up to
12:10azkesz,(fn? if)
12:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: if in this context, compiling:(NO_SOURCE_PATH:0)>
12:10azkeszi was wondering the same thing
12:10azkesz,#'if
12:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: if in this context, compiling:(NO_SOURCE_PATH:0)>
12:10chouser,(doc if)
12:10clojurebotNo entiendo
12:10azkeszlol
12:10hyPiRionWhat
12:10hyPiRionI don't think I did that.
12:10chouserazkesz: try (doc if) at a repl
12:10azkeszok
12:11azkesz,(var)
12:11clojurebot#<CompilerException java.lang.NullPointerException, compiling:(NO_SOURCE_PATH:0)>
12:12azkesz,(var (var))
12:12clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)>
12:12azkesz,(var '(var))
12:12clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)>
12:12hyPiRion,(var var)
12:12clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: var in this context, compiling:(NO_SOURCE_PATH:0)>
12:12hyPiRion,(var +)
12:12clojurebot#'clojure.core/+
12:12azkeszthe errors were interesting
12:15azkesz,#ssss"1"
12:15clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag ssss>
12:15azkeszcan I have an example with that?
12:21azkeszthis seems relevant: http://stackoverflow.com/questions/12022686/what-advantage-are-clojures-1-4-reader-literals-and-why-wont-sample-compile
12:29hyPiRionOh well, who's in charge of clojurebot nowadays?
12:29azkeszthat made me wonder if #_ is a reader form and also if I can use it for complement (looks like I can't)
12:29azkesz,((complement #_ ) 1)
12:29clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
12:29azkeszmakes sense, it's not a function=)
12:30hyPiRionazkesz: Read the exception
12:30azkeszhyPiRion that's different than what I got
12:31hyPiRion,1
12:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
12:31azkeszlol
12:31azkeszpr-str
12:31azkesz,pr-str
12:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
12:31azkesz,(pr-str 1)
12:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to resolve symbol: pr-str in this context, compiling:(NO_SOURCE_PATH:0)>
12:31hyPiRionJust wait until it restarts, I kind of broke it.
12:31azkeszok
12:32azkeszI wonder if I can do this: (= #dup true)
12:33hyPiRionazkesz: If you make a reader, it may be doable. It's not exactly correct use of readers though.
12:33i_sanyone know a good way to get the string output of clojure.pprint/pprint?
12:34i_s(or something similar)
12:34_zachi_s: (with-out-str ...)
12:35azkeszhyPiRion, like this here? https://gist.github.com/2399254
12:35i_s_zach: cool, thank you
12:35pepijndevosovertone randomly broke down :(
12:36hyPiRionazkesz: I don't believe that's the correct usage - I thought they were for message passing from one clojure to another
12:37hyPiRionBut I've not used them, so I may be wrong, of course.
12:37hyPiRion,((complement #_ ) 1)
12:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
12:37azkeszyeah that's the right error
12:38azkesz,#_ 1 2
12:38clojurebot2
12:43nz-how lein actually works if I have compiled the project and then change a single file and recompile?
12:44hyPiRionnz-: It looks at the timestamps of the files, I guess.
12:44hyPiRionThat's what "make" do at least.
12:44nz-and notices that .clj is newer that .class? but what happens then?
12:45S11001001nz-: it doesn't recursively recompile dependents if that's what you're asking
12:45technomancynz-: it will only recompile the file that changed
12:45S11001001nz-: put less stuff in macros
12:45technomancy(plus everything it requires)
12:45technomancyhyPiRion: right
12:46nz-currently I have situation where: lein clean; lein midje and lein clean; touch file.clj ; lein midje give different results
12:46nz-and midje runs bunch of unit tests
12:49nz-actually lein clean; lein compile; touch file.clj; lein midje gives different result than without touching
12:50nz-and file.clj is full of macro evaluations, that work if file is touched
12:54azkesz,(require 'clojure.core :reload)
12:54clojurebotnil
12:55nz-the problem is that it should work like it is working when the file is touched
12:55nz-basically file.clj contains a bunch of call to these: https://github.com/budu/lobos/blob/master/src/lobos/migration.clj#L104
12:56azkeszsounds like, if you clean but all were loaded, it won't do :reload on them, but if the file was modified it will (that's how I understand it)
12:57nz-:reload is repl thing? all these happen without repl
12:58azkeszyou may be right, i'm new:) but I mean, whatever is the equivant of reload if not the require :reload itself
13:00technomancynz-: you should never have to run compile by hand; it gets invoked automatically for you when needed
13:00azkeszwhat I know is that all "places" where that macro is used must be reloaded if the macro changed, else it'll use the old macro
13:01azkesz":reload can be replaced with :reload-all to reload all libraries that are used either
13:01azkeszdirectly or indirectly by the specified library. "
13:02azkeszthat means if I modify my macro file, a :reload-all on it should be done right?
13:02hyPiRionazkesz: In the repl, yes.
13:03azkeszhyPiRion, what are the other cases?
13:04azkeszoh like when a command line is invoked like lein something?
13:06nz-i think i shouldn't need any reloading, since I am just running the whole program via command line
13:06technomancynz-: if you avoid AOT as much as possible a lot of these problems go away
13:06azkeszhyPiRion, if lein detects a changed file doesn't it run the same require/reload internally?
13:06technomancydo you have any gen-class or the like required?
13:08tantamountainI've got a little question—is it ever possible for clojure.string/split to return an empty collection, or nil?
13:11nz-I had :main foo.bar in project.clj, removing it seemed to help
13:12hyPiRiontantamountain: yeah, it can return an empty vector if the whole string matches the regex
13:12tantamountainExcellent! Thank you so much.
13:13hyPiRion,(clojure.string/split "Hello world. This matches everything" #".+")
13:13clojurebot[]
13:13azkeszwow, didn't see that coming
13:13nz-yes, the :main directive seems to cause AOT compilation
13:16nz-but having gen-class on same place where :main was pointing doesn't cause this problem
13:24nz-technomancy: thanks for the hint!
13:25nz-now the next problem is how to have executable uberjar without :main
13:25hyPiRionwithout :main?
13:25technomancyyou can do java -cp my-standalone.jar clojure.main -m my.main.namespace
13:26nz-i'd like to have java -jar package.jar
13:26technomancycan't do that without AOT unfortunately
13:26nz-:(
13:26technomancythe java CLI launcher is horrible
13:26technomancyin case it escaped your notice =\
13:27nz-couldn't I have a some kind of java wrapper as a launcher?
13:28technomancyoh, there is the lein-otf plugin; you could try that
13:29llasramnz-: Oh yeah, if you're using lein2, I have a lein2-compatible fork: https://github.com/llasram/lein-otf
13:30llasramMy version ultimately doesn't AOT any Clojure code at all, which gives me pedantry giggles, or something
13:31llasramYou'll still need a :main, but you can say `:main ^:skip-aot my.cool.namespace`
13:32nz-llasram: that skip-aot is not mentioned in github readme, BTW
13:38nz-works like a charm
13:39nz-does otf give a performance hit compared to aot?
13:42azkesz,(+ 1( (fn one [x] (+ ((fn two [y] (if (< y 10) (one (+ y 2)) (* y 2)) ) x) 7) ) 6))
13:42clojurebot42
13:42pjstadig~suddenly
13:42clojurebotCLABANGO!
13:48lynaghkping: dnolen
13:48dnolenlynaghk: pong
13:49lynaghkdnolen: grammar of graphics in clojure needs to sit on my mind for a bit
13:49dnolenlynaghk: as in - it's still fermenting?
13:49lynaghkdnolen: just added you as a collaborator on the repo so you can check it out, if you want to take it for a spin. Everything it can do is in tests.clj. Might put together static examples + calling code on a plain HTML page later this week
13:50lynaghkdnolen: a fair bit is implemented, but the API is by no means finalized. In particular Hadley just put out a very interesting preprint about nesting graphics (a generalized approach to faceting, basically)
13:50lynaghkdnolen: so I will probably rewrite to incorporate that.
13:50cemerickwow, clojure-maven-plugin sets up tests such that unqualified use of resolve doesn't wok.
13:51cemerickwork, even.
13:51dhmdnolen: where's the best discussion going on about clojurescript?
13:52dnolenlynaghk: yeah I saw that PDF, very cool.
13:53nz-llasram, technomancy: thanks for the help.
13:53lynaghkdnolen: how/where? Are you on that list?
13:55dnolenlynaghk: he posted it to the list.
13:55dnolendhm: here or on the Clojure mailing list
13:55dhmthanks
13:56lynaghkdnolen: hmmm, I didn't know you were interested in the wonderful world of statistical graphics.
13:57dnolenlynaghk: well I sit right next to the NYT graphics desk so it's hard to not be interested. I don't do data graphics but I do love Tufte's writing on the subject.
13:57lynaghkdnolen: anyway, if you have time+interest, I'd love some feedback on the architecture of my current prototype. I'm trying to keep the design as straightforward as possible right now, but I'm interested to see what can change for improved performance (e.g., using reducers)
13:58lynaghkdnolen: you lucky bastard =)
14:01dnolen_lynaghk: reducers on Clojure side or ClojureScript side?
14:02lynaghkdnolen_: either. I'm focusing on Clojure for static graphics at the moment, but will turn to cljs before the end of the year
14:04dnolen_lynaghk: I've done a little bit of work in hopes to improve the performance of reducers in CLJS land - adding array-reduce was one step towards that end.
14:06lynaghkdnolen_: I haven't given it a ton of thought aside from "oh hey, this process is just calling map 20 times across the same data---maybe I should use reducers!". Getting the semantics + API solidified is more important. ggplot in R is pretty slow, so right now it's an easy bar = )
14:07lynaghkdnolen_: anyway, I've got to run for now. I'll ping you if I make any interesting progress.
14:07dnolen_lynaghk: later.
14:09holohi
14:11holothere is a System/getenv function to get an env string. what is the most idiomatic way of doing the opposite? like System/setenv ?
14:12technomancyholo: unfortunately the JVM makes this basically impossible
14:12technomancythe environment is more or less immutable
14:19holotechnomancy, i see. thanks
14:22llasramnz-: Oh, good point on the ^:skip-aot. Updated README
14:23llasramnz-: Performance: might be slightly slower, but I've never quantified it. Might be good to know!
14:24technomancyfull AOT definitely speeds up boot
14:25technomancynz-: another option is to do a full compile only upon release rather than putting it at the top-level of project.clj
14:26S11001001technomancy, holo: if it's subprocess-related, I believe you can pass an environment with your spawns
14:26technomancy:aliases {"release" ["do" "compile" ":all," "uberjar," "clean"]}
14:26nz-technomancy: how to do that? with profiles?
14:26technomancynz-: profiles or aliases
14:28nz-i still dont get why the aot made my program work incorrectly and partial recompilation made it work correctly
14:28technomancythere's a lot of magic in midje; that would be the first place I'd look
14:29nz-it was not midje, since running the actual program had same behavior, more likely i would point fingers at lobos
14:29technomancybut in general AOT is best reserved for "end of the line"
14:29technomancyoh, gotcha
14:30achengkorma question: anyone know how to use where...in without a subselect?
14:31holoS11001001, thanks
14:32nz-acheng: like this? https://github.com/RuuviTracker/ruuvitracker_server/blob/master/src/ruuvi_server/database/event_dao.clj#L22
14:34achengnz-: sure... if ids is coming in as a regular sequence and not the result of another select
14:36nz-lobos had some kind of thing where macros register stuff to an atom
14:38gfredericksibdknox: ping
14:40nz-acheng: so what kind of sql select you would like as the result?
14:41nz-acheng: select * from tbl1 where id in (select some_id from tbl2) ?
14:44lynaghkping: emezeske
14:46achengnz-: ah ok. (where (in :foo (list 1 2 3))) works as you'd expect. thanks!
14:47achengnz-: my initial test of it had an unrelated error. that's what my problem was
14:50SegFaultAXHas anyone heard of datomic being used in production?
14:50SegFaultAXIs it even production worthy?
14:50azkeszdatomic, i like that, next on my list to learn
14:51jsabeaudryI'm getting a SIGV_MAPERR in 'JavaThread "C2 CompilerThread1" daemon'. Anyone knows anything about that thread?
14:51SegFaultAXazkesz: I just got done watching Hickey's presentation on it. It seems like it's full of some pretty fantastic ideas.
14:51azkeszyes indeed, I watched that twice , I still need to rewatch it after I learn some clojure=)
14:52azkeszit certainly seems better that what I wanted to use before, namely berkeleydb je
15:03mattmossIs there a library fn for doing this pattern I keep repeating in my macros? (symbol (str "foo" "/" "bar"))
15:04Chousukemattmoss: why would you do that?
15:04mattmossin a macro
15:04mattmossI could be stupid, too.
15:05mattmoss"foo" and "bar" are replaced by arguments to defmacro
15:05Chousukeyou can do ~'foo/bar
15:05Chousuketo get the symbol as it is
15:06mattmoss,(let [foo "hello" bar "world"] `(~'foo/bar))
15:06clojurebot(foo/bar)
15:06mattmoss,(let [foo "hello" bar "world"] `(~foo/bar))
15:06clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: foo, compiling:(NO_SOURCE_PATH:0)>
15:07mattmoss,(let [foo "hello" bar "world"] `(~(symbol (str foo "/" bar))))
15:07clojurebot(hello/world)
15:07mattmossthat's what I want
15:10llasram,(symbol "foo" "bar")
15:10clojurebotfoo/bar
15:12mattmosswell, mend me with yarn...
15:13mattmossllasram: thanks. I missed the obvious.
15:13llasramhappens to us all :-)
15:16sindikathello everyone! how do i turn [[0 :a] [1 :b] ...] into [[1 :a] [2 :b] ...] by using map? can't find the solution
15:16emezeskelynaghk: yo
15:17scriptorsindikat: think about it, map gets passes a function, the function takes a single argument, an element in the list
15:17xeqido you have a function to turn [0 :a] into [1 :a] ?
15:17sindikatxeqi: i could write an anonymous one
15:17sindikat(map #(+ 1 (first %)) (map-indexed vector [:a :a :a])) just returns (1 1 1)
15:17nz-,(map (fn [[key value]] [(inc key) value]) [[0 :a] [1 :b]])
15:17clojurebot([1 :a] [2 :b])
15:18sindikataha
15:18sindikat(map #(vector (+ 1 (first %)) (second %)) (map-indexed vector [:a :a :a]))
15:18llasram,(map-indexed vector (range 5))
15:18clojurebot([0 0] [1 1] [2 2] [3 3] [4 4])
15:18lynaghkemezeske: hey dude
15:18lynaghkemezeske: writing up a lein cljsbuild issue right now.
15:18llasramsindikat: The issue is that map-indexed calls it's provided function with 2 args, not a 2-tuple as one arg
15:18emezeskelynaghk: uh oh!
15:19sindikatnz-: is that destructuring you used?
15:19nz-yep
15:19lynaghkemezeske: https://github.com/emezeske/lein-cljsbuild/issues/119
15:19sindikatnz-: very elegant, thanks
15:20nz-,(into [] (map (fn [[key value]] [(inc key) value]) [[0 :a] [1 :b]]))
15:20clojurebot[[1 :a] [2 :b]]
15:20nz-now it is vector and not a list
15:22lynaghkemezeske: I have to head out right now, but take a look at the issue. If it seems doable and you'd welcome a patch, I can put in a pull request later today.
15:23emezeskelynaghk: Sure
15:23emezeskelynaghk: I will try to comment on it later today
15:23lynaghkemezeske: cool, thanks man!
15:32sindikatnz-: why couldn't i use vec? because into lazily produces vector from the start, while vec instantly converts seq to vector?
15:34nz-,(vec (map (fn [[key value]] [(inc key) value]) [[0 :a] [1 :b]]))
15:34clojurebot[[1 :a] [2 :b]]
15:34nz-seems to work also
15:35nz-basically i have used into before but not vec
15:35sindikatintuitively i think into is more correct way here than vec, but i can't explain
15:38null-clojurescript requires the JVM too right?
15:39scottjnull-: for compilation, yes
15:39null-ok
15:44SegFaultAXnz-: The use of into in your example seems like a really bad idea.
15:45sindikatSegFaultAX: that is what i'm interested in too
15:45SegFaultAXsindikat: The answer is simple really. Using vec will happen as a single operation.
15:45sindikatso, my question is: if i want to use map over some vector to produce another vector, is the canonical way to just (vec (map ... some-vector)) ?
15:45SegFaultAXsindikat: Using into like that effectively expands into (reduce conj [] (map-indexed ...))
15:46SegFaultAXsindikat: Which means you have a bunch of intermediate (read: throwaway) objects.
15:46sindikatSegFaultAX: you mean vec is more effecient then?
15:46SegFaultAXsindikat: I think so.
15:48hyPiRion,(vec (map #(update-in % 0 inc) [[0 :a] [1 :b]]))
15:48clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Long>
15:48hyPiRion,(vec (map #(update-in % [0] inc) [[0 :a] [1 :b]]))
15:48clojurebot[[1 :a] [2 :b]]
15:49SegFaultAXsindikat: I'm almost certain, yes. The source for vec simply calls the clojure.lang.LazilyPersistentVector constructor.
15:50SegFaultAXhyPiRion: That seems like a bad idea for the same reason as above.
15:52amalloySegFaultAX: (persistent! (reduce conj! (transient []) ...))
15:52nz-SegFaultAX: what is wrong with into?
15:53nz-ah, ok
15:53SegFaultAXamalloy: Oh right. I guess what I said would only apply if it weren't a java collection.
15:53amalloy&(let [coll (doall (range 1000000))] (time (vec coll)))
15:54lazybot⇒ "Elapsed time: 684.977221 msecs" [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90...
15:54amalloy&(let [coll (doall (range 1000000))] (time (into [] coll)))
15:54sindikatwhat is the way to produce the indexed vector from 1 in the first place? i don't want to use map-indexed and then increment every first element of the pair
15:54lazybot⇒ "Elapsed time: 305.938821 msecs" [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90...
15:54hyPiRionThere will probably be some cache here.
15:54SegFaultAXamalloy: Wow. Why is it so much faster?
15:55hyPiRion&(let [coll (doall (range 1000000))] (time (vec coll)))
15:55eddie_hello #clojure. What approach you suggest for a simple webpage scraping? I think about: openstream, bufferedreader, inputstreamreader and then regex for the links... any better idea? Thank you so much...
15:55lazybot⇒ "Elapsed time: 402.381485 msecs" [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90...
15:55SegFaultAXOh, well that's much more reasonable.
15:55hyPiRionNever trust a single attempt.
15:55nz-&(let [coll (doall (range 1000000))] (time (into [] coll)))
15:55S11001001eddie_: tagsoup or nekohtml
15:55amalloy*shrug* the important thing is you made performance recommendations without any idea what's actually faster
15:55lazybot⇒ "Elapsed time: 321.234653 msecs" [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90...
15:55nz-still faster
15:56SegFaultAXamalloy: True.
15:56SegFaultAXamalloy: It was just a guess.
15:56SegFaultAXsindikat: It seems my assumptions were wrong.
15:56amalloypersonally i prefer vec, because if (into [] x) is better than (vec x) there is literally no reason for vec to exist
15:57SegFaultAXamalloy: I really thought that constructor would have a more optimized implementation.
15:57eddie_thank you so much S11001001 ...
15:57amalloySegFaultAX: it does in some cases, although my understanding is there are some pitfalls
15:57S11001001amalloy: aye :)
15:58SegFaultAXamalloy: I'd have thought it was just call conj on its internal vector like conj! is doing.
15:58SegFaultAX.conj, that is.
15:58amalloyeg, (vec some-java-array) seems to (sometimes?) just return a vector that wraps the underlying array, so that changes to the array appear as changes in the vector
16:00sindikatamalloy: to solve this mistery once and for all i created a question on StackOverflow: http://stackoverflow.com/q/12044181/596361 - any ideas on how can improve my question? seems sorta vague currently
16:01hyPiRionOh dog
16:01S11001001sindikat: into [] is not reduce conj, into uses transients when it can; also, into is safer
16:01hyPiRion,(mapv #(update-in % [0] inc) [[0 :a] [1 :b]])
16:02clojurebot[[1 :a] [2 :b]]
16:02hyPiRiontadaaa
16:02hyPiRionWhy didn't I think of that before.
16:03azkeszwhat is a function that will do coll pred coll for each of their elements?
16:03amalloysindikat: start by questioning why you want it to be a vector in the first place. usually you're fine with a lazy sequence
16:03hyPiRionazkesz: coll pred coll?
16:04azkeszhyPiRion, like map does but between two collections
16:04sindikatamalloy: in this particular situation i think i don't need a lazy seq, because i print the vector instantly after it is calculated
16:04azkeszhypirion, [1 2 3 4] + [5 6 7 8] => [6 8 10 12]
16:04hyPiRion,(map + [1 2 3 4] [5 6 7 8])
16:04clojurebot(6 8 10 12)
16:04hyPiRion?
16:04S11001001azkesz: you mean like covariant functor map? good luck
16:05azkeszhyPiRion lol, that's the one, why so simple darn it=)
16:05dsrguruanyone know of a good vim plugin for commenting and uncommenting clojure code? nerdcommenter doesn't seem to handle multiple semicolons well.
16:05azkeszS11001001, what did you mean?
16:05S11001001azkesz: oh, never mind
16:06sindikatS11001001: what did you mean by "into is safer"?
16:07S11001001,(let [o (to-array [1,2,3]) v (vec o)] [(v 1) (do (aset o 1 42) (v 1))]) ; sindikat
16:07clojurebot[2 42]
16:07dnolen_ibdknox: ping
16:07aperiodicdsrguru: I just use i#_ and/or <C-v>[movement]I;
16:08sindikatofftopic: how is that measuring elapsed time called as one word?
16:09hyPiRionmeasuring elapsed time? timetracking?
16:09hyPiRionIt's very much dependant on context, I believe. ;)
16:10Gnosis-In my ns form, I have (:use [clojure.zip :as z]), but it doesn't seem to be working properly. It's defining both next and z/next as clojure.zip/next, when it should only be defining z/next, etc.
16:10sindikathyPiRion: amalloy used it some minutes ago in the channel
16:11dsrguruaperiodic: well, how do you quickly uncomment? (both for ; and #_)
16:11sindikathyPiRion: benchmark?
16:11hyPiRionsindikat: yeah
16:12nz-,(doc mapv)
16:12clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector 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 exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
16:14azkesz,(hash-map :keys [:a :b :a :c] :values [1 2 3 4])
16:14clojurebot{:keys [:a :b :a :c], :values [1 2 3 4]}
16:15emezeskeGnosis-: You're sure that the naked "next" is not just clojure.core/next ?
16:15hyPiRion,(zipmap [:a :b :c :d] [1 2 3 4]) ; azkesz: Is this what you want?
16:15clojurebot{:d 4, :c 3, :b 2, :a 1}
16:15azkeszyes thank god=)
16:16azkeszI've been failing to find that offline
16:17azkeszbut I did remember some case where they used "keys", maybe to extract only the keys from a keymap, then that's something else which I don't want
16:22azkeszis there something like: (zipmap + [:a :b :a :a] [1 2 3 4]) ;=> [:a 8 :b 2]
16:22Gnosis-emezeske: I figured it out; I needed to use :require, not :use
16:23emezeskeGnosis-: Oh! Heh, my brain just translated :use to :require when it saw the :as stuff :)
16:23amalloyyou probably want merge-with +, azkesz
16:24azkeszsounds good, I'll check
16:24amalloy&(apply merge-with + (for [[k v] (map vector [:a :b :a :a] [1 2 3 4])] {k v}))
16:24lazybot⇒ {:b 2, :a 8}
16:24Gnosis-emezeske: it seems like Clojure should complain if it sees an :as with :use
16:24sindikatstupid question: how to create a lazy sequence from 1 to infinity?
16:25amalloy(iterate inc 1)? (rest (range))?
16:25emezeskeGnosis-: Yeah, I would have expected a complaint -- I didn't know :use would allow that.
16:26azkeszamalloy, wow I would not have guessed that with merge...
16:28nz-,(doc iterate)
16:28clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
16:30nz-what does it mean that "f must be free of side-effects"? that the side effects are executed in unpredictable times? or that the iterate function doesn't work if f does side effects?
16:31duck1123it really should be "SHOULD be free" It's legal to have side effects, but expect them to fire an unpredictable number of times
16:41azkesz,(apply merge (for [k [1 2 3 6]] #{k})) ; is this supposed to happen?
16:41clojurebot#{1 #{2} #{3} #{6}}
16:41SegFaultAXazkesz: What are you trying to do exactly?
16:42azkeszSegFaultAX, just testing really
16:42azkeszSegFaultAX, I would've expected maybe #{ 1 2 3 6}
16:42azkesz,(merge #{1} #{2})
16:42clojurebot#{1 #{2}}
16:43amalloymerge is for maps. whatever it does on sets is just random coincidence
16:43azkesz,(merge {:1 :1} {:2 :2})
16:43clojurebot{:2 :2, :1 :1}
16:43Raynes,(into #{1} #{2})
16:43clojurebot#{1 2}
16:43hyPiRion,(clojure.set/union #{1} #{2})
16:43clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set>
16:43hyPiRion,(require 'clojure.set)
16:43clojurebotnil
16:43hyPiRion,(clojure.set/union #{1} #{2})
16:43azkeszbut weren't sets based on maps? or I misforgot something=)
16:43clojurebot#{1 2}
16:43SegFaultAXMisforgot?
16:43RaynesHe accidentally forgot not to forget.
16:44RaynesI guess.
16:44azkeszI remember something like sets having same key/val
16:44SegFaultAXRaynes: That's what I understood, too.
16:44azkeszI meant, that a merge between forgot and misunderstand :)
16:45azkeszI may wrongly remember that sets are internally hashmaps with same key/val
16:45azkeszso I figured that merge would've worked or something
16:46azkesz,(sorted-set 1 2 1)
16:46clojurebot#{1 2}
16:47azkesz,(class (sorted-set 1 2 1))
16:47clojurebotclojure.lang.PersistentTreeSet
16:47azkesz,(class #{1})
16:47clojurebotclojure.lang.PersistentHashSet
16:47Raynesmisunderforgot
16:47azkeszlol
16:48hyPiRionSets are implemented as a hash map where key and value are the same value.
16:49hyPiRionBut you shouldn't treat them as such.
16:49scriptorlooks like it can use anything that's an IPersistentMap to store the elements
16:49azkesz,(clojure.set/union (for [k [1 2 3 6]] #{k}))
16:49clojurebot(#{1} #{2} #{3} #{6})
16:49l1xhey ho hi everybody
16:49azkesz,(apply clojure.set/union (for [k [1 2 3 6]] #{k}))
16:49clojurebot#{1 2 3 6}
16:49scriptorbut yes, that's just incidental, don't treat them as maps
16:49azkeszhyPiRion, cool
16:49l1xwould sombody hit me with some hints why i fail here -> https://gist.github.com/3407691#comments
16:50llasraml1x: Because map returns a sequence?
16:50llasrams,sequence,lazy sequence,
16:51emezeskel1x: The problem probably has to do with a dynamic binding interacting badly with a lazy-seq
16:51emezeskel1x: Assuming that jmx/with-connection sets a dynamic binding behind the scenes
16:52llasramemezeske, l1x: Or even just keeps a connection open for its dynamic scope
16:52l1xso have you seen the error message in the comments section?
16:52emezeskellasram, l1x: Good point
16:53emezeskel1x: http://kotka.de/blog/2009/11/Taming_the_Bound_Seq.html
16:53emezeskel1x: http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/
16:53emezeskel1x: Those might be helpful
16:53l1xkk
16:53emezeskel1x: The thing you need to think about is "when is getCanonicalName actually called"
16:54emezeskel1x: Part of the answer is "not while the connection is open"
16:54l1xwait, the first part is ok
16:54l1x(map (memfn getCanonicalName) (jmx/mbean-names "hadoop:*")))))
16:54l1xthis works perfectly
16:54l1xmy problem is that i cant apply the second map to this ^
16:55l1xand the error message is coming from the jmx layer saying there is no such a mbean
16:55scriptorjmx/mbean is a java method, right?
16:55l1xnope
16:55l1xthis is the clojure lib
16:55scriptorah
16:56emezeskel1x: How much do you understand about lazy sequences?
16:56l1xi have read the book this weekend
16:56emezeskel1x: So do you understand why a "with-" function and a lazy sequence might not work well together?
16:57devinusis there a way to install user plugins from the command line in lein2?
16:57Raynesdevinus: No.
16:57devinusoh ;_;
16:57RaynesYou just edit ~/.lein/profiles.clj
16:57llasraml1x: For a concrete suggestion, try wrapping what you have inside jmx/with-connection in a `doall`
16:57l1xemezeske: yep, cause you dont have the certain element of the lazy seq "computed" at the time you are calling the with- on it
16:58l1xllasram: ok i try that, i just dont understand why the first map work
16:58l1xand the second fail
16:58l1x(maybe the first time it is not a lazy seq)
16:58emezeskel1x: Are you trying things out in the REPL?
16:58l1xnope
16:58l1xlein project
16:59emezeskel1x: Okay. I was just going to mention that sometimes you need to carefully pay attention to what might cause a lazy-seq to be realized
16:59scriptoryou can use the repl with a lein project
16:59emezeskel1x: E.g. printing it out,e tc
16:59l1xyep
16:59maaclIs there a way to embed a Incanter chart in a Hiccup page other than writing it out to disk?
16:59l1xemezeske: thx, i try with doall
16:59emezeskel1x: Good luck sir!
17:00l1x;)
17:00devinuswhere does lein2 install plugins?
17:01devinusoh, .m2 it seems
17:01nz-devinus: i'd assume that they are with normal maven deps
17:04devinuswhat are some of the most useful/coolest lein2 plugins?
17:04l1xyou guys are awesome
17:04l1xit works! :)
17:04emezeskel1x: sweet. :)
17:05scriptordevinus: can't name specific ones, but there's a list here https://github.com/technomancy/leiningen/wiki/Plugins
17:06brainproxysuggestions for helpful tools/libs for doing complex web-form validation .. prefer something that can be loosely coupled to ring/compojure rather than a framework
17:09gtrakis there like a clojure analogue to scheme's atom? ?
17:09S11001001gtrak: the atom/list dichotomy isn't so clear in clojure, so I'm not sure it would have a useful universal meaning
17:10S11001001gtrak: check out seq?, sequential?, and core.incubator's seqable? for some variants
17:10gtrakah
17:11S11001001,(sequential? "abc")
17:11clojurebotfalse
17:11S11001001but "abc" is `seqable?'
17:11gtrak,(sequential? [])
17:11clojurebottrue
17:11nz-devinus: lein-ring, lein-otf
17:11gtrak,(sequential? {})
17:11clojurebotfalse
17:11gtrakhmm
17:11S11001001I strongly disfavor seq?, picking sequential? or seqable? depending on scenario
17:12dnolen_gtrak: (not (coll? x)) is probably the closest
17:13S11001001,(coll? (map identity [42]))
17:13clojurebottrue
17:13S11001001mmm
17:17azkeszis there a function that would return the first element that satisfies the predicate? instead of true what some does
17:18dnolen_azkesz: doesn't return true.
17:18dnolen_azkesz: er I mean, some doesn't return true.
17:18azkeszsorry I meant every?
17:19maaclazkesz: (first (filter predicate...
17:19azkesz,(some #(not= % nil) [ nil 1 nil ])
17:19clojurebottrue
17:20duck1123that's because your predicate is returning true
17:20azkeszmaacl, thanks that's works
17:20azkeszduck1123, i see what you mean, let me check
17:21azkesz,(some #(if (not= % nil) :a :nota) [ nil 1 nil ])
17:21clojurebot:nota
17:21azkesz,(some #(if (not= % nil) :a nil) [ nil 1 nil ])
17:21clojurebot:a
17:22azkesz,(some #(when-not % :a) [ nil 1 nil ])
17:22clojurebot:a
17:22azkesz,(some #(when-not % %) [ nil 1 nil ])
17:22clojurebotnil
17:22duck1123,(some identity [nil 1 nil])
17:22clojurebot1
17:22duck1123granted, that also kills false
17:23azkesz,(some identity [ nil :a nil ]
17:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
17:23azkesz,(some identity [ nil :a nil ])
17:23clojurebot:a
17:23azkeszthat's quite uber:D
17:25azkeszthat solves this one=) http://www.4clojure.com/problem/73
17:26azkeszI think the " Now you can move on to" is kinda random, I wasn't supposed to reach this Hard problem before completing all the easy ones
17:28azkeszI'm mind boggling watching the other solutions
17:42azkeszAn Error occured: timeout
17:42azkesz~guards
17:42clojurebotSEIZE HIM!
17:42azkesz4clojure is down?
17:43azkesznvm, it's kinda back but slow
17:44azkeszok it's dead:) 502 Bad Gateway maybe I should watch a movie, thanks to all that helped! I'll be bac(k)
17:46Raynesamalloy: ^
17:47amalloyRaynes: it started itself back up even as he was complaining. back to being fast before he left
17:47RaynesCool.
17:47nz-what was the name of slime/swank replacement that somebody was making?
17:48Raynesnrepl.el
17:50nz-there was also something else
17:50Raynesnrepl.el times 2?
17:50amalloyritz
17:51RaynesOh. Didn't realize it was a replacement.
17:51amalloyit's more like a reimplementation
17:51nz-well something related at least
17:51antifuchsnz-: ritz.
17:51antifuchsyeah, ritz is quite neat. gotta polish up my branch a bit (:
17:52antifuchsit can talk to nrepl or to slime on the emacs side, which is pretty cool (:
17:52antifuchs(I prefer slime myself, so yay)
17:53RaynesI'm happy I can put SLIME far, far behind me.
17:53scizo_\leave
17:53scizo_oops
17:54nz-is ritz usable now?
17:55antifuchsnz-: it works for me, for superficial usage. hugod would know for sure
17:56hugodI've used it exclusively for well over a year
17:56antifuchsRaynes: yeah, that's what many people say and I don't doubt that. For me, it's 7 years of finger memory and slime-selector addiction (:
17:56antifuchs(if it hasn't been longer. getting old)
17:56Raynesantifuchs: Well, at least you aren't using swank-clojure.
17:57RaynesI feel bad for anyone who has to maintain that.
17:57antifuchsRaynes: hah, I did hack that into shape to use it with current slime (:
17:57antifuchswasn't too horriffic, tbh!
17:57antifuchs(nooot that i'm volunteering!) ((:
17:58devinusi'm guessing nobody uses the jdk7 from oracle on OS X yet?
17:58Rayneswmealing_: If you're using emacs, nrepl.el is nice.
17:58RaynesIf not, VimClojure is nice.
17:58RaynesIf not Vim, CCW is nice.
17:58Cr8devinus: I am, I think.
17:58wmealing_Raynes: emacs at the moment
17:58Cr8Yep. I am.
17:58RaynesWhen light table can save files properly and stop losing my bloody code, it'll be nice.
17:58devinusi get a lot of NullPointerExceptions with some packages
17:58devinuslein-ring for instance
17:59Cr8devinus: hm. I've not had that issue with lein-ring, and I have used it.
18:00Cr8I've got java -version "1.7.0_04-ea"
18:00devinusoh
18:00devinusi don't think that's the blessed OS X version
18:01devinusoracle has only released 1.7.0_06-b24 so far
18:01Cr8I know I downloaded whatever the blessed version was
18:01Cr8http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html from here
18:02Cr8ah..
18:02Cr8but I had openJDK above it in preferred order
18:02Cr8in my prefpane
18:02Cr8now I have java -version java version "1.7.0_06"
18:03Cr8lein ring seems quite happy with that one too, though
18:05nz-well ritz didn't work
18:05nz-emacs says: symbol's value as variable is void: slime-ritz
18:08wmealing_Raynes: nrepl.el is actually not bad..thanks
18:08wmealing_and no problems getting it working out of the box
18:11SegFaultAXSpeaking of 4clojure, what am I doing wrong? (fn [[h & t] n] (if (zero? n) h (recur t (dec n)))) http://www.4clojure.com/problem/21
18:13bdeshamhi all! I'm trying to parse XHTML with Clojure, but the parser complains that it doesn't recognize entities (e.g. "&nbsp;"). any idea where to start with this?
18:13bdeshamI tried using enlive's parse function, but same thing
18:13SegFaultAXHmm, (fn [coll n] (first (drop n coll))) worked.
18:15Cr8ha, that's weird
18:15Cr8I suppose the destructuring might be expanding nth in there
18:16SegFaultAXCr8: In my solution above?
18:16Cr8yeah
18:17scriptorSegFaultAX: what error are you getting?
18:17Cr8yeah, that's what happens.
18:17SegFaultAXscriptor: Nth is forbidden or somesuch.
18:17scriptorSegFaultAX: yea, I just converted mine to use destructuring and got the same issue
18:18SegFaultAXscriptor: I just switched to using drop instead.
18:18Cr8Destructuring wraps your body in a let form that is created by https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3928
18:19Cr8which does inject nth in there if you use &
18:26Cr8,(clojure.walk/macroexpand-all '(fn [[h & t] n] (if (zero? n) h (recur t (dec n)))))
18:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk>
18:26Cr8beh
18:26Cr8it expands to: (fn* ([p__786 n] (let* [vec__787 p__786 h (clojure.core/nth vec__787 0 nil) t (clojure.core/nthnext vec__787 1)] (if (zero? n) h (recur t (dec n))))))
18:37nz-I tried to install slime-ritz but something went wrong, thing starter working when I removed *.elc files for slime-ritz
18:47RoxxiWhat's a good library for creating html in clojure... clj-html?
18:47brehauthiccup
18:48Roxxinice, thanks
18:50TimMcRoxxi: And there's enlive, which is crotchety and difficult, but backed by a nice concept.
18:53RaynesEnlive doesn't create html
18:53RaynesIt modifies html.
18:55nz-got ritz running but for example C-c C-l (load file) doesn't seem to work
18:55nz-MalformedURLException
20:07azkesz,(#( (and ((set (keys %2)) %1) (%1 %2)) ) :a {:a nil :b 2})
20:07clojurebot#<NullPointerException java.lang.NullPointerException>
20:08azkeszis there something like macroexpand but for anonymous functions?
20:08azkeszor some kind of eval with a depth maybe?
20:09technomancy,#(identity %)
20:09clojurebot#<sandbox$eval59$fn__60 sandbox$eval59$fn__60@7d6c6f48>
20:09technomancy,(read-string "#(identity %)")
20:09clojurebot(fn* [p1__89#] (identity p1__89#))
20:09amalloy,'#(identity %) is what technomancy meant the second time :P
20:09clojurebot(fn* [p1__114#] (identity p1__114#))
20:09technomancyderp
20:09technomancyyes
20:11azkesz,(read-string '(#( (and ((set (keys %2)) %1) (%1 %2)) ) :a {:a nil :b 2}))
20:11clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.String>
20:11azkesz(read-string "(#( (and ((set (keys %2)) %1) (%1 %2)) ) :a {:a nil :b 2})")
20:11azkesz,(read-string "(#( (and ((set (keys %2)) %1) (%1 %2)) ) :a {:a nil :b 2})")
20:11clojurebot((fn* [p1__172# p2__171#] ((and ((set (keys p2__171#)) p1__172#) (p1__172# p2__171#)))) :a {:a nil, :b 2})
20:11technomancyif you're having trouble debugging it, don't use #() yet
20:12azkeszok
20:13azkeszit actually works if it's not anonymous
20:13azkesz,(#( (and ((set (keys %2)) %1) (%1 %2)) ) :a {:a nil :b 2})
20:13clojurebot#<NullPointerException java.lang.NullPointerException>
20:13azkesz,((fn [key map] (and ((set (keys map)) key) (key map)) ) :a {:a nil :b 2})
20:13clojurebotnil
20:14emezeske,'#(identity %)
20:14clojurebot(fn* [p1__257#] (identity p1__257#))
20:14emezeske,'#((identity %))
20:14clojurebot(fn* [p1__284#] ((identity p1__284#)))
20:15azkeszoo
20:15azkesz,(#( and ((set (keys %2)) %1) (%1 %2) ) :a {:a nil :b 2})
20:15clojurebotnil
20:15azkeszemezeske, why thank you=)
20:15emezeskeazkesz: thank technomancy! :)
20:16azkeszI missed it the first time i see
20:16emezeskeAt any rate, my personal taste for something that has multiple args, used multiple times, is to use a fn with well-named args
20:17emezeskeBut of course that's a matter of opinion :)
20:17azkeszI agree it's better for readability and I want that
20:22azkeszwe need a better way to thank people, every time I thank someone I feel like I'm fakeing it, or somehow stealing something from them lol that's why I kinda try to avoid thanking, also because it feels like I nolonger feel obliged to them now that I thanked them:) besides thanks are always implied; but then there's the matter of them maybe waiting for a thank at least as a symbol of acknowledging
20:22azkeszthat their help was well received
20:22azkesz,(fn? thanks)
20:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: thanks in this context, compiling:(NO_SOURCE_PATH:0)>
20:23emezeskeazkesz: Sometimes people will ,(inc nickname) to sort of upvote them
20:23azkeszdoes clojurebot have any way of knowing who typed the command?
20:24azkeszthat's good enough emezeske, even better :D
20:25emezeske(inc clojurebot)
20:25lazybot⇒ 13
20:25azkesz,*ns*
20:25clojurebot#<Namespace sandbox>
20:26azkeszemezeske the nicks are not already defined right?
20:26azkeszonly some
20:26emezeskeazkesz: I don't know how it works. I think you can use any nick, and it will start at zero, but I have never experimented
20:26azkesz,(ns-resolve *ns* aka)
20:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: aka in this context, compiling:(NO_SOURCE_PATH:0)>
20:27azkesz,(ns-resolve *ns* 'aka)
20:27clojurebotnil
20:27brehaut(inc not-a-real-nick-at-all)
20:27lazybot⇒ 1
20:27emezeske(dec not-a-real-nick-at-all)
20:27lazybot⇒ 0
20:27azkeszoh without the ","
20:27azkeszok then, no headaches:)
20:27azkesz(inc emezeske) (inc technomancy)
20:27lazybot⇒ 1
20:27azkeszlol
20:27azkeszwonder if the first or last got it
20:27brehautfirst
20:27azkeszor both, as it would by clojure
20:28emezesketechnomancy is certainly > 0
20:28azkesz,emezeske
20:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: emezeske in this context, compiling:(NO_SOURCE_PATH:0)>
20:28brehauttechnomancy has karma by the bucket
20:28azkeszwhat is the query of the value?
20:28brehautazkesz: its not running through the evaluator at all. its special lazybot magic
20:28brehaut$karma technomancy
20:28lazybottechnomancy has karma 34.
20:28azkeszbrehaut, you're right, got it
20:28azkesz(inc technomancy)
20:28lazybot⇒ 35
20:28azkeszok done with my current thanks:D
20:29azkesz$karma emezeske
20:29lazybotemezeske has karma 1.
20:29azkesz$karma chouser
20:29lazybotchouser has karma 7.
20:29azkeszlol
20:30azkesz,(println "test")
20:30clojurebottest
20:30azkeszi wonder if I can implement a function and have clojurebot inc karma :)
20:30azkesz,(println "(inc chouser)")
20:30clojurebot(inc chouser)
20:30lazybot⇒ 8
20:31azkesz:-"
20:31casionlol
20:31brehautthat is in fact the only way you can dec your own karma
20:32azkeszinteresting
20:33brehautraynes really needs to fix that; i frequently need to dec myself
20:34azkesz$karma brehaut
20:34lazybotbrehaut has karma 6.
20:34azkeszwhy do you need to?
20:34brehautbecause i frequently say stupid and wrong things
20:35azkesznot-a-bot pass :)
20:42azkeszi can't make an alias in mIRC unless i put a space after the ' in: /thanks /say ,(thanks '$$1)
20:43azkeszwrong chan, soz:)
20:43amalloythe lazybot karma system is mostly for fun anyway. nobody answers questions in here just to boost their karma
20:44azkeszI dig that, but I feel it would help give more meaning to my thanks yous if I were to instead do that :)
20:45azkeszactually, I can just do the (inc nick) instead of defining a thanks fn in clojurebot and calling it
20:46Cr8azkesz: I believe you can tell mIRC script to omit the space by using a pseudo-var
20:46Cr8its something like
20:46Cr8(thanks ' $+ $$1)
20:46Cr8or $$+
20:47Cr8its been like, 8 years since I touched mIRC so =P
20:47azkeszthat's the one, i received a similar reply on ##mirc : ' $+ $$1
20:48Cr8hell yeah, I'm surprosed I remembered that.
20:48Cr8*surprised
20:48azkesz(inc Cr8)
20:48lazybot⇒ 1
20:48azkesz=)
20:48Cr8$karma Apage43
20:48lazybotApage43 has karma 1.
20:49azkeszChanServ
20:49Cr8is my other nick
20:49azkeszgreat now i need to know how to /say $karma lol
20:49Cr8apparently i got inc'd once in the past
20:49Cr8I belive that's just $$ $+ karma
20:49azkeszah so simple
20:50azkesz$$karma ChanServ
20:50Cr8or maybe only the one $ =P
20:50Cr8*Shrug*
20:50azkeszyep it was one
20:50azkesz$karma ChanServ
20:50lazybotChanServ has karma 0.
20:51azkesz(inc Cr8)
20:51lazybot⇒ 2
20:52azkeszwould be cool if the karma points were kept in context or something, or at least the date, or if chan is logged an url to the inc line :)
20:52seawordI am using Cheshire to output json and was wondering what people have done regarding clojure naming (e.g. { "first-name": "Fred" }) and typical JS conventions of { "firstName": "Fred" } or even { "first_name": "Fred" }. Do people typically stick with the clojure naming on the client side?
20:53cshell$karma cshell
20:53lazybotcshell has karma 0.
20:53cshellhow do you get karma anyway?
20:53aperiodicbribes
20:55gfredericks,(println "(inc gfredericks')")
20:55clojurebot(inc gfredericks')
20:55lazybot⇒ 2
20:56azkesz$karma gfredericks
20:56lazybotgfredericks has karma 6.
20:56gfredericksI wonder where the first one for gfredericks' came from
20:56azkeszthe other is like your test nick?
20:56gfredericksI was just using it to demo self-karma-increases
20:56emezeskegfredericks prime
20:56azkeszlol
20:56gfrederickswithout devaluing my actual karma
20:57azkesz,(false? nil)
20:57clojurebotfalse
20:57emezeskegfredericks: multiple personality disorder?
20:57gfredericksemezeske: multiple personality order.
20:57emezeskegfredericks: :)
21:00azkesz,(#_ (range))
21:00clojurebot()
21:01azkeszany chance we can do an alias for #_ ? :)
21:02gfredericksthe reader isn't configurable
21:02azkesz,(defn dont [ignored & others] (do others))
21:03clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:03gfredericksyou can define a macro equivalent to comment
21:03azkeszthat would be an emulation=)
21:03gfrederickswhich is mostly like #_
21:03gfredericks,((comment (range)))
21:03azkeszcan it be a function too?
21:03clojurebot#<NullPointerException java.lang.NullPointerException>
21:03azkeszthe double paranthesis, I had that above=)
21:03gfredericksazkesz: (constantly nil) is a function that ignores its inputs
21:04gfredericks(def don't (constantly nil))
21:04gfredericksbut you don't prevent evaluation of the arguments that way
21:04azkeszoh i see
21:04azkeszbut i only wanted the first one ignored in the dont
21:04azkeszoh that's why the macro
21:05blrandelwould anyone have any thoughts on whether core.logic might be an appropriate alternative for a use case where a rules engine is typically used?
21:05gfredericksblrandel: numbers!
21:05gfredericksbe careful that it can do what you need numerically
21:06azkesz(inc gfredericks)
21:06lazybot⇒ 7
21:06blrandelgfredericks: ok, I'll keep that in mind - I'd like to write an 'expert system', but something like Drools just seems very heavy and enterprisey
21:06gfredericksazkesz: (defmacro with-note [note & exprs] (cons 'do exprs))
21:07azkeszgfredericks, i see that if dont is a function this would timeout: (dont (apply + (range)) 1 2)
21:07azkeszbut not if it's a macro
21:07gfredericksright
21:10azkeszthat range I used earlier made my eclipse unresponsive, any chance I can launch another repl somehow and interrupt that infinite range ? I figure it must be in the same jvm
21:16blrandelazkesz: unresponsiveness is part of the eclipse experience, try to embrace it
21:16azkeszblrandel it happens rarely though, would u suggest a different environment ?
21:17blrandelas far as IDEs for clojure go, I think that's your best option
21:21azkeszgreat cause I got used to it
21:22casioneclipse the best option for clojure?
21:22casionsurely you jest
21:22azkeszide
21:22azkeszbut I guess idea has plugin too
21:22casionstill jesting without a doubt
21:22azkesz,(fn? jest)
21:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: jest in this context, compiling:(NO_SOURCE_PATH:0)>
21:23blrandelcasion: as far as IDEs go - counterclockwise is further along than the intellij plugin?
21:23azkesz,(defmacro with-note [note & exprs] (cons 'do exprs))
21:23clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
21:23casionblrandel: no idea
21:24casionI'm not sure why emacs is excluded as an IDE in the context of any lisp
21:24azkeszgfredericks, i found an uglier way: (defmacro with-note2 [note & exprs] `(do ~@exprs))
21:24gfredericksamalloy: I just got a permuto that doesn't diverge; it might be terrible though
21:27azkesz(inc gfredericks)
21:27lazybot⇒ 8
21:27azkesz(inc blrandel)
21:27lazybot⇒ 1
21:28gfredericksazkesz: you are inflating the currency
21:29azkeszyeah I'm starting to feel the weight of my doing
21:29azkeszthis may be worse than saying thanks
21:30azkeszwhat's the ultimate currency? is it cpu time ? aka attention
21:30gtuckerkelloggI'm doing something wrong with clojopts (from amalloy).
21:32gtuckerkellogg If I run (-main "--help") it works as expected, but if I "lein bin" the program and use the --help option on the command line, I get nothing. Any thoughts? The -main function is here http://pastebin.com/433Vqmv9
21:34amalloysounds like lein bin isn't invoking your main in the way you expect; hopefully clojopts isn't involved at all
21:36casion,(println "(println \",(println \\\"wee\\\"\")")
21:36clojurebot(println ",(println \"wee\"")
21:36casionclever
21:36gtuckerkelloggamalloy, hmm, I suppose you right
21:37amalloygtuckerkellogg: what about lein run? maybe you're not specifying the right main-related options in project.clj
21:38gtuckerkelloggamalloy, oh, that's a good thought. Ill look into it.
21:38azkeszblrandel, heh timedout again, I guess you were right, it's just that I wasn't running the "right" code, I tried iterate now
21:38casion1228Wendy1228
21:38gtuckerkelloggi recently switched to lein 2, so that could well be a possibility
21:38casion194
21:39casionzzz
21:39azkeszblrandel, I mean, unresponsive eclipse
21:39gtuckerkellogglein run --help works.
21:39gtuckerkelloggso that's it
21:41blrandelazkesz: you could try allocating more memory in eclipse.ini
21:41azkeszblrandel, I just noticed that killing eclipse wasn't enough to kill the repls that were using the cpu, had 2 by now eating ram too:)
21:41azkeszmaybe it was a bad idea typing in repl: (iterate #(+ 4 %) 0)
21:44azkeszwow that was crazy, not that I see what iterate does:)
21:45azkesz,(take 10 (iterate #(+ 4 %) 0))
21:45clojurebot(0 4 8 12 16 ...)
22:44saurik(defrecord test []) -> "ClassCastException clojure.lang.Var cannot be cast to java.lang.Class clojure.lang.Namespace.referenceClass (Namespace.java:129)" <- it seems problematic that if someone in a different namespace that I happen to be using decides to create a variable that collides with one of my record names, my code will break. am I doing something wrong?
22:50xeqi&test
22:50lazybot⇒ #<core$test clojure.core$test@19dfe6b>
22:51xeqiI think its cause test is already used for clojure.core, which gets used automatically in namespaces
22:52xeqioh, nm.. misread what you said
22:53xeqicould always use refer instead of use, then you just have to watch clojure.core for name smashing
22:54xeqi* require, not refer
23:16duck1123I need a way to make sure my js application only makes a single request for a resource. There's TrafficCop, but I'm wondering if there's a better ClojureScript-y solution. Should I use an atom?
23:24saurikxeqi: right, but clojure core actually has a ton of things in it, and more are added with each new version of clojure. it normally isn't a problem if I have variables (functions, data, bindings, lets, etc.), but with defrecord I run into pain
23:24saurikuser=> (defprotocol test (a [this]))
23:24saurikWARNING: test already refers to: #'clojure.core/test in namespace: user, being replaced by: #'user/test
23:37cgagI'm getting "REPL server launch timed out." when running lein repl, anyone run into that before? It's worked fine in the past.
23:49jkkramersaurik: (ns example.core :refer-clojure :exclude [test])