2014-01-23
| 00:00 | ddellacosta | tutysara: that would be great. re: anti-forgery-tokens, are you having problems with those conflicting or something? As I haven't done a multi-provider one, I'm not sure how they would interact |
| 00:01 | ddellacosta | tutysara: ah, okay, looking at the code again I recall now that they are generated for every provider redirect, during authentication. They shouldn't conflict with each other, are you having other problems? |
| 00:03 | tutysara | ddellacosta: we are associating {:anti-forgery-key :state} in session, when I log in using the second provider after logging of the first i see something like {:anti-forgery-token1 :state, :anti-forgery-token2 :state} in the session. It didn't had any issues with the second provider though. I thought there might be some reason to do {:anti-forgery-key :state} instead of {:state :anti-forgery-key } and wanted to check with you |
| 00:04 | akurilin | technomancy, sm0ke: partial + apply comp did the trick, thanks! |
| 00:04 | ddellacosta | tutysara: right, I do remember doing that explicitly |
| 00:06 | ddellacosta | tutysara: I don't remember explicitly, but I suspect it was security related, to make it harder to forge that value |
| 00:08 | tutysara | ddellacosta: okie, so you were are keep track of all the tokens used, I will keep this aside as of now, you can drop me a mail when you get it |
| 00:09 | ddellacosta | tutysara: what do you mean? Is there a reason you want to change it? |
| 00:09 | ddellacosta | tutysara: I'm not sure what you want me to email you about. |
| 00:12 | tutysara | ddellacosta: nope it doesn't affect any functionality, just curious why it is done this way, if you remembered why it was coded as {:anti-forgery-key :state} instead of {:state :anti-forgery-key } you can update me |
| 00:12 | ddellacosta | tutysara: already, if I remember I will... |
| 00:12 | ddellacosta | *alright |
| 00:12 | ddellacosta | (not already) |
| 00:13 | tutysara | ddellacosta: ok sure :) |
| 00:13 | ddellacosta | tutysara: it may have been ill thought out. I'm looking around now trying to find any similar logic espoused by anyone else, but I'm failing to find anything. |
| 00:14 | tutysara | ddellacosta: :) |
| 00:14 | ddellacosta | tutysara: that said, if it doesn't cause problems there's probably no reason to change it--it's really just meant to identify a unique oauth2 authentication. That said, it's probably worth considering what implications there are if more than one oauth2 provider is being used. Hmm...will think on it and try some things out. Thanks for bringing it up! |
| 00:16 | tutysara | ddellacosta: another thing i wanted to check is, if we cancel the access request in the provider screen the workflow locks, i.e. we keep redirecting to the :authentication-uri |
| 00:16 | ddellacosta | tutysara: yeah, that just sounds like a bug. :-) Definitely file issues/pull requests for anything like this you find--that is the best way. |
| 00:25 | tutysara | ddellacosta: this is what I am doing to workaround this - in the workflow I check if we are from the callback uri and if it is from the call back and still if we don't have the code or mismatch in state, then redirect to error-page else redirect to the provider for code, here is the gist - https://www.refheap.com/26681, I will send a pull request if this looks fine |
| 00:26 | ddellacosta | tutysara: I'm trying to figure out what the spec says first, if it says anything |
| 00:28 | tutysara | ddellacosta: sure |
| 00:31 | ddellacosta | tutysara: so, what should happen is that the authorization server should respond with HTTP 400 if it fails: http://tools.ietf.org/html/rfc6749#section-5.2 What the friend-oauth2 code should do is test based on this. If you want to write this code and submit a pull request, go for it--otherwise I'll take care of it whenever I can get to it. If you write code to handle this case, then make sure you include a test for it as well. |
| 00:36 | ddellacosta | tutysara: ah, sorry, that is for the authorization token request, not the initial authentication (although I'll need to add that too)--what you want is this section: http://tools.ietf.org/html/rfc6749#section-4.1.2.1 |
| 00:37 | ddellacosta | tutysara: it looks like an error message should be appended in the response that can be checked. |
| 00:38 | ddellacosta | tutysara: again, I'll take care of this as soon as I can, but won't be able to deal with it right away. |
| 00:41 | tutysara | ddellacosta: okie, np, may I create an issue to track this |
| 00:41 | ddellacosta | tutysara: yes, please do! |
| 00:41 | ddellacosta | tutysara: thanks |
| 00:42 | tutysara | ddellacosta: thanks again for your time :) |
| 00:42 | ddellacosta | tutysara: thank you for using this library, and working through these issues--you are helping make this a better library! |
| 00:47 | quizdr | ddellacosta i see you have a library for helping with google app engine, is that right? |
| 00:48 | quizdr | i've been experimenting on Heroku but I have some credit with GAE to put to use but the dev ops of setting up clojure on that system have been a turnoff for me. |
| 00:48 | ddellacosta | quizdr: and clojure? no, that's not me, I...am not a fan of google app engine...heh |
| 00:48 | ddellacosta | quizdr: I can say that heroku is going to be a *much* easier deploy |
| 00:48 | quizdr | oh i was looking at this: https://github.com/ddellacosta/appengine-magic |
| 00:48 | ddellacosta | quizdr: ah, I probably forked it to give it a shot at some point. This is the original: https://github.com/gcv/appengine-magic |
| 00:49 | ddellacosta | quizdr: it's rather out of date and crusty I think. There's not a ton of energy in the clojure community for using clojure w/app-engine, in my experience...I think there are too many qualifications. |
| 00:49 | ddellacosta | quizdr: that said, maybe worth giving it a shot yourself. |
| 00:49 | quizdr | right ok, i thought maybe you'd used it. i wish it was easier setting up and deploying clojure on various systems. |
| 00:50 | ddellacosta | quizdr: seriously, heroku is probably the easiest out there. The other workflow--which is more complicated--is using apache or nginx as a proxy to a java app, or just setting up java/jetty as a service itself (what I do on my own blog). |
| 00:51 | ddellacosta | quizdr: Those are the most common ones that I know of for Clojure web apps. |
| 00:51 | quizdr | i wish i could figure out Linode but I just don't have the background or patience |
| 00:52 | ddellacosta | quizdr: are you familiar with common sysadmin task on linux? I think there are some recipes out there for getting ubuntu + java as upstart service going pretty easily. Granted, never going to be as easy as heroku, but that's what you pay for... |
| 00:52 | quizdr | no i'm not much of a sys admin at all |
| 00:53 | ddellacosta | quizdr: well, it's one way to learn. ;-) |
| 00:53 | quizdr | your money goes so much further with Linode than with Heroku and sites like 4clojure, refheap, etc I think are all on a single Linode account, so it clearly works well, but you make up in time what you gain with money when you do it yourself |
| 00:54 | ddellacosta | quizdr: but in all honesty, I would say stick with heroku if you don't want to think about the setup. It really is brilliantly simple for that stuff. |
| 00:54 | ddellacosta | quizdr: yeah, exactly--it's totally a money/time equation. |
| 00:54 | ddellacosta | quizdr: I wanted to know how to set it up, and I have some basic sysadmin experience, so it wasn't too bad for me to get it going (on rackspace in my case). But it still took me a good chunk of time, all things considered. |
| 00:55 | quizdr | which of your libraries were you discussing before? |
| 00:55 | ddellacosta | quizdr: oh, that was friend-oauth2, tutysara is using it and has been finding some issues that we're trying to nail |
| 00:55 | quizdr | you are in tokyo is that right? |
| 00:56 | ddellacosta | quizdr: yep. |
| 00:57 | quizdr | that would explain why you're always in here at this time of day! |
| 00:57 | ddellacosta | a haha, yeah--same as Singapore, huh? |
| 00:57 | quizdr | i've been meeting to hop over tokyo one of these days, i hear great things about it |
| 00:58 | ddellacosta | quizdr: nice having more folks in Asia on here. :-) |
| 00:58 | quizdr | i agree |
| 00:58 | ddellacosta | quizdr: yeah, come on by. I love Japan, but I'm biasd. |
| 00:58 | ddellacosta | *biased |
| 00:59 | quizdr | man, i discovered the japanese ramen only after coming to singapore. a lot of japanese franchises are here. i'm in love with that stuff. |
| 00:59 | ddellacosta | quizdr: oh yeah, I don't think I went to any last time I was there, not that I miss it being here, but I wanted to check it out. The Singaporeans are serious about food, and so are Japanese, so it's no surprise there is synergy there. |
| 01:00 | ddellacosta | quizdr: my personal favorite is tsukemen, especially tonkotsu |
| 01:00 | quizdr | there was a recent Forbes article ( I think) about the 10 best food cities in the world. Singapore came in at #1 and Tokyo #3. I was surprised Bangkok was not on the list as that is a big favorite of mine. |
| 01:00 | quizdr | there are several varieties of tonkotsu here, in fact i had some last night! |
| 01:03 | ddellacosta | quizdr: nice...love the tonkotsu. :-) |
| 01:04 | ddellacosta | quizdr: for my part I miss eating chicken rice and nasi lemak and real Indian food...and everything else you can get in Singapore, that just scratches the surface. *sigh* |
| 01:05 | quizdr | yeah i couldn't live without indian food |
| 01:05 | quizdr | in fact i chose to live in the Little India part of town |
| 01:15 | n0n0 | hey |
| 01:15 | n0n0 | what is a close match to ipython for clojure? |
| 01:27 | tpope | ambrosebs: didn't even know you were a vim user |
| 01:28 | ambrosebs | tpope: :) |
| 01:28 | xuser | tpope: you never gave emacs + evil a try? |
| 01:29 | tpope | get out your jump to conclusions mat, xuser is ready to play! |
| 01:30 | tpope | yeah I've played with it. there's still a huge emacs learning curve to get over |
| 01:30 | ambrosebs | tpope: I can actually work sanely now on Typed CLJS. Type checker in CLJ, checking CLJS code. |
| 01:30 | ambrosebs | tpope: loving it. |
| 01:30 | tpope | that's awesome |
| 01:33 | ambrosebs | is there some way to combine :require and :require-macros now in CLJS? |
| 01:33 | ambrosebs | been a few months since I looked. |
| 01:35 | safety | ambrosebs: hi |
| 01:35 | ambrosebs | safety: hello |
| 01:35 | safety | i'm a perth developer, didn't know you were based here |
| 01:36 | safety | is there much clojure going on at uwa? |
| 01:36 | ambrosebs | safety: oh cool! Never met anyone using clojure in WA. |
| 01:37 | safety | haha me either. but i'm very much a noob, poking at the edges. |
| 01:37 | safety | what are you studying at uwa? i graduated from there about 10 yrs ago. |
| 01:38 | ambrosebs | safety: I've graduated with Bach CS honours |
| 01:38 | safety | ah ok, i see your dissertation on indiegogo |
| 01:39 | xuser | tpope: was curious, I know your vimmer by heart ;) |
| 01:39 | xuser | s/your/you'r/ |
| 01:41 | dsrx | ambrosebs: you can do something like (:require [foo.bar :as bar :include-macros true]) |
| 01:44 | ambrosebs | dsrx: I remember something like that. wouldnt' include-macros be a map though? |
| 01:44 | ambrosebs | or a vector |
| 01:45 | ambrosebs | this seemed to work: (:require [cljs.core.typed :refer-macros [ann check-ns]]) |
| 01:45 | alandipert | ambrosebs: https://github.com/clojure/clojurescript/commit/de6ee41b3b0e26020e01b409f97e513bce87456d |
| 01:45 | ambrosebs | cool! |
| 01:46 | ambrosebs | alandipert: do I need :include-macros as well? |
| 01:47 | alandipert | ambrosebs: i don't think so |
| 01:47 | ambrosebs | alandipert: ah got it. thanks :) |
| 01:49 | quizdr | ,(split-with fn? '(#() 4 5 6) |
| 01:49 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 01:49 | quizdr | (split-with fn? '(#() 4 5 6)) |
| 01:49 | quizdr | ,(split-with fn? '(#() 4 5 6)) |
| 01:49 | clojurebot | [() ((fn* [] ()) 4 5 6)] |
| 01:49 | quizdr | shouldn't the first split include the function? |
| 01:51 | ambrosebs | ,(doc split-with) |
| 01:51 | clojurebot | "([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]" |
| 01:51 | ambrosebs | ,(fn> '#()) |
| 01:51 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: fn> in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 01:51 | ambrosebs | ,(fn? '#()) |
| 01:51 | clojurebot | false |
| 01:52 | quizdr | ah ,should have used a vector not a list |
| 01:53 | quizdr | (inc ambrosebs) |
| 01:53 | lazybot | ⇒ 3 |
| 01:58 | arrdem | (inc ambrosebs) ;; this man does not belong in the low karma club |
| 01:58 | lazybot | ⇒ 4 |
| 02:00 | quizdr | (inc arrdem) |
| 02:00 | lazybot | ⇒ 16 |
| 02:00 | quizdr | i agree, and neither do you :) |
| 02:00 | quizdr | (if 16 is considered "low") |
| 02:02 | arrdem | quizdr: heh thanks... one of the metrics which I want to display and do a writeup on is community "value" vs. irc karma score. for the most part it's a pretty good indicator but iff you are IRC active. there are some pretty serious outliers. |
| 02:17 | dsrx | i can think of one very serious outlier =) |
| 02:18 | TEttinger | $karma TEttinger |
| 02:18 | lazybot | TEttinger has karma 13. |
| 02:18 | TEttinger | how's that get there??? |
| 02:18 | lazybot | TEttinger: How could that be wrong? |
| 02:18 | dsrx | $karma rhickey |
| 02:18 | lazybot | rhickey has karma 2. |
| 02:18 | TEttinger | haha what how! |
| 02:18 | dsrx | $karma lazybot |
| 02:18 | lazybot | lazybot has karma 19. |
| 02:19 | dsrx | $karma clojurebot |
| 02:19 | lazybot | clojurebot has karma 32. |
| 02:19 | TEttinger | heh |
| 02:21 | stirfoo | is there a standard way to initialize a defrecord from a map? |
| 02:23 | stirfoo | I did something like (def make-foo ([m] (apply make-foo (map #(% m) [:x :y :z]))) ([x y z] (Foo. x y z))) |
| 02:25 | stirfoo | defn, not def |
| 02:27 | dsrx | ,(defrecord Foo) |
| 02:27 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/defrecord> |
| 02:27 | dsrx | ,(defrecord Foo [x y z]) |
| 02:27 | clojurebot | sandbox.Foo |
| 02:27 | dsrx | ,(map->Foo {:x 1, :y 2, :z 3}) |
| 02:27 | clojurebot | #sandbox.Foo{:x 1, :y 2, :z 3} |
| 02:27 | dsrx | stirfoo: ^ |
| 02:27 | logic_prog_ | why does >! on a closed channel succeed? |
| 02:27 | stirfoo | ah, thanks dsrx |
| 02:28 | sm0ke | $karma sm0ke |
| 02:28 | lazybot | sm0ke has karma 0. |
| 02:28 | sm0ke | heh i guess i cannot increment for myself |
| 02:28 | sm0ke | (inc sm0ke) |
| 02:28 | lazybot | You can't adjust your own karma. |
| 02:28 | logic_prog_ | (inc logic_prog) |
| 02:28 | lazybot | ⇒ 3 |
| 02:28 | logic_prog | yay |
| 02:29 | logic_prog_ | but anyway, why does >! on a closed channel succeed? |
| 02:29 | sm0ke | (dec logic_prog) |
| 02:29 | lazybot | ⇒ 2 |
| 02:29 | sm0ke | oh nice |
| 02:29 | logic_prog_ | (inc sm0ke) |
| 02:29 | lazybot | ⇒ 1 |
| 02:29 | sm0ke | (* 100 logic_prog) |
| 02:29 | dsrx | stirfoo: np |
| 02:31 | juxovec | I cannot truncate data in MySQL database. I use (exec-raw "SET FOREIGN_KEY_CHECKS=0") and then (exec-raw "truncate users") and it fails and complains about constrains. Korma||JDBC call each query in separate connection or what can be the problem? |
| 02:32 | logic_prog_ | why why why does >! on a closed channel not throw some type of error? |
| 02:34 | ered | logic_prog_: on that note do you know any way to tell if a channel is closed |
| 02:34 | ered | ? |
| 02:35 | logic_prog_ | yes |
| 02:35 | logic_prog_ | @(.-closed chan) |
| 02:35 | ered | ah, thanks |
| 02:35 | logic_prog_ | but there can be a race condition if I check then do a >! |
| 02:35 | ered | i want to do closed then a <! |
| 02:36 | ered | (so check if it's closed, if it's not then take from it) |
| 02:36 | ered | will that cause a race condition? |
| 02:36 | logic_prog_ | yeah |
| 02:36 | ered | oh |
| 02:36 | logic_prog_ | any time you do (test) /// shit can happen (action) |
| 02:36 | logic_prog_ | then, /// shit can happen <-- ths can cause a race condition |
| 02:36 | ered | i'm okay with it doing a little extra work |
| 02:37 | ered | just that when it's closed at some point it will terminate before clearing out the channel |
| 02:37 | logic_prog_ | well |
| 02:37 | logic_prog_ | the problem is I need to make sure the work is done |
| 02:37 | ered | ah |
| 02:37 | logic_prog_ | so if it's pushed to a closed channel, it vanishes |
| 02:37 | logic_prog_ | and I think the work is done, but hte work is not done |
| 02:37 | ered | in my case when any of them has done the work once it's fine |
| 02:38 | logic_prog_ | who cares about your case? I want my case to work! :-) |
| 02:38 | logic_prog_ | ered: how do you ensure that _someone_ has done the work? |
| 02:39 | logic_prog_ | ered: i.e. if you're pushing to a channel that may be closed, how do you ensure that some worker reaceives the message? |
| 02:39 | ered | because when someone has done the work, it closes the source channel |
| 02:39 | dsrx | logic_prog_: make another channel in the other direction? |
| 02:46 | juxovec | it was connection pooling, I put all things to (transaction ) and it was okay |
| 03:30 | quizdr | on this line of code, the map that begins with ":pre" is that a meta data declaration? what would be the purpose? (defn schedule-pattern [curr-t pat-dur sound pattern] {:pre [(sequential? pattern)]} (let...) |
| 03:31 | fredyr | isn't that a pre-condition validator? |
| 03:31 | quizdr | i don't know, what's that? |
| 03:31 | fredyr | http://clojure.org/special_forms#toc10 |
| 03:31 | clojurebot | I don't understand. |
| 03:32 | quizdr | it's okay clojurebot, i don't either |
| 03:33 | sm0ke | any cascalog user still awake? |
| 03:33 | fredyr | ,(defn constrained-sqr [x] {:pre [(pos? x)] :post [(> % 16), (< % 225)]} (* x x)) |
| 03:33 | clojurebot | #'sandbox/constrained-sqr |
| 03:33 | fredyr | ,(constrained-sqr -1) |
| 03:33 | clojurebot | #<AssertionError java.lang.AssertionError: Assert failed: (pos? x)> |
| 03:33 | quizdr | ah ok fredyr i get it |
| 03:33 | fredyr | :) |
| 03:34 | quizdr | (inc fredyr) |
| 03:34 | lazybot | ⇒ 1 |
| 03:34 | fredyr | wee |
| 03:34 | quizdr | 1?! what the? that's a TRAVESTY ! |
| 03:34 | fredyr | lol |
| 03:34 | fredyr | first time |
| 03:34 | TEttinger | (inc fredyr) |
| 03:34 | lazybot | ⇒ 2 |
| 03:34 | fredyr | :D |
| 04:14 | fredyr | should've stayed at one |
| 04:14 | fredyr | killed the entire channel |
| 04:16 | TEttinger | ha |
| 04:49 | ddellacosta | whoops, I'm mixing my P.O.V. |
| 04:49 | fredyr | :) |
| 04:49 | ddellacosta | :-D |
| 04:56 | tim_ | Hi, do many clojure devs use gradle instead of lein? |
| 04:57 | TEttinger | tim_, all I can say is I use lein, but I know that clojars only fairly recently started supporting gradle |
| 04:59 | tim_ | Thanks. |
| 05:04 | clgv | tim_: for "many" I'd say no. maybe "few" ;) |
| 05:05 | tim_ | I'm just starting out with clojure, with a good java background. In general should i shy away from using existing well founded and understood libraries in favour of clojure specific ones? For example hiccup/enlive instead of freemarker/velocity. |
| 05:19 | fredyr | most definitely to get into the clojure way of doing things at least |
| 05:20 | fredyr | and for that example i would say its a good idea to use the clojure versions |
| 05:20 | tim_ | ok, thanks. |
| 05:21 | tim_ | Do you find yourself using much java in your own clojure projects? |
| 05:22 | fredyr | in general i would say that the interop is very good, so you usually don't need to wrap alot of the java projects |
| 05:23 | fredyr | i've been doing mostly clojurescript lately, so im not the right person to ask |
| 05:23 | fredyr | but previously i've used apache camel for example directly from clojure |
| 05:24 | tim_ | Cheers. |
| 05:28 | ddellacosta | tim_: 100% echo what fredyr is saying. The thing about using Java in Clojure is that, while it's not that painful, comparatively speaking, it is not idiomatic--you'll get a lot more mileage out of trying to do things "the Clojure way" as much as possible. |
| 05:28 | ddellacosta | tim_: that said, having the Java interop is incredibly useful in many situations, and if you absolutely need to use a specific java lib, it's great to be able to fall back on. |
| 05:30 | tim_ | Thanks for the advice. |
| 05:31 | clgv | tim_: for learning clojure you should do the learning exercise in pure clojure. for real ("money making") tasks you should not be afraid to use a good java library for more advanced tasks. Clojure's java interop is pretty good. sometimes it is worth to write a more idiomatic clojure wrapper for the java lib. |
| 05:31 | AeroNotix | There's tonnes of stuff that just isn't implemented in a nice way in Clojure (yet), but yet there's tonnes of Java code you can use. |
| 05:31 | AeroNotix | I generally write it first directly using the Java interop and then write a lil' wrapper to make it nicer. |
| 05:32 | AeroNotix | like, ctors take maps/kwargs and either call the ctor or use (doto) forms |
| 05:32 | AeroNotix | or w/e |
| 05:32 | clgv | AeroNotix: well the wrapper should add additional advantages otherwise it is a waste of time ;) |
| 05:33 | AeroNotix | clgv: sure, default args for a start |
| 06:03 | AeroNotix | anyone doing anything with paypal in clojure? |
| 06:03 | AeroNotix | (and authorize.net for that matter) |
| 06:03 | AeroNotix | my latest project is using both for work, I'm hoping to open source my auth.net bindings |
| 06:04 | hiteki | hi |
| 06:05 | fredyr | hiteki: hello there |
| 06:06 | hiteki | fredyr: :) |
| 06:12 | rurumate | Is there a way to do something like maven's <resource><filtering>true</></>, using a map of replacements in, say, etc/conf.clj, on a per-profile basis, with lein? |
| 06:17 | rurumate | in etc/conf.clj you would have something like {:db-conn "${db.conn}"} and $db.conn would be replaced at uberjar time by "mysql://dev.db" when "with-profile dev" is set, and by "mysql://prod.db" when "with-prodile prod" is set |
| 06:17 | clgv | rurumate: you'll probably have more success with describing what that maven config does. there is also #leiningen which would increase the success probability even further ;) |
| 06:18 | rurumate | clgv: thanks, I hope my second comment makes it clear? |
| 06:18 | clgv | rurumate: I know that there was at least one release plugin which had to increment the version number in the project.clj |
| 06:19 | rurumate | or maybe there is some trick with macros to achieve the same thing? |
| 06:20 | rurumate | clgv: I don't want to change things in project.clj itself, rather do some replacements somewhere below etc/ |
| 06:21 | rurumate | it's a common thing to do, right? |
| 06:21 | clgv | rurumate: I thought that if there was a way to do what you want, that plugin might use it - but seems as if it just treats the project.clj as string |
| 06:22 | clgv | rurumate: you could search the plugin list whether there is anything for you. otherwise you'll have to write your own plugin to do that |
| 06:28 | ivo163 | server irc.azzurra.org |
| 06:37 | sm0ke | (inc tpope) |
| 06:37 | lazybot | ⇒ 2 |
| 06:37 | sm0ke | (inc tpope) |
| 06:37 | lazybot | ⇒ 3 |
| 06:37 | sm0ke | (inc tpope) |
| 06:37 | lazybot | ⇒ 4 |
| 06:37 | sm0ke | heh i just feel grateful |
| 06:38 | quizdr | sweet sm0ke |
| 06:38 | sm0ke | yea man |
| 06:38 | quizdr | (inc sm0ke) |
| 06:38 | lazybot | ⇒ 2 |
| 06:38 | sm0ke | you should try fireplace sometimes |
| 06:39 | sm0ke | (inc quizdr) |
| 06:39 | lazybot | ⇒ 2 |
| 06:39 | sm0ke | lol |
| 06:39 | quizdr | i like a good fireplace, but i suspect I'm thinking of something different |
| 06:39 | fredyr | vim fireplace? |
| 06:39 | sm0ke | obviously not a vimmer quizdr |
| 06:39 | quizdr | i'm not a vimmer, no. |
| 06:39 | quizdr | emacs here. |
| 06:39 | sm0ke | ok |
| 06:40 | oskarkv | obviously you're not a golfer |
| 06:40 | sm0ke | vim golfer |
| 06:40 | quizdr | ha ha, i can't even lift a bowling ball oskarkv |
| 06:40 | oskarkv | :) |
| 06:40 | sm0ke | wtf does emacs stand for anyways? |
| 06:40 | oskarkv | editor macros |
| 06:40 | oskarkv | i think |
| 06:40 | sm0ke | lawl |
| 06:41 | quizdr | someone asked that in the emacs channel and there were a ton of answers |
| 06:41 | quizdr | just yesterday or maybe earlier today, can't remember |
| 06:41 | quizdr | i use vi for quick one-off edits here and there, though I have started forcing myself to use emacs for those also. |
| 06:43 | fredyr | evil mode ftw |
| 06:44 | sm0ke | i hear this evil mode a lot |
| 06:44 | sm0ke | i think its kind of uncool |
| 06:44 | sm0ke | either use vim or emacs |
| 06:44 | fredyr | lol |
| 06:44 | fredyr | great argument |
| 06:44 | fredyr | :D |
| 06:45 | sm0ke | i am serious |
| 06:45 | fredyr | im not getting into that :) |
| 06:45 | fredyr | anyways lunch time |
| 06:45 | sm0ke | yea map, just jump boats |
| 06:45 | sm0ke | man* |
| 06:46 | sm0ke | fredyr: have a good one |
| 06:46 | fredyr | ty |
| 06:46 | sm0ke | hmm i feel hungry now |
| 06:46 | sm0ke | there was this bullshit all over hn about soylent |
| 06:46 | sm0ke | what happened did someone die? |
| 06:46 | sm0ke | lol |
| 06:47 | quizdr | what is evil mode?? |
| 06:47 | lazybot | quizdr: Uh, no. Why would you even ask? |
| 06:48 | quizdr | yikez lazybot! |
| 06:48 | sm0ke | emacs + vi |
| 06:48 | sm0ke | it should be called vimacs instead |
| 06:49 | locks | my emacs complained the other day |
| 06:49 | locks | "don't use the arrows!!" |
| 06:49 | alew | Hey man, vim and emacs learning curves too steep? try vim + emacs at the same time! |
| 06:50 | scape | lol |
| 06:50 | hyPiRion | locks: Psh, no need for arrows: https://github.com/hyPiRion/emacs.d/blob/master/hypirion/hypirion-defuns.el#L7-L10 |
| 06:51 | locks | lol xD |
| 06:51 | sm0ke | pot |
| 06:52 | alew | hyPiRion: I was just about to go do something similar, except maybe add a save all files and quit function remapping |
| 06:54 | sm0ke | i think clojure should have a patch to detect the ide user is using |
| 06:54 | sm0ke | and refuse to run on emacs OR vim |
| 06:54 | alew | or maybe when you use the arrow keys, emacs sends a tweet out exclaiming your embarassing moment |
| 06:55 | sm0ke | if *jure is banned so should be emacs |
| 06:55 | sm0ke | or vim |
| 06:55 | sm0ke | which one should be left to the commiter |
| 06:56 | sm0ke | it enforces a simplicity in terms of dev environment |
| 06:56 | sm0ke | everyone would work on one, and it would be awesome, full of features |
| 06:58 | algernon | sm0ke: you just described emacs. |
| 06:59 | sm0ke | yea emacs it is |
| 07:00 | AeroNotix | I use the arrow keys, don't tell me how to be productive. |
| 07:01 | sm0ke | AeroNotix: use vim |
| 07:02 | sm0ke | One weird trick to make your dev experience 10X better --> read below |
| 07:02 | sm0ke | VIM |
| 07:02 | AeroNotix | sm0ke: Are you a time traveller? |
| 07:03 | sm0ke | AeroNotix: i can be |
| 07:03 | AeroNotix | sm0ke: because you seem to have an ancient internet argument in your hands there |
| 07:03 | AeroNotix | No-one cares, it's not funny. Stahp. |
| 07:05 | sm0ke | AeroNotix: haha you seem to care |
| 07:05 | sm0ke | i am just killing time |
| 07:06 | sm0ke | and what was that _ancient_ argument anyways? |
| 07:06 | AeroNotix | sm0ke: emacs vs vim |
| 07:06 | sm0ke | haha never gets old |
| 07:07 | AeroNotix | no, no, i assure you it does |
| 07:09 | sm0ke | well if you say so |
| 07:09 | sm0ke | but somehow when i am talking about vim, some emacs user pops up with evil mode suggestion |
| 07:10 | sm0ke | so i think the problem lies with the emacs users |
| 07:10 | sm0ke | which leads me to the conclusion that |
| 07:11 | sm0ke | emacs user is like a confused teenager |
| 07:11 | sm0ke | OR confused teenagers ARE emacs users |
| 07:13 | fredyr | wow, such editor very hostility |
| 07:14 | quizdr | vim is actually pretty decent, but emacs is an entire operating system in itself, runs extrenal applications within it, does like everything in the universe, you understand what i'm saying? |
| 07:14 | sm0ke | did it sound hostile? |
| 07:14 | sm0ke | i didnt intend to be, sorry |
| 07:14 | fredyr | was more a reference of the editor wars in general |
| 07:16 | fredyr | *reference to, even |
| 07:16 | locks | everything is shit anyway |
| 07:16 | locks | in Haskell you make your own text edit… |
| 07:16 | sm0ke | well for clojure people emacs makes perfect sense, you write lisp with an editor that is configurable using lisp ( other) |
| 07:17 | fredyr | lol was gonna say you forgot `switch to haskell` |
| 07:17 | sm0ke | but really, it is no good unless emacs is written itself in clojure |
| 07:17 | locks | I use Light Table |
| 07:17 | locks | which is written in clojure |
| 07:17 | sm0ke | locks: makes sense |
| 07:18 | RickInAtlanta | does Light Table have paredit? |
| 07:18 | locks | and moves easier to get started with |
| 07:18 | locks | RickInAtlanta: partially |
| 07:18 | sm0ke | Light Table in fact in coming year could be the new emacs |
| 07:18 | locks | but it doesn't come with preset bindings, I don't think |
| 07:18 | locks | which was confusing me |
| 07:19 | locks | RickInAtlanta: https://cloudup.com/cPjLzynZdsB |
| 07:19 | RickInAtlanta | we are going to do some coding sessions in the Atlanta meetup, and I am going to recommend that we use light table as the editor, hoping to avoid contention |
| 07:20 | locks | I found it very easy to get started with |
| 07:20 | daGrevis | I give +1 to Light Table |
| 07:20 | locks | I basically open a file > make current editor an instarepl |
| 07:20 | RickInAtlanta | thx for the link. you can map bidnings to command? |
| 07:20 | locks | RickInAtlanta: yes, it's quite easy |
| 07:21 | locks | https://cloudup.com/cMjUPqZ07q1 |
| 07:21 | locks | the panel to the right is the command panel |
| 07:21 | RickInAtlanta | I was using it the other day, going through the cljs tutorial. I hit ctrl-f to find somehting, and then couldn't figure out how to find next or close the find window |
| 07:21 | locks | search for remap, pop it open, add the bindings to the left |
| 07:21 | RickInAtlanta | probably ctrl-space would have gotten me there |
| 07:21 | locks | oops, I actually meant to search for keymap |
| 07:22 | locks | I feel like the paredit plugin should come with default keybindings |
| 07:24 | RickInAtlanta | what little I have used LT for, I like it. I just need to spend a little bit of time getting familiar with it. |
| 07:25 | RickInAtlanta | Oh, one thing I did notice... it seems like results of instarepl are just what can fit on the remainder of the line... is there a way to see more results? |
| 07:25 | locks | click on the popup |
| 07:25 | RickInAtlanta | ah, I didn't know there was a popup |
| 07:26 | locks | by popup I mean the result overlay thingie |
| 07:27 | RickInAtlanta | sweet, thanks! |
| 07:28 | RickInAtlanta | (inc locks) |
| 07:28 | lazybot | ⇒ 1 |
| 07:28 | locks | :} |
| 07:29 | AeroNotix | with uberjar am I supposed to be able to drag and drop the jar onto another machine and it Just Work? |
| 07:31 | ucb | AeroNotix: allegedly yes |
| 07:31 | AeroNotix | hmm, ok |
| 07:45 | daGrevis | this is how my LightTable looks, locks http://i.imgur.com/WQlleDq.jpg |
| 07:47 | locks | daGrevis: my train is too hired to red = bad |
| 07:48 | daGrevis | locks, you're talking about def's? |
| 07:48 | locks | yeah |
| 07:48 | daGrevis | well, that's just base16 colors |
| 07:48 | locks | ah |
| 07:49 | locks | I wonder what distro you're using ;P |
| 07:49 | daGrevis | https://github.com/chriskempson/base16 |
| 07:49 | daGrevis | locks, can't tell :D |
| 08:07 | ior3k | daGrevis: is that xmobar? |
| 08:10 | daGrevis | ior3k, y |
| 08:11 | ior3k | daGrevis: sorry about insisting, are you using trayer as well, or does xmobar come with a notification area? |
| 08:11 | daGrevis | ior3k, i'm also using trayer. i have no problems with answering :P https://github.com/daGrevis/Dotfiles |
| 08:14 | ior3k | daGrevis: nice, thanks... it seems you're not running gnome, is that right? |
| 08:22 | Morgawr | mmm |
| 08:22 | Morgawr | I'm trying to use https://github.com/clojure/tools.cli/ this to parse some command line args |
| 08:22 | Morgawr | what I want to parse is --in-port <number> |
| 08:23 | Morgawr | I tried to change the "-p" "--port PORT" strings to "--in-port" "--in-port PORT" but it doesn't seem to be working |
| 08:23 | Morgawr | does anybody know how I should do it? |
| 08:24 | daGrevis | ior3k, nop, i'm running xmonad |
| 08:25 | ior3k | daGrevis: ok, thanks, I'm running xmonad as well, but inside gnome (flashback). Wondering if I should just ditch gnome. |
| 08:27 | Morgawr | welp nevermind, I'm a retard.. I was calling a bash script as a wrapper to my .jar file and I forgot to pass the actual arguments to the .jar file itself |
| 08:27 | Morgawr | no wonder the command line parsing library was reporting no args |
| 08:27 | RickInAtlanta | :) |
| 08:29 | daGrevis | Morgawr, it's fine, we all have done it |
| 08:29 | Morgawr | I do it way too often haha |
| 08:30 | daGrevis | “Grab your best pair of parentheses: you're about to embark on the journey of a lifetime!“ |
| 08:30 | RickInAtlanta | woot, what is that from? |
| 08:30 | daGrevis | http://www.braveclojure.com/ |
| 08:31 | RickInAtlanta | nice |
| 08:37 | atomphil | afternoon all, I'm porting a simple search library to clojure as a learning project and I've run into some conceptual difficulty over atoms, was wondering whether I could have some help |
| 08:38 | atomphil | in the original (javascript) library the search text is processed and then stored in an object which is referenced as it's needed |
| 08:39 | atomphil | should I be doing the same thing in clojure using an atom to store it, or should I always call the chain of processing functions with the original data? |
| 08:41 | daGrevis | “then we call that sequence a "seq" because it's shorter and hipper“ |
| 08:41 | daGrevis | lol |
| 08:47 | fredyr | atomphil: you should use atoms for storing application state |
| 08:48 | fredyr | atomphil: if you have processing steps, you want to just chain them together and not store any intermediate steps, unless you have to |
| 08:49 | fredyr | atomphil: unlike javascript, where you usually pass around a mutable object to processing functions, and mutate them in place |
| 08:52 | atomphil | fredyr: OK, that makes a lot of sense, thanks. Should I not be concerned that the search text will be processed during each search when it only needs to happen once? |
| 08:55 | fredyr | atomphil: not exactly sure how you mean |
| 08:56 | fredyr | atomphil: but if it makes sense to store the processed result for re-use you should do it |
| 08:57 | atomphil | fredyr: yes, that's exactly what I mean, sorry I wasn't clear. What would be the idiomatic way of storing the processed result if not in an atom? |
| 08:57 | fredyr | atomphil: atom's great for that |
| 08:57 | fredyr | atomphil: i thought you were talking about storing intermediate steps in a chain of processing steps in an atom first |
| 08:59 | fredyr | *intermediate results |
| 08:59 | atomphil | fredyr: ah, I see. No, this is just the pre-processed text which would be re-used, so I guess atoms it is. Thanks very much for your help! |
| 08:59 | fredyr | atomphil: sure |
| 09:32 | daGrevis | hwo can I add elem to the end of the list? conj and cons adds only to the beginning :( |
| 09:33 | oskarkv | there is no efficient way to do it |
| 09:33 | oskarkv | maybe you can use vectors instead? |
| 09:35 | fredyr | ,(conj [1 2 3] 42) |
| 09:36 | clojurebot | [1 2 3 42] |
| 09:36 | dnolen | daGrevis: lists are not as common in Clojure, many cases are better served by vectors |
| 09:36 | dnolen | daGrevis: still you can do this with concat |
| 09:36 | dnolen | ,(concat '(1 2 3) '(4)) |
| 09:36 | clojurebot | (1 2 3 4) |
| 09:39 | jonathanj | the MEAP v09 of JoC has stuff like "XREF ch04" scattered around it, i'm assuming those are supposed to be links or text or something other than cryptic letters? |
| 09:40 | jonathanj | oh, this is the ePub document |
| 09:43 | CookedGryphon | Does anybody have any hints on how I'd go about debugging the following core.async error? https://www.refheap.com/26763 |
| 09:43 | CookedGryphon | no implementation of method :emit-instruction |
| 09:44 | CookedGryphon | the change to cause it seems really rather innocuous |
| 09:47 | fredyr | CookedGryphon: nice error :) |
| 09:47 | fredyr | CookedGryphon: perhaps a refheap on the go-block causing it? |
| 09:47 | emlyn | CookedGryphon: related? https://groups.google.com/forum/#!msg/clojure/JHCtPfn_zlc/ivkEaisZXYwJ |
| 09:49 | fredyr | emlyn: nice find |
| 09:51 | CookedGryphon | fredyr: https://www.refheap.com/410b67708ec91c52d7c2c9c04 |
| 09:51 | daGrevis | dnolen, thanks! sorry for delayed response |
| 09:51 | daGrevis | oskarkv, i would use vectors, but it's for educational purposes |
| 09:52 | CookedGryphon | emlyn: not sure how that would apply to my code... |
| 09:52 | devn | hahaha oh my god @ google adwords |
| 09:52 | devn | https://twitter.com/ztellman/status/426165699384311808 |
| 09:53 | devn | clojure adwords for google |
| 09:53 | devn | "Clojure too Slow? One weird library that Rich Hickey doesn't want you to know about." |
| 09:53 | Wild_Cat` | "Enlarge your parentheses NOW!" |
| 09:55 | Wild_Cat` | seriously though, these are hilarious. |
| 09:55 | llasram | Did he really buy the ads, or just mock them up? |
| 09:55 | llasram | If the former, I'd really like to see them in the wild :-) |
| 09:55 | arcatan | if you google "clojure slow"... |
| 09:56 | Wild_Cat` | I can't wait for the Clojure Buzzfeed articles, too: "This guy adds core.async to his Leiningen dependencies... You'll never believe what happens next!" |
| 09:56 | llasram | Niiiiice |
| 09:56 | llasram | That's amazing |
| 10:06 | Wild_Cat` | (and of course there'd be the Haskell verion: "5 arrow transformer transformer combinators that will blow your mind!") |
| 10:09 | fredyr | CookedGryphon: when do you get the error? |
| 10:09 | fredyr | CookedGryphon: at macroexpansion |
| 10:09 | fredyr | ? |
| 10:10 | CookedGryphon | don't think so... one second |
| 10:12 | CookedGryphon | yeah, yeh it is |
| 10:12 | fredyr | which version of core.async are you running |
| 10:12 | fredyr | CookedGryphon: it expanded fine for me w/ the latest core.async |
| 10:13 | CookedGryphon | 0.1.267.0-0d7780-alpha |
| 10:13 | CookedGryphon | okay, i'll grab the newest one and see what happens |
| 10:13 | CookedGryphon | oh, that's the one that's in the readme |
| 10:13 | fredyr | CookedGryphon: hmm that's the same version as you wrote |
| 10:14 | CookedGryphon | I wonder... I might try it on a vanilla jvm |
| 10:14 | fredyr | CookedGryphon: have you tried a manual macroexpand? |
| 10:14 | CookedGryphon | I'm doing this on androyd |
| 10:14 | CookedGryphon | android* |
| 10:14 | fredyr | CookedGryphon: oh |
| 10:14 | CookedGryphon | yeah |
| 10:14 | fredyr | and that one also fails? |
| 10:14 | CookedGryphon | that explodes half way through |
| 10:14 | fredyr | right, it worked for me to macroexpand |
| 10:14 | fredyr | wasn't a pretty sight to look at though :) |
| 10:15 | fredyr | holy statemachine, batman |
| 10:15 | fredyr | CookedGryphon: clojure 1.5.1 btw |
| 10:16 | CookedGryphon | yup |
| 10:25 | CookedGryphon | fredyr: okay, I've narrowed it down some more to a single change between works and explodes |
| 10:25 | CookedGryphon | https://www.refheap.com/c4ed35d77e7512dcbbbaa5ef4 |
| 10:26 | CookedGryphon | both actually work for my purposes, but I still don't see why I shouldn't be able to do the other |
| 10:26 | fredyr | no diff running on ordinary jvm? |
| 10:26 | CookedGryphon | haven't tried yet |
| 10:27 | fredyr | CookedGryphon: could def be the when binding |
| 10:27 | fredyr | same as what emlyn linked to |
| 10:28 | fredyr | where the try catch was interleaved with the loop/recur pair |
| 10:29 | fredyr | CookedGryphon: i mean, it's easy to imagine a state machine transitioning to get confused in those cases |
| 10:29 | maku_ | Any LightTable users ever get a "java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest". Started happening when I updated my project.cljs to new versions of cljs, ring, compojure, etc. Currently on the latest stable version of each. |
| 10:29 | maku_ | To Clarify, this happens when I try to connect to a clojurescript project through the LightTable nrepl |
| 10:31 | CookedGryphon | fredyr: hmmm, the code really looks like it should work though... |
| 10:31 | `cbp | maku_: you might have more luck posting in the lighttable google group |
| 10:32 | maku_ | `cbp: thanks, will do! |
| 10:51 | hiteki | hi (again) |
| 10:51 | fredyr | hiteki: :) |
| 10:52 | `cbp | ~hi |
| 10:52 | clojurebot | excusez-moi |
| 10:52 | fredyr | ~clojurebot |
| 10:52 | clojurebot | clojurebot is broken |
| 10:52 | hiteki | wow! a french talking bot... |
| 10:52 | `cbp | he curses in irish though |
| 10:53 | hiteki | :) |
| 10:57 | tim_ | anyone able to get html file reloading working when using enlive and compojure? |
| 11:09 | clgv | ~swing |
| 11:09 | clojurebot | http://java.sun.com/docs/books/tutorial/uiswing/ |
| 11:14 | btcNeverSleeps | hey all... I've got a little question symbols (which implement IFn) |
| 11:14 | btcNeverSleeps | The doc says this: Symbols, just like Keywords, implement IFn for invoke() of one argument (a map) with an optional second argument (a default value). |
| 11:14 | btcNeverSleeps | found at: From: http://clojure.org/data_structures |
| 11:15 | btcNeverSleeps | so ,(:a {:a 1} 42) |
| 11:15 | btcNeverSleeps | ,(:a {:a 1} 42) |
| 11:15 | clojurebot | 1 |
| 11:15 | btcNeverSleeps | ,(:b {:a 1} 42) |
| 11:15 | clojurebot | 42 |
| 11:15 | btcNeverSleeps | which is fine |
| 11:15 | btcNeverSleeps | However... |
| 11:15 | btcNeverSleeps | ,('a 1) |
| 11:15 | clojurebot | nil |
| 11:16 | btcNeverSleeps | and I do *really* fail to understand how '1' is a map here (the doc says that the argument is a map) |
| 11:17 | arrdem | ,('shit-works {'shit-works 43} "oh noez") |
| 11:17 | clojurebot | 43 |
| 11:17 | btcNeverSleeps | arrdem: that is not my question at all |
| 11:17 | `cbp | btcNeverSleeps: welcome to dynamic typing |
| 11:17 | arrdem | (inc `cbp) |
| 11:17 | lazybot | ⇒ 3 |
| 11:17 | `cbp | (when (map? x) do-stuff) |
| 11:18 | btcNeverSleeps | `cbp: dynamic typing, ok... But if the argument is supposed to be a map, can't this be checked at runtime? Isn't it an obvious mistake to allow to *run* ('a 1) when '1' is supposed to be map? |
| 11:19 | arrdem | btcNeverSleeps: no it isn't because the compiler does no static typechecking. period. |
| 11:19 | btcNeverSleeps | arrdem: what does the compiler have to do with runtime execution? |
| 11:19 | arrdem | areyoukiddingme.jpg |
| 11:19 | btcNeverSleeps | arrdem: no I'm new to Clojure |
| 11:20 | arrdem | ,('a 1) |
| 11:20 | clojurebot | nil |
| 11:20 | btcNeverSleeps | I can write a Clojure function whose doc says: "argument 1 is a map" and which triggers an exception if the user tries to pass something which is not a map as the 1st argument... |
| 11:20 | arrdem | ,(:foo 1) |
| 11:20 | clojurebot | nil |
| 11:20 | arrdem | right. okay. |
| 11:20 | btcNeverSleeps | ,(:foo 1 42) ; gonna return 42 |
| 11:20 | clojurebot | 42 |
| 11:22 | arrdem | btcNeverSleeps: I see what you are saying, and yes it sorta kinda would make sense to complain about attempting to key index a non-map type, but silently working and yielding a nil value is a really kina annoying pattern in the Clojure core3. |
| 11:22 | btcNeverSleeps | for example: (peek (seq [1])) |
| 11:22 | btcNeverSleeps | ,(peek (seq [1])) ;; ain't gonna return 'nil' |
| 11:22 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to clojure.lang.IPersistentStack> |
| 11:24 | whilo | btcNeverSleeps: it will trigger an exception anyway. if you want runtime type checks you either have to use core.typed or do checks yourself. core.typed can do ducktyping-like key checks on your maps even, if i understand correctly |
| 11:24 | whilo | if you are worried about the type of your data, you might try prismatic's schematic, at least i think this is a fair compromise |
| 11:25 | xnil | is there a function exactly like `map` that returns nil? |
| 11:25 | arrdem | xnil: what would the point of such a function be? side effects? |
| 11:25 | xnil | yes |
| 11:25 | arrdem | xnil: you need doseq. map is lazy. |
| 11:26 | `cbp | or just dorun after a map |
| 11:26 | arrdem | `cbp: wai u do dis to me... |
| 11:26 | xnil | `cbp: is the effect equivalent? |
| 11:27 | AMrDan | Hi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ? |
| 11:27 | `cbp | xnil: dorun realizes the lazy seq, doesn´t retain the head and returns nil |
| 11:28 | gfredericks | I prefer doseq because it looks imperative and side-effecty |
| 11:28 | xnil | aha |
| 11:28 | gfredericks | also more features |
| 11:29 | sdegutis | I agree with gfredericks, doseq communicates "this does side-effects and don't refactor it thinking it's supposed to be functional" very clearly. |
| 11:29 | btcNeverSleeps | (doc get |
| 11:29 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 11:29 | btcNeverSleeps | erf, wrong Emacs buffer (and typo anyway) |
| 11:30 | gfredericks | clojurebot: (doc get is a type anyway |
| 11:30 | clojurebot | You don't have to tell me twice. |
| 11:30 | gfredericks | haha typo |
| 11:30 | gfredericks | a dvorak typo in particular |
| 11:32 | xnil | dvorak typos are the most prestigious typo |
| 11:32 | xnil | s |
| 11:33 | gfredericks | colemak is even snootier |
| 11:33 | btcNeverSleeps | oh it wasn't a typo: I just realized I'm so used to paredit matching the closing parenthesis but it's not active in my erc buffer(s) |
| 11:35 | AMrDan | Hi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ? |
| 11:36 | AMrDan | Hi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ? |
| 11:36 | `cbp | AMrDan: this is a clojure channel |
| 11:37 | AMrDan | `cbp, yes! I'm trying in clojure |
| 11:37 | rhg135 | Clj, SQL booth decorative |
| 11:38 | AMrDan | I'm trying to access my database and update the rows with clojure, but I can't |
| 11:39 | AMrDan | I have the connection, but cannot update, just insert and select |
| 11:40 | `cbp | AMrDan: are you using jdbc? |
| 11:40 | AMrDan | `cbp, Yes |
| 11:41 | `cbp | AMrDan: more specificity please. Code paste + error shown |
| 11:42 | AMrDan | This is the code i'm trying: (with-connection db |
| 11:42 | AMrDan | (with-query-results rs |
| 11:42 | AMrDan | [ |
| 11:42 | AMrDan | (str "update table set name = 'newName' where id = '%" param "%'" ) |
| 11:42 | AMrDan | ] |
| 11:42 | AMrDan | (doall rs) |
| 11:42 | AMrDan | ) |
| 11:42 | AMrDan | |
| 11:42 | arrdem | ~refheap |
| 11:42 | `cbp | by code paste i meant use gist or something similar |
| 11:43 | gfredericks | AMrDan: with-query-results is not for updating |
| 11:43 | AMrDan | gfredericks, i'm new to this. Can you help me please? |
| 11:44 | arrdem | AMrDan: he seems to be helping already... |
| 11:44 | AMrDan | 'CBP, sorry, i'm desperate! .. heheh |
| 11:45 | AMrDan | gfredericks, what do I use for updating and delete tags? |
| 11:45 | `cbp | AMrDan: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#UPDATE |
| 11:46 | AMrDan | `cbp, I tryed this one,... nothing |
| 11:46 | AMrDan | `cbp, it uses with-connection-db too |
| 11:48 | gfredericks | AMrDan: you might take a look at what other functions are in the clojure.java.jdbc namespace; might give you some good guesses |
| 11:48 | gfredericks | docstrings are helpful too |
| 11:49 | tim_ | is it possible to run a lein web app server and start a repl? i'm currently using 'lein ring server-headless', whats the best way fire up a repl to debug? |
| 11:50 | AMrDan | gfredericks, like this page: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/delete! ? |
| 11:50 | gfredericks | AMrDan: this also looks helpful: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html |
| 11:50 | gfredericks | AMrDan: yeah that page is good too |
| 11:51 | gfredericks | tim_: you could maybe add an :init handler in your project.clj to start the nrepl server |
| 11:52 | tim_ | ok, i'll give it a go. I did try the lein-ring plugin's nrepl option, but no luck. |
| 11:53 | gfredericks | I haven't even heard of that option |
| 11:54 | gfredericks | I don't normally use lein-ring though |
| 11:54 | gtrak | tim_: lein-ring takes a configuration option to that effect, I believe. |
| 11:55 | gtrak | really, it's quite simple to just not use lein-ring. |
| 11:56 | gtrak | luminus has a repl namespace that might be helpful to you: https://github.com/yogthos/luminus/blob/master/src/luminus/repl.clj |
| 11:56 | gtrak | and it also uses lein-ring |
| 11:56 | tim_ | I tried adding ' :nrepl {:start true :port 9000}' to my ring config, but nothing is printed and can't connect. |
| 11:57 | Anderkent | have you tried drawbridge? (I don't have full context here, only saw last message) |
| 11:57 | tim_ | not yet, although i've heard it mentioned. Currently using lien-ring plugin. |
| 11:58 | gtrak | I also don't like lein-ring's auto-reload namespaces feature. I'll re-eval my code as I damn well please. |
| 11:58 | Anderkent | i think it's :start-repl? and :repl-port not :start |
| 11:58 | Anderkent | based on https://github.com/weavejester/lein-ring/pull/72 |
| 11:58 | tim_ | if only it would work with enlive html templates! |
| 11:58 | Anderkent | oh nevermind that was changed I guess |
| 11:58 | Anderkent | it's :start? though according to the readme |
| 11:59 | Anderkent | not :start |
| 11:59 | `cbp | tim_: use selmer and turn cache off :-D |
| 11:59 | tim_ | selmer? not heard of that. |
| 11:59 | `cbp | tim_: https://github.com/yogthos/Selmer |
| 11:59 | gfredericks | did cider go back to naming its stuff nrepl-*? |
| 12:00 | tim_ | thanks anderkent, missed the ? dope! |
| 12:00 | justin_smith | what is the protocol that one must implement for get to work on your datatype? |
| 12:00 | `cbp | Iassociative? |
| 12:00 | gfredericks | ILookup I think |
| 12:00 | `cbp | im just guessing |
| 12:01 | gfredericks | ,(get (reify clojure.lang.ILookup (valAt [_ k] ["your key is" k])) :my-key) |
| 12:01 | clojurebot | ["your key is" :my-key] |
| 12:02 | gfredericks | ,(get 42 43) |
| 12:02 | clojurebot | nil |
| 12:02 | gfredericks | it "works" on any datatype :) |
| 12:02 | gfredericks | ,(get (Object.) (Object.)) |
| 12:02 | clojurebot | nil |
| 12:02 | justin_smith | ,(get "hello" 1) ; yeah |
| 12:02 | clojurebot | \e |
| 12:02 | justin_smith | my point is, how do you tell get what to do with your data for get to work |
| 12:02 | AMrDan | gfredericks, i'm trying to do what's written there, but it gives me the message: No such var: j/update! ...but i'm already doing (:require [clojure.java.jdbc :as j]) |
| 12:03 | gfredericks | justin_smith: ILookup, as above |
| 12:03 | AMrDan | gfredericks, what might that be? |
| 12:03 | gfredericks | AMrDan: what version of java.jdbc are you getting? |
| 12:03 | splunk | anyone have any links on vim vs. emacs for clojure? I just spent like 3 years getting good at vim and am wondering whether to pay switching cost. |
| 12:03 | justin_smith | gfredericks: cool - I was trying to get "satisfies?" to work, and it's just giving me NPEs |
| 12:04 | AMrDan | gfredericks, 0.0.6 and for sqlite 3.7.2 |
| 12:04 | `cbp | oh jebus |
| 12:04 | gfredericks | AMrDan: pretty old java.jdbc; I'm on 0.3.0-alpha4 |
| 12:05 | `cbp | where you get that version? :P |
| 12:05 | justin_smith | ,(satisfies? clojure.lang.ILookup "hello") |
| 12:05 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 12:05 | justin_smith | what am I doing wrong there? |
| 12:05 | AMrDan | gfredericks, i will update my version to get it working .. |
| 12:05 | gfredericks | justin_smith: it's not a protocol |
| 12:05 | btcNeverSleeps | ,(get 1 42) |
| 12:05 | clojurebot | nil |
| 12:06 | gfredericks | ,(instance? clojure.lang.ILookup "hello") |
| 12:06 | clojurebot | false |
| 12:06 | AMrDan | `cbp, I looked up in the project.clj |
| 12:06 | `cbp | AMrDan: I know that. I meant how did you put it there in the first place |
| 12:07 | justin_smith | gfredericks: but get works on strings |
| 12:07 | justin_smith | what check would have told me that? |
| 12:07 | justin_smith | ,(get "hello" 1) |
| 12:07 | clojurebot | \e |
| 12:07 | gfredericks | justin_smith: since a lot of core clojure fns are based on interfaces rather than protocols, you have to put up with "it works for this clojure interface and this other set of builtin java classes and interfaces" |
| 12:07 | AMrDan | `cbp, oh yeah!! hhahahahah sorry, my teacher told me to... I don't know why.. :/ |
| 12:07 | gfredericks | justin_smith: what's your higher-level goal? |
| 12:08 | justin_smith | to understand how and when get will work |
| 12:08 | mmitchell | can anyone recommend httpkit OR the clojure async client here? https://github.com/neotyk/http.async.client |
| 12:08 | gfredericks | justin_smith: probably best to dig into the source then |
| 12:08 | justin_smith | and potentially to make things you can call get on |
| 12:08 | gfredericks | justin_smith: that second part is just ILookup |
| 12:08 | justin_smith | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ILookup.java |
| 12:08 | gfredericks | justin_smith: my guess is somewhere in the source is a big conditional with all the special cases |
| 12:08 | AMrDan | gfredericks, not working yet .. same error message |
| 12:09 | gfredericks | justin_smith: look at the source for clojure.core/get and dig from there |
| 12:09 | justin_smith | gfredericks: yeah, good guess, maybe I will find it some day |
| 12:09 | gfredericks | AMrDan: you restarted your process? |
| 12:09 | AMrDan | gfredericks, like, cancel lein and run again? yes |
| 12:09 | gfredericks | justin_smith: usually you end up in RT.java after a step or two and it's not much more complex than that |
| 12:09 | justin_smith | "(. clojure.lang.RT (get map key))" so where do I look up the version of get RT is using in that snippet from the def of get? |
| 12:09 | AMrDan | gfredericks, lein deps, lein run |
| 12:09 | justin_smith | oh, so I look in RT.java and find the def of get |
| 12:09 | justin_smith | gotcha |
| 12:10 | gfredericks | AMrDan: okay, clojure.java.jdbc/update! definitely exists for me |
| 12:10 | gfredericks | justin_smith: well look at (source get) first to be sure you know where to look in RT.java |
| 12:10 | gfredericks | I hadn't looked yet, but it looks like it does just call RT.get immediately |
| 12:10 | justin_smith | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L644 |
| 12:11 | justin_smith | (inc gfredericks) |
| 12:11 | lazybot | ⇒ 37 |
| 12:11 | justin_smith | thanks for the help |
| 12:11 | gfredericks | np |
| 12:13 | gfredericks | AMrDan: can you paste your code that's not working on refheap.com |
| 12:13 | AMrDan | gfredericks, ok... |
| 12:15 | clgv | you can use "LATEST" as version in maven? :P not that I would |
| 12:16 | AMrDan | gfredericks, https://www.refheap.com/26781 |
| 12:16 | seangrove | Hrm, no powerline in emacs packages... |
| 12:16 | `cbp | clgv: you can give it ranges i think |
| 12:16 | `cbp | version ranges |
| 12:16 | clgv | `cbp: no I saw a literal "LATEST" in a maven pom |
| 12:16 | gfredericks | AMrDan: j/update! doesn't work because you're not requiring java.jdbc in the same manner (:as j) that you reported earlier |
| 12:17 | gfredericks | see line 3 |
| 12:17 | AMrDan | gfredericks, i have to take exclude off? |
| 12:17 | `cbp | clgv: oh apparently LATEST and RELEASE are valid versions |
| 12:21 | gfredericks | AMrDan: no I would just switch line 3 to be (:require [clojure.java.jdbc :as j]) instead of :use |
| 12:24 | AMrDan | gfredericks, ok man .. its working, tks |
| 12:24 | AMrDan | gfredericks, :D so much !!! :D |
| 12:24 | `cbp | AMrDan: If I may ask where are you learning clojure? |
| 12:26 | AMrDan | 'CBP, college, but i'm not learning, just doing a research.. my teacher helps some times |
| 12:26 | `cbp | Oh ok |
| 12:27 | llasram | Only one research? I usually try to do at least a few at a time |
| 12:27 | AMrDan | 'CBP, you are telling this because of the 0.0.6 ..heheheh that was really deprecated.. |
| 12:27 | AMrDan | :( |
| 12:28 | `cbp | AMrDan: No, I just got curious because you mentioned a teacher. So I was imagining a clojure classroom |
| 12:28 | llasram | AMrDan: This Leiningen plugin may help with that in the future https://github.com/xsc/lein-ancient |
| 12:28 | tangrammer | Hi folks! can anyone give me an advise on developing mobile apps (android and IOs) with clojure? |
| 12:28 | tangrammer | http://stackoverflow.com/questions/21313107/what-is-the-preferred-way-to-use-clojure-for-making-a-mobile-app-android-and-io |
| 12:28 | `cbp | tangrammer: My advice would be don't |
| 12:29 | AMrDan | llasram, thanks so much ... :D |
| 12:29 | tangrammer | `cbp: thanks, but … why? |
| 12:30 | dnolen | tangrammer: w/ iOS you'll have better luck with the JavaScriptCore bridge and ClojureScript |
| 12:30 | dnolen | tangrammer: I've tried it works great and I know other people are experimenting with it as well |
| 12:31 | `cbp | tangrammer: performance mostly. Android doesn't have a jvm |
| 12:31 | dnolen | tangrammer: it does limit you to iOS 7, but you could take the Ejecta approach for earlier OSs |
| 12:31 | dnolen | tangrammer: hopefully in the future Android has sensible trasnparent JS bindings as well |
| 12:32 | tangrammer | dnolen: thanks for your help with real case comments ! I'll document it on my os question |
| 12:34 | tangrammer | `cbp: yes about performance i've read it something about, although in my case I've not to develop a popular app but a internal company app |
| 12:36 | frank____ | test |
| 12:36 | `cbp | Well have fun I guess. I would in all honesty just use Eclipse + java. You could maybe try using nightcode with clojure it has android project templates |
| 12:38 | seangrove | I think core.async + om ios app could be a lot of fun to play with |
| 12:39 | seangrove | Might be time to revisit Kevin's angular/cljs/ios post |
| 12:41 | locks | seangrove: interesting idea |
| 12:41 | tangrammer | seangrove: Hi Sean, have you tried it?… just wondering about core.async on iOS a few hours ago |
| 12:41 | dnolen | tangrammer: core.async on iOS works great |
| 12:41 | dnolen | tangrammer: you can also do multithreaded CLJS on iOS |
| 12:42 | dnolen | seangrove: how did the SF CLJS meetup go? |
| 12:42 | seangrove | It's next Monday, on the 27th |
| 12:43 | seangrove | Next month will be on React/Om if you want to come visit ;) |
| 12:43 | seangrove | dnolen: I assume you've submitted something for Clojure/West on Om? |
| 12:45 | dnolen | seangrove: yep submitted a talk |
| 12:50 | hyPiRion | gfredericks: you forked clojure itself? |
| 12:50 | llasram | awww |
| 12:50 | technomancy | oh snap |
| 12:50 | rasmusto | oshi |
| 12:51 | _oggy | am i allowed to use Vars (i.e. a top-level def) in the same namespace with a gen-class? |
| 12:51 | llasram | _oggy: Yes, but you really shouldn't be using gen-class |
| 12:51 | arrdem | hyPiRion: loooool |
| 12:51 | _oggy | llarsam: what should i be using? |
| 12:51 | llasram | _oggy: Well, depends on what you're trying to do with it :-) |
| 12:52 | _oggy | llasram: i need to write a plugin for a java app, and i need a named class |
| 12:52 | technomancy | there are definitely interop scenarios that justify gen-class |
| 12:52 | technomancy | like that |
| 12:52 | sdegutis | Are there any forks of Clojure that compile to YARV bytecode yet? |
| 12:52 | gfredericks | https://github.com/fredericksgary/re-rand/commit/3cbf5931dcdf5b5fa50ab2c54eee27ce2771ea72 |
| 12:53 | hyPiRion | gfredericks: wow, that's amazing |
| 12:53 | llasram | _oggy: Does the app need to construct instances of the named class itself? |
| 12:53 | _oggy | llasram: the Java app does |
| 12:53 | gfredericks | hyPiRion: I think he implemented his own rand-nth |
| 12:53 | gfredericks | which involves constructing an intermediate vector and calling it immediately |
| 12:54 | gfredericks | these were truly the wild days |
| 12:54 | hyPiRion | hah, amazing |
| 12:54 | sdegutis | I just feel like we're missing out on major growth potential by not being able to integrate natively with Rails. |
| 12:54 | lvh | Hello :) |
| 12:54 | llasram | _oggy: Ok. My preferred solution in that situation is to implement a tiny stub class in Java which calls the Clojure Java API |
| 12:54 | technomancy | meh |
| 12:54 | technomancy | there is nothing wrong with a gen-class |
| 12:55 | llasram | _oggy: That's essentially what gen-class does for you, but by doing it yourself "manually" avoids several issues with AOT |
| 12:55 | gfredericks | is there still no standard solution for a common java.util.Random instance? I'm starting to use https://github.com/fredericksgary/four |
| 12:55 | lvh | My wife would like to do some clojure with me. She's got a BA in CS, but hasn't programmed in a while. Are there any cool projects you'd recommend that let us build toy stuff (this can be anything) quickly? Preferably lots of visual feedback. |
| 12:55 | llasram | _oggy: And can make it waaaay easier to get the Java interface exactly as necessary, especially if it involves annotations |
| 12:55 | technomancy | sdegutis: there was a talk at the first clojurewest about doing that with jruby and how terrible it was |
| 12:55 | llasram | technomancy: But but -- you love avoiding AOT! |
| 12:55 | lvh | I'm considering lots of cljs + maybe om, because that way I don't have to worry about turning her machine into a clojure dev environment. |
| 12:56 | technomancy | llasram: just resolve at runtime |
| 12:56 | _oggy | llasram: interesting. do you have any reading pointers? |
| 12:56 | technomancy | I hate transitive AOT |
| 12:56 | seangrove | sdegutis: CircleCI tried that originally, worth talking to arohner and Paul Biggar if you get a chance |
| 12:56 | technomancy | but I also hate writing java |
| 12:56 | sdegutis | :( |
| 12:56 | edbond | how to replicate this in clojure (splat)? (ruby) a = [1,2]; [3, *a, 4]; # => [3,1,2,4] |
| 12:57 | hyPiRion | lvh: http://keminglabs.com/c2/ should give you a visualisation library in ClojureScript |
| 12:57 | sdegutis | First and foremost, I'm sorry that I confused you guys, since I was joking. |
| 12:57 | seangrove | sdegutis: I just realized that arohner gave the talk technomancy mentioned |
| 12:57 | llasram | technomancy: Is "resolve at runtime" usually an option in the relevant situations? Usually this involves some Java code doing reflection to load a class by name |
| 12:57 | llasram | s,some Java code,some existing Java code, |
| 12:57 | technomancy | llasram: I mean in the gen-class method calling require+resolve |
| 12:58 | technomancy | tot avoid having the AOT be transitive |
| 12:58 | seangrove | trolled by sdegutis .... |
| 12:58 | sdegutis | But secondly, it makes me feel funny inside knowing that it could be mistaken for serious. |
| 12:58 | hyPiRion | edbond: (let [a [1 2]] `[3 ~@a 4]) -- note, this is not good code in general, use (concat [3] a [4]) instead |
| 12:58 | sdegutis | Like, kind of sad. Kind of disillusioned. I don't know what to call it. |
| 12:58 | llasram | technomancy: Oh, I see what you mean. Still means AOTing all of clojure.core |
| 12:58 | lvh | hyPiRion: Cool, thanks! |
| 12:58 | technomancy | sdegutis: don't worry; you weren't in danger of anyone actually thinking it was a good idea |
| 12:58 | technomancy | llasram: that's already AOT'd though |
| 12:58 | sdegutis | seangrove: I honestly wasn't trying to troll, just making a brief joke :) |
| 12:58 | sdegutis | technomancy: :D |
| 12:59 | llasram | technomancy: Hmm, you may be right. There was some issue... Either way, it's some hoops to jump though, and |
| 12:59 | technomancy | llasram: but it does lock you to a specifc clojure version |
| 12:59 | edbond | hyPiRion, thanks, concat looks valid. |
| 12:59 | sdegutis | Oh that reminds me. I made up a riddle/joke the other day and told it to my wife and kids, who received it well. Would anyone like to hear it? |
| 12:59 | edbond | ,(inc hyPiRion) |
| 12:59 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hyPiRion in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 12:59 | llasram | I'd prefer to jump through the "tiny amount of Java" hoop |
| 12:59 | technomancy | llasram: I guess if you already are comfortable writing java it's not a big deal |
| 12:59 | technomancy | comes down to personal preference |
| 12:59 | edbond | hm, how to inc here? :) |
| 12:59 | hyPiRion | edbond: remove the `,` |
| 12:59 | llasram | _oggy: I don't have any great write-up pointers, but here's an example: https://github.com/damballa/abracad/blob/master/src/java/abracad/avro/ClojureDatumReader.java |
| 12:59 | edbond | (inc hyPiRion) |
| 12:59 | lazybot | ⇒ 31 |
| 13:00 | llasram | _oggy: And rhickey did a lightning talk on it at one point |
| 13:00 | hyPiRion | ,(+ 1 2) evaluated actual code:) |
| 13:00 | clojurebot | 3 |
| 13:01 | _oggy | llasram: thanks |
| 13:01 | llasram | _oggy: Ah, here we go: http://skillsmatter.com/podcast/scala/impromptu-rich-hickey-lightning-talk |
| 13:02 | clgv | gfredericks: I use java.util.random instances in a function closure and pass around the function since I need repeatability via seeds |
| 13:02 | llasram | technomancy: Yeah. I guess I've mostly been doing it either for libraries or needed to add wacky annotation fun times, both of which lean my preference |
| 13:05 | seangrove | Sometimes I listen to bbloom and I wonder how much I have to learn and improve before he stops sounding like a babbling madman |
| 13:05 | gfredericks | clgv: I'm thinking about making libs paramaterizable |
| 13:05 | seangrove | He may be a prophet come before his time |
| 13:06 | clgv | gfredericks: what do you mean exactly? |
| 13:06 | gfredericks | clgv: e.g., this re-rand lib |
| 13:06 | gfredericks | it makes calls to clojure's random functions |
| 13:07 | gfredericks | so if I want to use it, I can't do so deterministically |
| 13:07 | gfredericks | thus I'm forking it so it will use com.gfredericks.four.stateful/*rand* instead, then I can set that var while calling re-rand |
| 13:07 | gfredericks | I don't know any good reason this capability shouldn't be in clojure.core itself, but I never hear anybody talking about it |
| 13:08 | clgv | gfredericks: you could easily alter-var-root the rand function in core if really needed ;) |
| 13:08 | llasram | ~guards |
| 13:08 | clojurebot | SEIZE HIM! |
| 13:08 | clgv | :D |
| 13:09 | gfredericks | yeah :( |
| 13:09 | llasram | I mean, seriously. This isn't Ruby here. |
| 13:10 | clgv | I alter-var-root defn for debugging and profiling ;) |
| 13:11 | llasram | huh |
| 13:12 | clgv | but yeah that's dev-time only ;) |
| 13:15 | `cbp | you wat |
| 13:16 | Anderkent | clgv: I read that as 'I alter-var-root the alter-var-root fn for debugging and profiling' at first, and was like woah. |
| 13:17 | edbond | cljs doesn't have ns-resolve and *ns*. How can I get def-ed var from string? |
| 13:17 | clgv | Anderkent: rofl. nice read :D |
| 13:17 | llasram | locks: Yes? |
| 13:17 | clgv | Anderkent: you should definitely (defmacro defmacro ...) ;) |
| 13:18 | llasram | edbond: You can't. They aren't reified -> available at runtime |
| 13:18 | bbloom | seangrove: i assume you're referring to my om/state email :-) |
| 13:19 | bbloom | seangrove: i tried not to assume "all readers are inside my brain". happy to elaborate/clarify where necessary |
| 13:19 | edbond | llasram, is there any way to get variable from string? |
| 13:20 | `cbp | timbre has a defmacro inside a defmacro i thought that was the craziest thing i've seen at the time |
| 13:20 | sdegutis | Anyone want to hear a riddle I made up? |
| 13:20 | sdegutis | I told it to my wife and kids the other day, and they seemed to like it. |
| 13:20 | locks | llasram: one more word about Ruby… :P |
| 13:20 | s4muel | Hey all, so I'm working with a clojure program that just accepts input from stdin using read-line in a loop. What would be the idiomatic way to signal EOF and perform some cleanup/calculation after I am done reading? |
| 13:20 | locks | sdegutis: is it about bees |
| 13:20 | sdegutis | locks: shh nobody else here heard it |
| 13:20 | technomancy | s4muel: lazy seq of lines, I'd say. maybe line-seq. |
| 13:21 | bbloom | seangrove: but yeah, the "babbling madman" phenomenon is exceedingly common in my experience |
| 13:21 | llasram | edbond: Not at runtime that I'm aware of. You can (effectively) do it at macro-expansion time in a macro. For runtime, you'll need to create your own map of strings to functions and look up your string there |
| 13:21 | bbloom | seangrove: i felt that way about dmbarbour for YEARS, but for some reason i stuck with it & now most of the time i'm like "this dude knows wtf he is talking about" |
| 13:22 | seangrove | bbloom: Don't worry, I already assume that with you, just a lack of time and energy investment on my part to learn everything I should |
| 13:22 | bbloom | seangrove: i am honored to have achieved the rank of "babbling madman.... worth listening to" |
| 13:23 | seangrove | bbloom: Well, keep it up, it's likely only the second half will change any time soon |
| 13:25 | bbloom | seangrove: goal is what rich hickey has managed to achieve: "calmly and clearly venting in a way that changes the way people think for the better with growing influence" |
| 13:27 | clgv | `cbp: I have a Meta-DSL to create a DSL of a certain type which also uses defmacros inside defmacro ;) |
| 13:28 | `cbp | Well I'm pretty proud that revise has only a single macro :-p |
| 13:29 | eyepatch | Just starting out learning Clojure. Trying to return the sequence of numbers < 10 that are multiples of 3 or 5. (ignore the comment) http://ideone.com/NC2Dmi |
| 13:29 | clgv | revise? |
| 13:29 | `cbp | clojure rethinkdb driver |
| 13:29 | eyepatch | It's giving the a runtime error that I don't seem to be able tor ead. |
| 13:29 | eyepatch | *to read |
| 13:29 | arrdem | `cbp: theres a macro in there? I didn't see one... |
| 13:29 | arrdem | all the fns... |
| 13:29 | `cbp | arrdem: it's the lambda macroç |
| 13:29 | `cbp | macro even |
| 13:30 | aperiodic | eyepatch: that [(vec (range 10))] will turn into a one-element vector with a vector of 0..9 inside of it, which is probably not what you want |
| 13:31 | riley526 | eyepatch: you probably want to map mult-3-or-5? over your vector of numbers |
| 13:32 | aperiodic | eyepatch: also the vec is unnecessary; take-while will turn it into a seq and produce a seq |
| 13:32 | RickInAtlanta | don't think take-while will give the behaviour you want |
| 13:32 | aperiodic | riley526: aww, don't give everything away, guys, eyepatch just wants help with the runtime error |
| 13:32 | gfredericks | bbloom: I'm having trouble around slide 24 where you accuse the entire audience of having made pointer cycles; i.e., I have no idea what context of engineering you're thinking of; data structures? high-level architecture? |
| 13:32 | eyepatch | I thought that take-while would do that. |
| 13:32 | aperiodic | ,(doc take-while) |
| 13:32 | clojurebot | "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects." |
| 13:32 | riley526 | aperiodic: woops, my bad. at least I didn't write it out. |
| 13:32 | riley526 | heh |
| 13:33 | bbloom | gfredericks: yeah, when i rewatched my talk later i realized that i forget to mention what that diagram was of..... one example: every UI framework you've ever used besides React/Om/&friends where components know their container |
| 13:33 | bbloom | gfredericks: another example is a Customer class that knows it's Orders and the Order class knows it's customers |
| 13:34 | gfredericks | ah ha |
| 13:34 | eyepatch | oh, yeah, take-while isn't what I want. I thought that map transformed the vector, which isn't what I want either. |
| 13:34 | eyepatch | The simplest form of this would be to drop the elements for which pred is false. |
| 13:35 | bbloom | gfredericks: basically anytime you try to model a bidirectional relationship at the site of the relationship, you're introducing a cycle. you need to model it at the contextual level |
| 13:35 | aperiodic | eyepatch: yes, the functions that do that sort of thing are filter and remove |
| 13:35 | gfredericks | bbloom: sense made |
| 13:35 | gfredericks | bbloom: thanks |
| 13:35 | RickInAtlanta | eyepatch I think the brackets [] around your range are going to cause you a problem too |
| 13:36 | RickInAtlanta | ,(take-while even? (range 10)) |
| 13:36 | clojurebot | (0) |
| 13:37 | rads | bbloom: I just joined the channel but that sounds interesting. could you link me to the talk you're referring to? |
| 13:37 | bbloom | rads: http://www.hakkalabs.co/articles/clojure-software-dendrology |
| 13:38 | rads | ty |
| 13:38 | eyepatch | That all helped. |
| 13:38 | RickInAtlanta | did you get it working? |
| 13:39 | eyepatch | Yes. |
| 13:39 | RickInAtlanta | nice |
| 13:40 | eyepatch | Well, I'm impressed by the final code. |
| 13:50 | gfredericks | ,(->> (range 10) (remove #(zero? (* (rem % 5) (rem % 3))))) |
| 13:50 | clojurebot | (1 2 4 7 8) |
| 13:53 | mharju | Hi! I'm trying to connect to a CLJS browser repl with Piggieback, however I'm getting a 404 error when it tries connecting to http://localhost:9000/xpc?<load-of-crap> |
| 13:53 | guest1234 | code organization question: Anyone have example of Ring/Compojure App with Multiple Routes ... should everything be thrown in handler.clj or broken out into /src/routes/whatever-route-group.clj ? |
| 13:53 | mharju | http://localhost:9000/?xpc=<xxx> |
| 13:54 | `cbp | guest1234: you can look at the luminus template |
| 13:54 | mharju | the rhino version works as expected, and the page is served as it should be (index.html appears from the localhost:9000 after I initialize the repl from "lein repl" |
| 13:54 | `cbp | guest1234: http://www.luminusweb.net/ |
| 13:55 | guest1234 | `cbp: thanks. looking at http://www.luminusweb.net/docs/routes.md |
| 14:02 | mharju | I found an old answer that had success by adding <meta charset="UTF-8"> to the index.html page but that did not help me. I still get the 404 from the cljs trying to make the xpc-connection |
| 14:05 | mharju | BTW, just to verify, you don't need auth to be able to be heard in here? :) |
| 14:05 | RickInAtlanta | I can hear you :) |
| 14:05 | mharju | RickInAtlanta: Thanks, just a sanity check :) |
| 14:05 | RickInAtlanta | I, however, have no idea how help :) |
| 14:06 | dobry-den | I noticed that most caching systems do the invalidation check + recomputation on the client-read side. But are there any caching mechanisms that do this kind of stuff in the background? |
| 14:07 | dobry-den | It seems heavy and backward (although simple) to do it on the read side |
| 14:08 | dobry-den | For example, with noir.util.cache - If the read is in charge of swapping the (def cached (atom {})), doesn't that just create sync contention under load? |
| 14:14 | arrdem | dobry-den: you could build such a system, but really all you do is increase net system load. |
| 14:15 | arrdem | dobry-den: if you have a parallel thread which exists simply to recompute a cache on a clock tick, then you have the exact same contension issue as if you just blocked one server thread when the cache was deemed invalid. |
| 14:17 | dobry-den | arrdem: that's a good point. at least an unlucky user doesn't need to pay the toll. |
| 14:17 | arrdem | dobry-den: with some probability a user doesn't pay the toll. |
| 14:18 | dobry-den | arrdem: what do you mean? |
| 14:18 | arrdem | dobry-den: if you compute the new state and then swap cache atom without locking it, you could reduce the probability of slamming a user to almost nothing, but there would still exist a pathalogical synchronization case when a user could try to read the cache at the same time as you are writing it. |
| 14:19 | xnil | I'm writing an IRC bot in clojure, and I got it to connect to a server, send the NICK and USER messages, then receive messages and respond to a PING message properly (this has been tested, and all of the configuration stuff has been tested working). The problem is, after the initial PING/PONG, the bot stops receiving any messages whatsoever. Here's the cljbot.irc namespace http://pastebin.com/VHb1xfmg and cljbot.core only calls (init-connections |
| 14:20 | arrdem | dobry-den: technically its (/ swap-duration cache-lifetime) |
| 14:20 | xnil | I'd appreciate if someone could have a look and see if they see something wrong |
| 14:22 | dobry-den | arrdem: let's say 100 people read at the same time. aren't they all going to recompute the swap only for 99 of them, upon trying to swap, see that they didn't need to? https://github.com/noir-clojure/lib-noir/blob/master/src/noir/util/cache.clj#L30 |
| 14:23 | dobry-den | even worse isn't it every read that happens during the recomputation? |
| 14:24 | arrdem | for that particular definition of an atom based cach I would agree with your assessment. |
| 14:25 | dobry-den | arrdem: i'm really naive here. how would you get around this then if your reads are responsible for recomputing the cache? |
| 14:26 | sdegutis | I think Julia just saved my Clojure IDE. |
| 14:28 | `cbp | wat |
| 14:28 | sdegutis | `cbp: Julia the language. |
| 14:28 | sdegutis | http://julialang.org/ |
| 14:29 | Raynes | sdegutis: Elaborate! |
| 14:29 | sdegutis | The two biggest problems I had were writing a fast lexer/parser, and exporting it to user-written scripts. Julia pretty much solves both at the same time. |
| 14:29 | arrdem | dobry-den: sorry had to restart emacs there... |
| 14:30 | arrdem | dobry-den: I'm gonna reserve judgement on this cache implementation. Given ibdknox's rep there's probably something we're missing here. |
| 14:30 | sdegutis | My new plan is to rewrite them in Julia itself, which will be embedded in the app, which makes scripting much saner. |
| 14:30 | arrdem | :P |
| 14:30 | bbloom | Julia is quite nice as a Python replacement in my mind |
| 14:31 | `cbp | saner compared to clojure? |
| 14:31 | sdegutis | The beauty of Julia is that you can embed it easily into a C program, and it's trivial to call C from Julia, even interoperating cleanly with C types. |
| 14:31 | sdegutis | `cbp: Swing ruined the Clojure route for me. |
| 14:31 | dobry-den | arrdem: how would you get around this issue if your reads are responsible for recomputing the cache? |
| 14:32 | arrdem | dobry-den: I think the trick here is that the (fn []) which may do the recomputing is run in an ordered transaction queue. |
| 14:32 | `cbp | sdegutis: is there a repo up somewhere? :D |
| 14:32 | sdegutis | `cbp: of what? |
| 14:32 | `cbp | sdegutis: your IDE |
| 14:32 | sdegutis | `cbp: yeah, one sec |
| 14:32 | arrdem | dobry-den: so while other reads will be blocked, only one "person" (client/transaction) will actually do the recompute work |
| 14:33 | arrdem | dobry-den: everyone else just has to wait in line, which they would anyway for a read I believe. |
| 14:33 | sdegutis | `cbp: but be warned, it's slightly-broken and I don't use it (mainly for the aforementioned reasons) |
| 14:34 | `cbp | sdegutis: okies |
| 14:34 | sdegutis | `cbp: https://github.com/sdegutis/Leviathan is the latest ObjC version |
| 14:35 | sdegutis | I started on a Clojure version, starting with the key mapper (https://github.com/sdegutis/Leviathan/blob/clojure/src/leviathan/keymapper.clj) but gave that effort up once I realized how daunting it is to make Swing look just the way you want it to. Much easier in Cocoa. |
| 14:37 | sdegutis | `cbp: you on a mac? |
| 14:37 | `cbp | sdegutis: i need to make a desktop app too and didn't like swing. I chose cljs + node-webkit though |
| 14:37 | `cbp | sdegutis: yeah |
| 14:37 | arrdem | dobry-den: lemme take another look at the clojure.lang.Atom class, but that's what I remember from when I was reading the core yesterday. |
| 14:37 | sdegutis | `cbp: node-webkit seems like the easiest way to make it look pretty, but some principle in me just won't allow me to do such a convoluted thing |
| 14:43 | `cbp | sdegutis: looking forward to a first build :-D |
| 14:43 | arrdem | dobry-den: okay. atoms are entirely unordered/unsynchronized besides using the Java system atomic reference. |
| 14:43 | sdegutis | `cbp: hmm? |
| 14:43 | arrdem | dobry-den: it was agents which did transaction ordering. |
| 14:44 | `cbp | sdegutis: whenever you release it |
| 14:44 | sdegutis | `cbp: Leviathan? |
| 14:44 | `cbp | sdegutis: yeah |
| 14:44 | sdegutis | You can already use it right now. It's just missing conveniences that I won't work without. |
| 14:44 | `cbp | sdegutis: I'll try it out this weekend then |
| 14:45 | sdegutis | k |
| 14:50 | gfredericks | somehow upgrading cider made things 10x more buggy |
| 14:50 | sdegutis | I have a rule that I never ever upgrade anything that's in ~/.init.el |
| 14:50 | gfredericks | I wish I knew how to track versions better |
| 14:51 | Bronsa | I'm still using slime. |
| 14:51 | Bronsa | gfredericks: I use git submodules && freeze the libs at safe commits |
| 14:51 | arrdem | Bronsa: heh |
| 14:51 | sdegutis | I'm stuck with a semi-broken version of Magit, but it's less broken than that one time I tried to upgrade it. |
| 14:51 | `cbp | It always sounds like it's not worth to go from nrepl to cider :P |
| 14:51 | `cbp | what's the difference? |
| 14:51 | technomancy | gfredericks: melpa? |
| 14:51 | Bronsa | sdegutis: yeah. I don't think I'll ever upgrade magit again. |
| 14:52 | sdegutis | technomancy: I've since changed my mind and agree with you on Melpa. I just wish Marmalade had more packages. |
| 14:52 | arrdem | I would discuss my various emacs package pains, but I don't want to jinx my currently stable setup :P |
| 14:52 | technomancy | sdegutis: it used to be you could just M-x marmalade-upload-buffer and it would work |
| 14:53 | gfredericks | technomancy: yeah I use melpa I just don't know how to put a version in the init.el |
| 14:53 | technomancy | which made it really easy to convince maintainers to publish to marmalade |
| 14:53 | sdegutis | technomancy: that seems fragile tho |
| 14:53 | technomancy | gfredericks: I don't know if you can. that's why I don't use melpa. |
| 14:53 | sdegutis | last time I checked you can't |
| 14:53 | gfredericks | technomancy: oh okay; what do I want to use? |
| 14:53 | gfredericks | haskell? |
| 14:53 | clojurebot | haskell is for beardy awesome people |
| 14:53 | technomancy | gfredericks: marmalade |
| 14:54 | sdegutis | see https://github.com/milkypostman/melpa/issues/7 |
| 14:54 | sdegutis | Heh someone in #proglangdesign spoke highly of Haskell the other day, and convinced me that the arity-duplication problem (zipWith3, etc) is rarely encountered. |
| 14:58 | gfredericks | technomancy: okay actually I am using marmalade? |
| 14:58 | gfredericks | based on my package-archives |
| 14:58 | gfredericks | are we talking about the software that downloads packages or the remote public repository? |
| 14:59 | gfredericks | I have no idea what I'm talking about emacs is so confusing |
| 15:01 | gfredericks | bundle install marmalade --via leiningen |
| 15:01 | sdegutis | gfredericks: like all good things, it takes time and energy to learn and become proficient and angry at it. |
| 15:01 | arrdem | mainly angry.... |
| 15:01 | sdegutis | yes. |
| 15:01 | gfredericks | emacs: at least it's not vim |
| 15:02 | sdegutis | some days i seriously think of going back to vim. then the pain in my pinky goes away and im fine again. |
| 15:03 | marcopol_ | gfredericks: vim users have a similar slogan... |
| 15:04 | tos9 | (except instead of pinkies it involves vimscript and concurrency) |
| 15:05 | mmitchell | Is anyone using http-kit? Looks pretty awesome, but tempted to stick with what I've worked with in the past (clojure async/netty). |
| 15:06 | clgv | did someone export graphs to GEXF with clojure, yet? |
| 15:08 | clgv | hmm well it's xml so any XML library should do, I guess |
| 15:09 | maravillas | mmitchell: i played with it a little last night and got a websocket connection running with chord in no time |
| 15:09 | maravillas | very straightforward |
| 15:09 | maravillas | that's the extent of my experience with it, though |
| 15:09 | mmitchell | maravillas: cool, so using the server then? |
| 15:09 | egghead | chord is cool |
| 15:10 | mmitchell | What's chord |
| 15:10 | mmitchell | ? |
| 15:10 | mmitchell | googling... |
| 15:10 | egghead | websocket clj<->cljs lib |
| 15:10 | mmitchell | oh nice |
| 15:10 | maravillas | "using" is a strong word :) just playing around with it so far |
| 15:10 | mmitchell | thanks, good to know |
| 15:10 | maravillas | http://github.com/james-henderson/chord |
| 15:10 | egghead | Chord gave me credit even though I didn't contribute to the project, feels good |
| 15:12 | dsrx | is it reasonable to use chord on the server side w/ a different websocket impl on the client? |
| 15:14 | seangrove | Uhg, trying to get clojurescript.test and om/react working together, not fun |
| 15:14 | seangrove | noprompt figured it out a few days ago, hope he pops in soon |
| 15:15 | gfredericks | ,((fn some-sets [] (set (repeatedly (rand-int 3) some-sets)))) |
| 15:15 | clojurebot | #{#{}} |
| 15:15 | gfredericks | ,((fn some-sets [] (set (repeatedly (rand-int 4) some-sets)))) |
| 15:15 | clojurebot | #{} |
| 15:15 | gfredericks | ,((fn some-sets [] (set (repeatedly (rand-int 4) some-sets)))) |
| 15:15 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 15:18 | dsrx | oh, i should probably just use http-kit for my thing |
| 15:24 | reiddraper | gfredericks: nice. hoping the test.check migration is imminent, which should speed up development again |
| 15:25 | gfredericks | reiddraper: w00t |
| 15:27 | hyPiRion | (inc reiddraper) |
| 15:27 | lazybot | ⇒ 2 |
| 15:28 | gfredericks | every time I look at this function I have to consider reiddraper's shame for introducing a cyclic dependency |
| 15:28 | reiddraper | gfredericks: ha, you can actually blame cemerick for that one ;) |
| 15:29 | gfredericks | you mean I've been considering the wrong person's shame this whole time??! |
| 15:29 | gfredericks | this is super awkward |
| 15:29 | reiddraper | I approved the patch, so I'm not without shame too... |
| 15:29 | gfredericks | phew |
| 15:30 | reiddraper | so yeah, waiting for one more reply to the clojure-dev thread, and if that doesn't happen by end-of-month, i'll just be backing out that change I think, to move ahead with the contrib process |
| 15:30 | gfredericks | haha I love watching test frameworks run their tests: FAIL in (this-is-supposed-to-fail) (clojure_test.clj:9) |
| 15:31 | gfredericks | leiningen has something similar I think? |
| 15:32 | seangrove | Anyone have cljsbuild running tests automatically on recompile? |
| 15:33 | hyPiRion | gfredericks: the good old "failure-expected-here-dont-freak-out"? :) |
| 15:33 | seangrove | Right now ~40s turnaround on compilation + tests is pretty horrific |
| 15:33 | pjstadig | seangrove: https://github.com/jakemcc/lein-test-refresh |
| 15:34 | gfredericks | hyPiRion: ah yeah that one |
| 15:34 | hyPiRion | loving https://github.com/technomancy/leiningen/blob/master/test_projects/sample_failing/src/nom/nom/nom.clj |
| 15:34 | seangrove | pjstadig: Hrm, not sure this will work well with clojurescript.test |
| 15:35 | gfredericks | I guess that squirrel doesn't parse due to odd double-quotes at least |
| 15:35 | seangrove | Yeup, an open issue about it |
| 15:38 | gfredericks | reiddraper: haha when I set the env variable some of the tests fail that check for how many times tests are run :D |
| 15:38 | gfredericks | I guess that means it works |
| 15:38 | reiddraper | gfredericks: yeah, those tests are a bit brittle, unfortunately |
| 15:42 | gfredericks | reiddraper: https://github.com/fredericksgary/simple-check/commit/318848ae3ea0f5fce0172589ac7be22f25005f13 |
| 15:42 | gfredericks | I just pushed a patch release under my group name, so I'm happy for now. |
| 15:43 | bbloom | i just copied an `svn checkout` line from sourceforge and, instinctively, typed `git clone` before pasting it |
| 15:43 | bbloom | svn checkout git clone ... does not work, unsurprisingly |
| 15:43 | reiddraper | gfredericks: seems sane to me |
| 15:45 | reiddraper | gfredericks: is there a way to set that just on the cmd line with leiningen? |
| 15:46 | steckerhalter | why is this becoming a Long? (bit-and (int \Y) 2r0111111) |
| 15:46 | gfredericks | reiddraper: at worst in the project.clj in :jvm-opts |
| 15:47 | gfredericks | reiddraper: there's probably a gooder way to take this sort of input; I mostly just want to be able to do it from a CI script, and this way works for me using a lein profile |
| 15:47 | gfredericks | ,(type (bit-and (int \Y) 2r0111111)) |
| 15:47 | clojurebot | java.lang.Long |
| 15:48 | reiddraper | gfredericks: yeah, a profile seems like a fine way of doing it |
| 15:48 | gfredericks | ,(type ^int (bit-and (int \Y) 2r0111111)) |
| 15:48 | clojurebot | java.lang.Long |
| 15:48 | hyPiRion | ,(type ^int (bit-and (int \Y) (int 2r0111111))) |
| 15:48 | clojurebot | java.lang.Long |
| 15:48 | stuartsierra | steckerhalter: Clojure always defaults to Long. |
| 15:48 | Bronsa | clojure.lang.Numbers/and is defined only longs/Objects and always returns a long |
| 15:49 | Bronsa | ,(class (int (bit-and (int \Y) (int 2r0111111)))) |
| 15:49 | clojurebot | java.lang.Integer |
| 15:49 | steckerhalter | ok, that explains it... thanks |
| 15:49 | gfredericks | do 64-bit jvms privilege longs? I was reading the jvm spec and longs are kind of 2nd class at least at the bytecode level |
| 15:51 | gfredericks | that surprised me a little bit |
| 15:52 | stuartsierra | Supposedly on 64-bit architectures the difference between long and int is nonexistant. |
| 15:52 | stuartsierra | It is very, very difficult to prove or disprove this in benchmarks. |
| 15:52 | gfredericks | well it's gotta be somewhat existent to correctly preserve overflow :) |
| 15:53 | bbloom | it's very difficult to prove much of anything with benchmarks :-) |
| 15:53 | stuartsierra | gfredericks: Good point. |
| 15:53 | gfredericks | some of the bytecodes require converting to an int and then back to a long; I guess the 64-bit jvms notice that's happening and just keep everything long |
| 15:54 | stuartsierra | Again, that's the theory. |
| 15:54 | llasram | gfredericks: I'd figure that JITing would end up obviating any bytecode second-classing |
| 15:55 | gfredericks | llasram: yeah as long as it does notice the unnecessary conversion |
| 15:56 | gfredericks | I think conditionals; e.g., you can branch based on the value of an int but not a long |
| 15:57 | deadghost | so, how do you guys code |
| 15:57 | bbloom | surely that's something the jit can trivially remedy, right? |
| 15:58 | deadghost | do you have 8 hour non-stop coding sessions or what |
| 15:58 | technomancy | how? |
| 15:58 | clojurebot | with style and grace |
| 15:58 | deadghost | or small blocks of productivity |
| 15:58 | gfredericks | bbloom: surely |
| 15:58 | technomancy | ~botsnack |
| 15:58 | clojurebot | Thanks! Can I have chocolate next time |
| 15:58 | xnil | ~botchocolate |
| 15:58 | clojurebot | It's greek to me. |
| 15:59 | xnil | greek chocolate? |
| 15:59 | bbloom | gfredericks: surely extensible byte code is the correct answer ;-) |
| 15:59 | gfredericks | bbloom: let's make jvms multimethods |
| 15:59 | hyPiRion | deadghost: It depends on the problem. I tend to think rather hard before starting, but that's because my functional requirements doesn't change too much |
| 15:59 | technomancy | deadghost: the vast majority of actual programming work is maintenance, in which case 8-hour coding blasts isn't usually practical |
| 16:01 | pjstadig | seangrove: it doesn't work for clojurescript.test, but i think that is a desired feature |
| 16:01 | pjstadig | IOW patches welcome :) |
| 16:01 | technomancy | deadghost: every so often I'll have an idea that's good enough to cause a several-day coding fugue where it's difficult to think about anything other than the project. this is pretty rare and has only happened maybe ~5x in my entire life. |
| 16:02 | deadghost | technomancy, how many of those ended up with you thinking wtf was I thinking and what drugs was I on? when you were done? |
| 16:02 | gfredericks | technomancy: how many times has that happened since you were a babby owner? |
| 16:03 | technomancy | deadghost: well the most recent was grenchman, which hasn't really seen very wide adoption |
| 16:03 | technomancy | probably partly due to the fact that I haven't actually had much reason to use it myself |
| 16:03 | sdegutis | Julia is my new favorite language <3 |
| 16:03 | technomancy | gfredericks: only happened once prior to parenthood, oddly enough |
| 16:07 | gfredericks | technomancy: do you like the inheritance aspect of multimethods? |
| 16:07 | technomancy | gfredericks: never used it myself |
| 16:07 | gfredericks | you're the only multimethod lover I know of |
| 16:07 | llasram | I love them too! I just also love protocols :-) |
| 16:08 | gfredericks | I wonder if rhickey regrets them |
| 16:08 | hyPiRion | gfredericks: multimethods have inheritance? |
| 16:08 | gfredericks | hyPiRion: totes magoats |
| 16:08 | gfredericks | you can setup custom hierarchies even |
| 16:08 | AeroNotix | What should I use in place of multimethods, then? |
| 16:08 | technomancy | (doc derive) |
| 16:08 | clojurebot | "([tag parent] [h tag parent]); Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy." |
| 16:09 | hyPiRion | gfredericks: oh, like (derive ::foo ::bar)? |
| 16:09 | AeroNotix | ,(derive ::foo ::bar( |
| 16:09 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 16:09 | AeroNotix | ,(derive ::foo ::bar) |
| 16:09 | clojurebot | nil |
| 16:09 | AeroNotix | ,(isa? ::foo ::bar) |
| 16:09 | clojurebot | true |
| 16:10 | gfredericks | hyPiRion: here's a fun one: |
| 16:10 | gfredericks | ,(proxy [java.util.HashMap clojure.lang.IDeref] []) |
| 16:10 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Multiple methods in multimethod 'print-method' match dispatch value: class sandbox.proxy$java.util.HashMap$IDeref$db53459f -> interface java.util.Map and interface clojure.lang.IDeref, and neither is preferred> |
| 16:10 | gfredericks | (due to multiple inheritance) |
| 16:10 | AeroNotix | huh |
| 16:10 | AeroNotix | So complex type hierarchies are broke, didn't we already know this? |
| 16:11 | AeroNotix | I've never seen this done right |
| 16:11 | gfredericks | ,(prefer-method print-method java.util.Map clojure.lang.IDeref) |
| 16:11 | clojurebot | #<MultiFn clojure.lang.MultiFn@11e6116> |
| 16:11 | gfredericks | ,(proxy [java.util.HashMap clojure.lang.IDeref] []) |
| 16:11 | clojurebot | {} |
| 16:11 | hyPiRion | gfredericks beat me to it |
| 16:11 | technomancy | AeroNotix: they're not necessarily type hierarchies |
| 16:11 | technomancy | tehy're dispatch hierarchies |
| 16:11 | gfredericks | and prefer-method cleans it up :) |
| 16:11 | technomancy | that said, I've never found a use for it |
| 16:12 | technomancy | genuine need for user-defined polymorphism is rare enough as it is |
| 16:12 | gfredericks | I've used it once |
| 16:12 | gfredericks | it was fun though :) |
| 16:12 | gfredericks | https://github.com/fredericksgary/bitalgs/blob/master/src/bitalgs/sha1.clj#L9 |
| 16:14 | Anderkent | I don't even know how to start parsing that |
| 16:16 | gfredericks | ~how |
| 16:16 | clojurebot | with style and grace |
| 16:17 | AeroNotix | "To all the ladies in the place with style and grace |
| 16:17 | AeroNotix | " |
| 16:17 | mdrogalis | ~when |
| 16:17 | clojurebot | when is for side effects |
| 16:17 | AeroNotix | ~why |
| 16:17 | clojurebot | http://clojure.org/rationale |
| 16:17 | mdrogalis | ~who |
| 16:17 | clojurebot | Excuse me? |
| 16:17 | AeroNotix | ~whence |
| 16:17 | clojurebot | Gabh mo leithscéal? |
| 16:17 | Anderkent | 'when is for side effects' ? |
| 16:18 | rasmusto | ~for |
| 16:18 | clojurebot | for is not used often enough. |
| 16:18 | technomancy | Anderkent: on account of its implicit `do` |
| 16:18 | Anderkent | when is to avoid the terrible idea that one-handed ifs are. Yuck. |
| 16:19 | technomancy | what's wrong with one-handed if? |
| 16:19 | AeroNotix | one-handed? |
| 16:19 | mdrogalis | One-legged, thanks. |
| 16:19 | technomancy | AeroNotix: if supports two arities |
| 16:20 | Anderkent | it's like not putting braces in one line ifs in java. Someone iwll inevitably forget that they can't just prepend the logging expression and break everything |
| 16:20 | technomancy | Anderkent: not if they actually know clojure |
| 16:20 | Anderkent | nope, even if they do actually know clojure |
| 16:20 | mdrogalis | The place I work at has a style policy to omit braces on one line blocks in PHP. |
| 16:21 | AeroNotix | mdrogalis: that's a bad place |
| 16:21 | Anderkent | I'm tempted to say 'your place uses php' now |
| 16:21 | mdrogalis | lool |
| 16:21 | Anderkent | but i won't! |
| 16:21 | technomancy | that sounds like something you would do if you were still getting used to the idea of expressions vs statements |
| 16:21 | Anderkent | it'd be stereotyping |
| 16:21 | brehaut | lol, clojure programmers accidentally deciding to do side effects |
| 16:22 | dsrx | where did bitemyapp go |
| 16:22 | technomancy | dsrx: he'll be back at 0200 UTC |
| 16:22 | logic_prog | i need a bleeding edge library. I have done (1) git clone ... (2) lein install ... (3) now, what do I do next so that I can put this local-SNAPSHOT.jar into my ~/.m2/... ? |
| 16:22 | technomancy | the witching hour |
| 16:22 | bbloom | technomancy: lol |
| 16:22 | Anderkent | logic_prog: lein install already did that |
| 16:22 | hyPiRion | dsrx: he's writing on a broken lexer in python and crying his brains out |
| 16:22 | brehaut | technomancy: thats morning UGT right? |
| 16:22 | technomancy | brehaut: natch |
| 16:23 | tbaldridge | hyPiRion: I told him to stop using clojure-py.... |
| 16:23 | logic_prog | Anderkent: no, it appears to have Created /Users/x/gh/core.async/target/provided/core.async-0.1.0-SNAPSHOT.jar locally |
| 16:23 | logic_prog | but it says nothing about putting it in ~/.m2 |
| 16:23 | bbloom | 6 |
| 16:24 | Anderkent | it doesnt say it but it should be there |
| 16:24 | tbaldridge | hrm...line install works for me |
| 16:24 | tbaldridge | *lein install |
| 16:24 | technomancy | logic_prog: I can see how that would be somewhat confusing |
| 16:24 | technomancy | there's an old unix adage about being silent in the success case |
| 16:25 | AeroNotix | because that's what's supposed to happen |
| 16:25 | AeroNotix | Success |
| 16:25 | AeroNotix | No need to shout about it |
| 16:25 | logic_prog | hmm, https://gist.github.com/anonymous/8587061 |
| 16:25 | kephale | is the CCW update site working for folks? |
| 16:25 | logic_prog | it looks like it installed in core/async/core.async rather than org/clojure/core/async/core.async |
| 16:25 | technomancy | AeroNotix: right, but it's not silent about generating the jar in the first place |
| 16:25 | technomancy | which is slightly inconsistent |
| 16:26 | technomancy | not sure how I feel about that |
| 16:26 | AeroNotix | -vvv is for talk |
| 16:27 | logic_prog | technomancy, tbaldridge, AeroNotix: it worked |
| 16:27 | logic_prog | however, I did have to change my project.clj to use "core.async/core.async" rather than "org.clojure/core.async" |
| 16:27 | technomancy | AeroNotix: yeah, we've been discussing creating a LEIN_VERBOSE env flag or something |
| 16:27 | Anderkent | logic_prog: seems like it's not respecting the parent pom? |
| 16:27 | logic_prog | for some reason "lein install" (from the git clone github/core.async) ends up creating "core.async/core.async" rather than "org.clojure/core.async" |
| 16:27 | Anderkent | the project.clj in core.async seems weird |
| 16:27 | Anderkent | it doesnt specify the group |
| 16:28 | Anderkent | but it has a pom.template.xml |
| 16:28 | Anderkent | that does |
| 16:28 | Anderkent | I suppose they don't use lein to generate the artifact pom? |
| 16:28 | logic_prog | how awesome I am. I found 2 inconsistencies in popular clojure tools |
| 16:28 | logic_prog | and I haven't even had lunch yet. |
| 16:28 | tbaldridge | Anderkent: yeah, sorry about that, the pom is the only thing that's used by the clojure build server |
| 16:28 | tbaldridge | and no, we don't use lein to build |
| 16:28 | AeroNotix | technomancy: I'd be happy. for Makefiles/CI it's good to silence stuff except stdout (providing people don't write errors to stdout and use return codes properly) |
| 16:28 | AeroNotix | *except stderr |
| 16:28 | logic_prog | tbaldridge: thanks for putting in the put ret fix |
| 16:29 | tbaldridge | np. Rich wrote it, but I ended up debugging it :-P |
| 16:29 | Anderkent | logic_prog: so the fix you want to do is change the artifact name in asyncs project.clj to org.clojure/core.async |
| 16:29 | Anderkent | then lein install will do what it shoud |
| 16:33 | technomancy | AeroNotix: it might need to wait for 3.x, but we should probably do a once-over of all the success-case output |
| 16:34 | technomancy | I can see the motivation behind wanting to see the output of `lein jar` though since you don't necessarily know where the jar file is going to be written to |
| 16:34 | tbaldridge | Anderkent: logic_prog: I just pushed code to core.async that adds org.clojure to project.clj |
| 16:34 | Anderkent | #iteratingquickly |
| 16:34 | AeroNotix | technomancy: I've noticed that the biggest offenders are plugins |
| 16:35 | technomancy | AeroNotix: ah, sure |
| 16:35 | Raynes | ibdknox: Man. Just used LT for Python for the first time. So cool. |
| 16:35 | technomancy | AeroNotix: I'm not sure the plugin guide is clear enough about using main/info which can be silenced |
| 16:35 | AeroNotix | is there a way to make the plugins conform to an interface where there is explcity startup/shutdown phases, so plugins should return control back to lein with something like :error/:success/:custom $INT |
| 16:36 | technomancy | AeroNotix: you can throw an ex-info |
| 16:36 | AeroNotix | cool, ok. So it just needs documenting then |
| 16:36 | AeroNotix | I was thinking if it's required then people can't miss it |
| 16:36 | technomancy | AeroNotix: but really there's not much use afaict for anything beyond "does it throw an exception? y/n" |
| 16:36 | AeroNotix | technomancy: for CI that's usually all you need |
| 16:36 | technomancy | AeroNotix: actually calling leiningen.core.main/abort is preferred |
| 16:37 | Anderkent | Hm, I'm very confused about this discussion, guess my mental models of what lein plugins usually do is different than yours |
| 16:37 | technomancy | I'll make sure it's covered in the plugin guide before the next release |
| 16:37 | AeroNotix | nice! |
| 16:37 | gfredericks | is it weird that cheshire isn't extensible by default even though it has a JSONable protocol? |
| 16:37 | dakrone | gfredericks: explain? |
| 16:38 | Anderkent | (also, adding stuff to plugin docs might not be that useful - I have written a lein plugin but this is the first time I'm hearing of main/info :P) |
| 16:38 | dakrone | it is extensible |
| 16:38 | gfredericks | dakrone: via setting up alternate functions, right? |
| 16:38 | technomancy | Anderkent: it's a minimum, not necessarily the full solution |
| 16:38 | Anderkent | though admittedly the plugin doesn't do that much, and delegates actual work to a library that's not aware of lein |
| 16:38 | dakrone | gfredericks: do you mean overriding the core encoding methods? that's totally possible |
| 16:39 | gfredericks | dakrone: it doesn't seem public though; |
| 16:39 | gfredericks | i.e., I can extend JSONable but it felt like I was doing something dirty |
| 16:39 | dakrone | gfredericks: you can use `add-encoder` to add an encoding function |
| 16:39 | dakrone | for a type |
| 16:40 | gfredericks | dakrone: that works for the core functions? |
| 16:40 | dakrone | gfredericks: yes, the generation function checks for protocol implementations first: https://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L114 |
| 16:40 | gfredericks | oh hmmmm |
| 16:40 | gfredericks | maybe I am crazy |
| 16:41 | gfredericks | dakrone: thank you for uncrazying me I will try this out |
| 16:41 | dakrone | gfredericks: if it doesn't work that's a bug :) |
| 16:42 | technomancy | AeroNotix: http://p.hagelb.org/lein-output.html |
| 16:42 | technomancy | most output comes from "known interactive" things where I don't think it's necessarily a problem |
| 16:42 | technomancy | running a repl, `lein help`, `lein new` etc |
| 16:42 | technomancy | and the warnings are legit |
| 16:43 | technomancy | jar/pom/uberjar is questionable though |
| 16:43 | AeroNotix | yeah, there's benefit to marking things "interactive" and "things which may be used in automation |
| 16:43 | AeroNotix | " |
| 16:44 | AeroNotix | At the moment, on our jenkins build we use `lein uberjar' to release an artifact |
| 16:44 | AeroNotix | not sure if that's the best idea, but we're learning. |
| 16:44 | technomancy | I think for compile/javac if we emit output only upon compilation failures that would be ideal |
| 16:44 | technomancy | AeroNotix: no, that's totally reasonable |
| 16:44 | AeroNotix | cool |
| 16:46 | akurilin | Silly qustion: is there a significant perf difference between drop-last and take? |
| 16:46 | akurilin | As in, say I have 101 items and I want to drop the last one. |
| 16:46 | Anderkent | technomancy: AeroNotix: hm, I dunno, from my experience I don't mind &> /dev/null-ing stuff when automating scripts, while in interactive usage this output can be useful |
| 16:47 | gfredericks | dakrone: so if I want to encode a custom type as a particular map, my encoder function will end up calling ch.gen/encode-basic-map and have to supply a date format (cheshire.factory/default-date-format) and an exception (nil)? |
| 16:47 | gfredericks | or did I miss some way to do that simplyer? |
| 16:47 | akurilin | The former uses a map and the latter does lazy rec |
| 16:47 | AeroNotix | Anderkent: sure, it's ugly though. Also, things which just exit 0 are stupid, totally stupid. It's a CLI tool, lrn2interface |
| 16:47 | Anderkent | right, exit 0 is stupid. |
| 16:47 | AeroNotix | Anderkent: just because I *can* read some output, doesn't mean that that's what I'll read. |
| 16:47 | technomancy | Anderkent: I agree telling the user where the jar they asked for went is good |
| 16:48 | Anderkent | No I definitely agree about exit codes. |
| 16:48 | technomancy | I am not so sure it's helpful to list every single namespace being AOT compiled though |
| 16:48 | dakrone | gfredericks: there are helpers in ch.generate for that, see `encode-map` |
| 16:48 | gfredericks | woah the impl of drop-last is weeeeird |
| 16:48 | clojurebot | Alles klar |
| 16:48 | gfredericks | clojurebot: woah the impl of drop-last? |
| 16:48 | technomancy | I guess if you have a really long compile it can be good to gauge the progress |
| 16:48 | clojurebot | woah the impl of drop-last is weeeeird |
| 16:49 | technomancy | gfredericks: what have you done |
| 16:49 | gfredericks | dakrone: omg the docstring totally told me to look at that exact function and then I didn't |
| 16:49 | dakrone | haha |
| 16:49 | gfredericks | technomancy: I wonder how many facts he picks up that way |
| 16:50 | gfredericks | dakrone: thanks a bagfull |
| 16:50 | dakrone | gfredericks: you're welcome, good luck! |
| 16:51 | technomancy | gfredericks: a ~forget-last command would help |
| 16:51 | gfredericks | technomancy: you act like this is a bad thing that has happened to us here today on this sacred ground |
| 16:51 | gfredericks | in front of all these witnesses |
| 16:52 | hiredman | the clojurebot-800 is a learing computer |
| 16:53 | sdegutis | Traced down failing tests for about 15 minutes, until I realized I just forgot to save the change I made. |
| 16:53 | gfredericks | clojurebot: the clojurebot-800 is a learing computer |
| 16:53 | clojurebot | Ik begrijp |
| 16:53 | turbofail | nobody lears like clojurebot |
| 16:53 | gfredericks | sdegutis: happens to me once a week |
| 16:53 | turbofail | it is the leariest |
| 16:54 | Anderkent | such lear, wow? |
| 16:54 | michaniskin | lol turbofail, your nick is always a joy to me |
| 16:55 | dsrx | so lear, such goneril |
| 16:56 | Anderkent | ztellman: when walking things with sleight, is there a way to tell what file/namespace is currently being walked? |
| 16:57 | ztellman | Anderkent: *ns* should be bound |
| 16:57 | Anderkent | not before the ns form is evaluated, I think? |
| 16:57 | Anderkent | I guess I care about the file, not the namespace |
| 16:58 | ztellman | I'm not sure there's a way to tell the provenance of the forms that are being loaded |
| 16:58 | ztellman | you could easily alter-var-root clojure.core/load-file |
| 16:58 | ztellman | in the :pre step for sleight |
| 16:58 | Anderkent | hm, that sounds like a fair aproach |
| 16:59 | ztellman | keep in mind that you need to unbind whatever value you set, or it will bleed over into evals that are made after the file is loaded |
| 17:00 | ztellman | :) |
| 17:00 | ztellman | it's the "that sounds like a fair approach" response that really makes it, though |
| 17:00 | Anderkent | well, all the transformations happen under load-file, right? |
| 17:01 | ztellman | Anderkent: sure, just using 'binding' instead of an atom, is all I meant |
| 17:01 | hyPiRion | technomancy: or shitztellmancreates.tumblr.com |
| 17:01 | ztellman | oh, and no |
| 17:01 | ztellman | sleight hijacks the reader |
| 17:01 | ztellman | or rather, hijacks the input to the compiler |
| 17:01 | hyPiRion | re https://mobile.twitter.com/danielwithmusic/status/426133408498995201 |
| 17:01 | Anderkent | so I guess I rebind sleight.core/load* ? |
| 17:01 | ztellman | so it affects eval |
| 17:01 | ztellman | Anderkent: wherever you still know what the file is |
| 17:01 | ztellman | it's been a while since I've looked at it, I forget exactly what the function is |
| 17:02 | ztellman | also, PSA that wherever I say alter-var-root, you should probably be using robert.hooke instead |
| 17:04 | trptcolin | i prefer to just (in-ns 'clojure.core) (def xyz) (in-ns 'original.ns) |
| 17:04 | lvh | Hi! |
| 17:04 | Anderkent | trptcolin: I have actually done that before. |
| 17:05 | lvh | I'm using clj-time. I've got an optimization problem involving start-dates and end-dates; I'm trying to minimize non-overlap. |
| 17:05 | Anderkent | well, not with def, but still |
| 17:05 | lvh | I can't figure out how to find the number of days that two intervals *not* overlap. |
| 17:06 | Anderkent | trptcolin: https://github.com/lshift/cloverage/blob/e2bb029e851a1c6dc79066de689f46870e150c88/cloverage/src/cloverage/coverage.clj#L87 :D |
| 17:06 | gfredericks | I just wrote a function to convert a java obj to a map by reflecting on all the instance fields; does this not exist? I was surprised clojure.core/bean does something different |
| 17:06 | lvh | So, e.g., given [(local-date 2014 1 1) (local-date 2014 1 10)] and [(local-date 2014 1 2) (local-date 2014 1 9)], the answer is 2; because Jan 1 isn't in the latter, and neither is Jan 10. |
| 17:07 | ztellman | lvh: this may put you on the right path: http://stackoverflow.com/a/4446165 |
| 17:07 | trptcolin | i was just trolling, but alas i have too :( womp womp https://github.com/trptcolin/reply/blob/master/src/clj/reply/hacks/printing.clj |
| 17:07 | dsrx | a hacks namespace, nice |
| 17:07 | clojurebot | Excuse me? |
| 17:07 | Anderkent | Huh, is that because print-method is private? |
| 17:07 | lvh | ztellman: Thanks, I'll start reading that :) |
| 17:09 | hiredman | gfredericks: to understand bean you have to undestand that "beans are just pojos" and who could understand that? it is just nonsense words |
| 17:09 | Anderkent | trptcolin: I seem to be able to (defmethod print-method ...) from any namespace, not sure why you need to switch |
| 17:09 | hiredman | beans? who are those when they are at home? |
| 17:09 | trptcolin | Anderkent: i have no idea why i did that |
| 17:10 | hiredman | they |
| 17:10 | Anderkent | trptcolin: haha :D |
| 17:10 | Anderkent | I have since moved on to (binding [*ns* (find-ns clojure.core)] ...) |
| 17:10 | technomancy | hiredman: heh |
| 17:10 | technomancy | reminded me of Jack Handy for some reason |
| 17:11 | hiredman | anyway, beans tend to have property accessor methods like getFoo, which is what bean reflects over, not fields |
| 17:12 | eyepatch | Certainly there are beautiful math solutions to this, but I'm trying to figure out a way to solve Project Euler Problem 2 using recursion rather than the dirty looping I've got going on here. http://ideone.com/nctSVl (SPOILERS of course) |
| 17:12 | maravillas | technomancy: sounds like the "mankind" line |
| 17:12 | Anderkent | (indeed a bean is a class that has a no-args constructor and any 'public' properties should have get/set/is accessors) |
| 17:12 | eyepatch | Generating the fibonacci sequence to n terms recursively is trivial, but I can't seem to stumble upon a solution that generates the fibonacci sequence under n value recursively. |
| 17:12 | stuartsierra | beans are degenerate structs |
| 17:13 | AeroNotix | eyepatch: there's no simple relationship between N and N-1th term in a fibonacci sequence, afaik |
| 17:14 | eyepatch | AeroNotix, there's phi and the constant and all that. |
| 17:15 | AeroNotix | eyepatch: ah |
| 17:15 | eyepatch | But I'm avoiding math trickery. I'm just exploring what's possible with idiomatic Clojure |
| 17:15 | eyepatch | Which I'm discovering is *really* easy to read, and somewhat harder to write. |
| 17:18 | gfredericks | eyepatch: I don't know what "under n value recursively" means |
| 17:19 | Anderkent | yeah, is that 'from 1 to n' or 'from n to 1'? |
| 17:20 | Anderkent | if you just want to generate a list from one to n, what you want is an infinite lazy seq of the entire sequence, and then just take n from it |
| 17:20 | Anderkent | hm, I suppose that's not recursive |
| 17:20 | turbofail | supposed to be "all fibonacci sequence numbers less than N" |
| 17:20 | turbofail | of which there really shouldn't be that many |
| 17:21 | turbofail | the problem states "all fibonacci numbers less than 4e6" |
| 17:21 | Anderkent | right, and he wants a recursive solution |
| 17:22 | turbofail | yeah i don't know how you would do that recursively |
| 17:23 | turbofail | there's no real way to do structural recursion on that |
| 17:24 | Anderkent | eyepatch: https://www.refheap.com/26802 - spoilers, obvsly |
| 17:25 | Anderkent | I can't think of a way to do this without lazyness |
| 17:25 | Anderkent | well, you could modify fib to terminate recursion when cur > n, of course |
| 17:25 | Anderkent | then you don't have to be lazy |
| 17:26 | Anderkent | also, apparently something's wrong because I get a different sum :P |
| 17:26 | Anderkent | oh it's just even ones |
| 17:31 | lvh | hi |
| 17:31 | lvh | How do I get clj-time intervals from dates |
| 17:31 | lvh | it only appears to work on instants in time. |
| 17:32 | ztellman | lvh: a date describes an instant in time |
| 17:32 | ztellman | you could have a vector of two dates to describe an interval |
| 17:34 | locks | fredyr: http://www.lexicallyscoped.com/2013/12/25/slice-of-reactjs-and-cljs.html "I going to take a piece of the React tutorial” typo |
| 17:34 | lvh | ztellman: Yes, I understand. I have pairs of dates. |
| 17:34 | lvh | ztellman: My point is that interval appears to only take *datetimes*. Not dates :) |
| 17:34 | ztellman | lvh: sorry, assuming the simplest problem |
| 17:35 | lvh | ztellman: this doesn't work: (interval (local-date 2014 01 10) (local-date 2014 01 5)) |
| 17:35 | lvh | ztellman: No problem :) |
| 17:35 | lvh | ztellman: change local-date to date-time and all is wel |
| 17:35 | lvh | l |
| 17:35 | lvh | I guess there must be some way to tack on midnight... I'll plunge in the docs |
| 17:35 | ztellman | sorry, not an expert on clj-time |
| 17:35 | ztellman | best of luck |
| 17:52 | dsrx | a date represents a range of times, as does a standard datetime, as does anything with precision coarser than the planck time ;) |
| 17:54 | eyepatch | Anderkent, sorry, didn't notice someone noticed. When I said recursion I just meant without mutable code like mine. |
| 17:54 | eyepatch | I know that recursion is something different, I communicated poorly. |
| 17:56 | eyepatch | Your code was exactly what I was looking for. |
| 17:56 | eyepatch | I figured there was a part of the language I hadn't run into that could do what I wanted. |
| 17:57 | noonian_ | can i use a protocol like IMap as a type to dispatch on for another protocol in cljs? |
| 17:59 | Anderkent | eyepatch: glad to be of use :) |
| 18:01 | dnolen | noonian_: you cannot |
| 18:02 | sdegutis | on typing: https://www.destroyallsoftware.com/talks/useing-youre-types-good |
| 18:02 | noonian_ | dnolen: thanks, i didn't think so because it wasn't working for me but a guy can dream |
| 18:03 | mmitchell | Anyone here know anything about the aleph lib? |
| 18:03 | ztellman | mmitchell: some |
| 18:03 | mmitchell | ztellman: Ahh! You :) |
| 18:04 | mmitchell | ztellman: So I'm using the http-request function. I deref the response and get a response map. Now I'm trying to turn the :body into a string, I just can't figure out how to do this? |
| 18:05 | ztellman | you can either add :auto-decode? true to the request, or use aleph.formats/bytes->string |
| 18:05 | mmitchell | I'm getting a lamina.core.channel.Channel |
| 18:05 | ztellman | aha |
| 18:05 | mmitchell | ok cool, i'll try that |
| 18:06 | ztellman | if it's a channel, you'll need to also use aleph.formats/channel->input-stream |
| 18:06 | Anderkent | shouldn't it be something like (on-relized (hhtp-request) ... )? |
| 18:06 | Anderkent | ah, wait, he blocks by defering nvm |
| 18:06 | ztellman | the channel implies it's a chunked request |
| 18:06 | mmitchell | I see |
| 18:06 | ztellman | sorry, chunked response* |
| 18:07 | ztellman | if you want to handle either case, you can do a lamina.core/channel? test on the returned body |
| 18:07 | ztellman | anyway, hope that helps |
| 18:08 | mmitchell | ztellman: yes, thanks! |
| 18:08 | mmitchell | ztellman: so what does {:auto-decode? true} do? |
| 18:09 | ztellman | mmitchell: looks at the content-type in the response, and if it's text/plain turns it into a string, and if it's application/json decodes it |
| 18:09 | ztellman | it may also handle application/xml, I forget |
| 18:09 | mmitchell | oh i see |
| 18:10 | ztellman | actually, anything with text/* gets turned into a string |
| 18:16 | mmitchell | ztellman: so in the case where i convert the channel into an input-stream, is there an aleph helper function for shoving that all into a string by chance? |
| 18:17 | ztellman | yes, (-> response :body formats/channel->input-stream formats/bytes->string) |
| 18:20 | mmitchell | ztellman: hmm, on calling bytes->string, it blocks on doesn't ever return |
| 18:20 | ztellman | what does the response contain? |
| 18:20 | mmitchell | ztellman: it's json |
| 18:20 | mmitchell | application/json |
| 18:20 | ztellman | a single json response? |
| 18:20 | ztellman | a streaming list of json? |
| 18:20 | mmitchell | hmm, i will have to look |
| 18:21 | ztellman | bytes->string will only return once the input stream is exhausted |
| 18:22 | ztellman | sorry, got to run |
| 18:22 | mmitchell | ztellman: oh it's "Transfer-Encoding chunked" |
| 18:22 | ztellman | feel free to email me if you have other questions, I'm my nick at gmail |
| 18:22 | mmitchell | ztellman: no problem, thanks! |
| 18:22 | mmitchell | much appreciated |
| 18:23 | ztellman | mmitchell: that must means it's chunked, not necessarily endless |
| 18:23 | ztellman | google.com's homepage is chunked, for instance |
| 18:23 | ztellman | if it's a finite response, bytes->string on the inputstream should return something, eventually |
| 18:23 | ztellman | but you might verify things are coming out of the channel |
| 18:23 | ztellman | anyway, gotta run |
| 18:23 | mmitchell | ztellman: ok good to know, and that makes sense |
| 18:25 | stirfoo | in a & {:keys ...} arguments list, why is the :or map not present in the :as map? |
| 18:26 | stirfoo | they defaults are bound ok in the body, but I would expect them to be in the :as map |
| 18:26 | stirfoo | *my* expectations =) |
| 18:26 | bhauman | tbaldridge: dnolen just making sure I posted this correctly in jira. http://dev.clojure.org/jira/browse/ASYNC-51 |
| 18:27 | Anderkent | stirfoo: are you asking how come that happens, or why it was done that way? |
| 18:28 | stirfoo | Anderkent: well, I was just wondering if that was in fact correct behavior |
| 18:28 | stirfoo | but the why would be nice to know |
| 18:29 | Anderkent | to the first, the :as part simply rebinds the arg. To the second, I don't actually know |
| 18:29 | Anderkent | I vaguely recall discussing this with someone else a while ago |
| 18:30 | stirfoo | Anderkent: not a big deal, does it not seem sane to assume the :or would be present in the :as ? |
| 18:30 | Anderkent | I think you're thinking about it in the wrong order |
| 18:30 | stirfoo | it's there, but it's not ;) |
| 18:31 | stirfoo | Anderkent: probably |
| 18:31 | Anderkent | it's not 'destructure form to this elements, then name that X', it's 'take the arg, name it X, then destructure it this way' |
| 18:31 | Anderkent | and the :or applies to the destructuring, not the argument |
| 18:31 | Anderkent | I suppose if it went the other way, then there'd be no way for you to actually access what was given to you |
| 18:32 | dnolen | bhauman: looks good to me |
| 18:33 | stirfoo | Anderkent: ok, I'll just have to rethink my fn |
| 18:33 | tbaldridge | bhauman: looks good. I'll try to take a look at it soon |
| 18:34 | bhauman | tbaldridge: dnolen thanks guys, as far as I can tell it's pretty intense. |
| 18:35 | dnolen | bhauman: it's just map< right? |
| 18:36 | bhauman | I don't think so. I defined my own simple version of map< and the same problem occurred |
| 18:36 | Anderkent | https://github.com/bhauman/checkmemleak/blob/master/src/checking_safari_leak/core.cljs#L59 that makes me wat |
| 18:36 | bhauman | dnolen: ^ |
| 18:36 | dnolen | bhauman: it would be nice to confirm. looking at the map<, the nested reify seems suspicious to me. |
| 18:37 | dnolen | bhauman: like see if the issue occurs with map> |
| 18:37 | bhauman | dnolen: my own version of map was a simple map-chan and it looks like it leaked |
| 18:38 | bhauman | dnolen: I can add more tests to the repo if you'd like |
| 18:39 | tbaldridge | can you define leak, and what it means for your example? Your test says "leaking now" but I'm not seeing any change in the memory usage over time |
| 18:40 | bhauman | tbaldridge: What is your SafariWebContent usage at? |
| 18:40 | Anderkent | tbaldridge: it's definitelly good 6 times slower on safari then chrome for me |
| 18:40 | technomancy | is incanter still the quickest way to throw up a histogram? |
| 18:41 | Anderkent | actually nvm |
| 18:41 | bhauman | tbaldridge: the leak is exponential the more you add to the chain the worse it gets I tried to keep it where it wouldn't crash my circa 2009 machine |
| 18:42 | tbaldridge | bhauman: okay, mine's currently at 780MB, I'll see if it sticks there |
| 18:42 | dnolen | bhauman: is this with advanced optimizations? |
| 18:43 | tbaldridge | okay, so I restarted Safari and during load the memory goes up to about 1GB and then drops to 666MB, but it's staying real close to that |
| 18:43 | bhauman | tbaldridge: did you first try the page without the leak and see the usage |
| 18:43 | bhauman | tbaldridge: ? |
| 18:44 | bhauman | tbaldridge: I was late to respond cause the page almost crashed my machine |
| 18:44 | tbaldridge | okay, yeah, with the leak-false it sticks at about 36MB |
| 18:44 | dnolen | bhauman: the level of optimization makes a huge difference in memory usage |
| 18:44 | `cbp | note to self: do not click on "this will cause memory leaks!" links |
| 18:45 | dnolen | bhauman: especially w/ core.async where otherwise you'll get tons of closures |
| 18:45 | bhauman | dnolen: tbaldridge just compare the usage of the two different examples |
| 18:45 | Anderkent | wait, how are you measuring the memory usage? Is there something like chrome devtools for safari? |
| 18:45 | dnolen | bhauman: yes I've done a lot of comparisons like this in the past |
| 18:45 | `cbp | Anderkent: activity monitor |
| 18:45 | dnolen | bhauman: you have no optimizations enabled here |
| 18:45 | Anderkent | oh, so it's on process level |
| 18:45 | dnolen | bhauman: we need to know that it affects productions optimization settings |
| 18:46 | bhauman | dnolen: I gotcha, I also experienced it at :simple |
| 18:47 | dnolen | bhauman: if you could republish examples that compiled w/ simple that would be informative as well. |
| 18:47 | dnolen | bhauman: in additions to no optimizations ones |
| 18:48 | tbaldridge | bhauman: I g2g, but my interest is piqued now, so I'll be looking into this. That is if dnolen doesn't fix it before I do :-P |
| 18:48 | bhauman | dnolen: I'll mess with it a bit |
| 18:48 | bhauman | tbaldridge: thanks man |
| 18:50 | technomancy | uuuuuuuugh incanter's histogram is a macro |
| 18:50 | technomancy | why would you do this |
| 18:50 | turbofail | ha |
| 18:52 | brehaut | clj 1.0 was crazy times |
| 18:53 | egghead | hey brehaut |
| 18:54 | egghead | thanks for writing necessary evil so I didn't have to |
| 18:54 | brehaut | hi egghead. im sorry that you have to use it |
| 18:54 | egghead | :) |
| 18:54 | brehaut | what is your misfortune? |
| 18:55 | egghead | brehaut: web ui for supervisord, only exposes itself via xml-rpc |
| 18:55 | brehaut | well thats delightful :( |
| 18:55 | egghead | http://github.com/eggsby/warden |
| 18:56 | egghead | lol brehaut could have been worse, yr lib helped a lot, hardly had to think about it |
| 18:56 | brehaut | egghead: you have gotten lucky then. lots of api's exposed via xmlrpc seem to be quagmires in their own write |
| 18:56 | brehaut | (metaweblog anyone?) |
| 18:56 | egghead | https://github.com/eggsby/warden/blob/master/src/clj/warden/supervisord.clj wasn't a pain at all, except the multicall api was horrendously slow |
| 18:57 | egghead | (guessing that is python/supervisord side) |
| 18:57 | brehaut | which bit is the multicall ? |
| 18:58 | egghead | brehaut: just part of xml-rpc, not something necessary-evil concerns itself with |
| 18:58 | brehaut | ah |
| 18:58 | egghead | basically if the request body is an array of call specs |
| 18:58 | brehaut | is it something necessary-evil should be concerning itself with? |
| 18:59 | brehaut | and theres exactly zero concern for performance in n-e; its quite possible that large datastructures will be sluggish to encode or decode |
| 19:00 | brehaut | the use of schema is interesting btw |
| 19:05 | egghead | brehaut: I don't think you need to worry about it, it's just a spec purely between the messages passed, not something the transport needs to care about |
| 19:05 | brehaut | ok cool |
| 19:05 | egghead | brehaut: ya schema... I couldn't live without knowing what shape the responses were in :p https://github.com/eggsby/warden/blob/master/src/cljx/warden/schemas.cljx |
| 19:06 | brehaut | im always happy to not have to write any more code for that lib ;) |
| 19:06 | egghead | lol |
| 19:06 | brehaut | (although i have wondered about implementing the client portion in cljs) |
| 19:06 | egghead | if I run into any walls I'll send some PRs |
| 19:06 | brehaut | ok cool |
| 19:55 | jarjar_prime | hello! |
| 19:55 | x^2 | hey |
| 20:01 | gfredericks | ,'^2 can-a-number-be-metadata |
| 20:01 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map> |
| 20:01 | gfredericks | ,(meta '^"string" foo) |
| 20:01 | clojurebot | {:tag "string"} |
| 20:01 | gfredericks | arrdem: this is different |
| 20:01 | gfredericks | strings are not IObj either |
| 20:02 | arrdem | hum... I wonder what the implementation reason for this is.. |
| 20:03 | gfredericks | well |
| 20:03 | gfredericks | all metadata is maps |
| 20:03 | gfredericks | and there's a syntax for maps |
| 20:03 | gfredericks | and also some special case syntaxes for common cases |
| 20:03 | gfredericks | A) keywords, for setting {:foo true} |
| 20:03 | arrdem | ,(meta ^{:tag 1} 'foo) |
| 20:03 | clojurebot | nil |
| 20:03 | gfredericks | B) symbols/strings, for setting {:tag foo} |
| 20:04 | gfredericks | my guess is that B) is intended to be just for type hints, which only require symbols and strings |
| 20:04 | bbloom | ,(meta ^{:tag 1} (quote foo)) |
| 20:04 | clojurebot | nil |
| 20:04 | bhauman | dnolen: I updated the page http://rigsomelight.com/checkmemleak/index.html#comp-partial |
| 20:04 | bbloom | ,(meta (quote ^{:tag 1} foo)) |
| 20:04 | clojurebot | {:tag 1} |
| 20:04 | arrdem | bbloom: oh okay. I see the distinction. |
| 20:05 | bbloom | arrdem: awesome :-) |
| 20:05 | bbloom | arrdem: nah, metadata has some weirdness. threw me for a loop a few times |
| 20:05 | dnolen | bhauman: excellent thanks |
| 20:05 | bbloom | arrdem: i enjoy this too: |
| 20:05 | x^2 | ,(read-string "test") |
| 20:06 | bbloom | ,(identity ^{:foo (print 1)} {:bar (print 2)}) |
| 20:06 | clojurebot | test |
| 20:06 | clojurebot | 21{:bar nil} |
| 20:06 | bbloom | gets compiled to a with-meta call |
| 20:06 | arrdem | bbloom: side effects are no fair :P |
| 20:06 | bbloom | but... look at the argument order: |
| 20:06 | bbloom | (doc with-meta) |
| 20:06 | clojurebot | "([obj m]); Returns an object of the same type and value as obj, with map m as its metadata." |
| 20:06 | bbloom | swapped! d'oh |
| 20:07 | arrdem | bbloom: oh. that's great :D |
| 20:07 | akurilin | Gotta say, getting used to comp makes for some really elegant solutions |
| 20:08 | noonian | here's my workaround using multimethods for not being able to dispatch protocols on other protocols, i'd appreciate any feedback on how nasty this approach is: https://www.refheap.com/26817 |
| 20:11 | x^2 | hey all, i am just getting started with Clojure. General opinions on the O'Reilly book? |
| 20:11 | x^2 | i am slowly working my way through it now |
| 20:11 | technomancy | x^2: it's good! |
| 20:11 | x^2 | :) |
| 20:11 | x^2 | great |
| 20:11 | x^2 | i am still at the beginning but this all seems very cool, I am new to lisp besides topical experience w/ scheme. |
| 20:12 | x^2 | i like the 'code is data' concept, it seems so interesting! |
| 20:12 | bbloom | topical as in you know some stuff about lispy ideas like homoiconic? |
| 20:12 | bbloom | or tropical, like you played with it on a beach one time? |
| 20:12 | akurilin | Joy of Clojure 2nd ed should be almost done, too bad it's a bit advanced. |
| 20:12 | x^2 | hahaha |
| 20:12 | akurilin | Don't know what the next most recent book would be. |
| 20:12 | x^2 | topical as in, i've written some basic programs in it |
| 20:13 | akurilin | yogthos' book on building web apps is cool if you intend on doing that at some point |
| 20:13 | x^2 | and i just read the part in this o'reilly book about homoiconic languages like clojure |
| 20:13 | RickInAtlanta | akurilin what is yogthos' book? |
| 20:13 | noonian | is that clojure in action? |
| 20:15 | brehaut | web programmign with clojure or similar |
| 20:15 | akurilin | web development with clojure |
| 20:15 | RickInAtlanta | wow, cool. I missed that one |
| 20:15 | RickInAtlanta | http://pragprog.com/book/dswdcloj/web-development-with-clojure |
| 20:16 | akurilin | For me it was useful as a confirmation of the fact that I was doing my ring apps sufficiently idiomatically |
| 20:16 | akurilin | so it's good for cherry-picking some ideas here and there |
| 20:16 | akurilin | The first time you write your first ring app, it's going to be pretty darn fugly |
| 20:17 | akurilin | I think the next growth phase is starting to piggyback everything on top of the request and response maps. Not sure if there's phase 3, unless it's "Switch to Haskell". |
| 20:19 | arrdem | akurilin: haskell pushing isn't allowed until 2am UTC, but bitemyapp is usually happy to oblige. |
| 20:19 | akurilin | arrdem: I was just reinvigorating a recent #clojure meme. |
| 20:20 | technomancy | akurilin: error response codes in an ex-info |
| 20:20 | technomancy | it'll change your life |
| 20:20 | akurilin | technomancy: right now I even dump exceptions into the response and bubble them up to the appropriate logger middleware |
| 20:20 | akurilin | technomancy: I'll investigate the ex-info |
| 20:26 | akurilin | technomancy: what's the use case for ex-info? Is it to completely replace user-thrown generic java exceptions with a more clojure-friendly convenient wrapper? |
| 20:28 | technomancy | akurilin: right; you can throw (ex-info "not allowed" {:code 401}) |
| 20:28 | technomancy | catch it in a middleware and turn it into a response map |
| 20:28 | technomancy | no need to therad it through all the intermediate functions |
| 20:28 | akurilin | Like a fancy goto :) |
| 20:29 | akurilin | I remember having this dilemma a while ago where I was trying to decide if I should use exceptions for flow control and for some reason I decided not to do that, I think because flow readability and predictability felt somewhat decreased. |
| 20:30 | technomancy | no, like call/cc =D |
| 20:31 | akurilin | Interesting, never heard of that before, absolutely no lisp xp outside of clj. |
| 20:31 | akurilin | I often wonder if I'm missing out. |
| 20:32 | turbofail | meh. call/cc is better for making puzzles than for actual usage |
| 20:32 | technomancy | not particularly |
| 20:32 | akurilin | Then I think of Haskell. (I had to, come on) |
| 20:32 | turbofail | you're not missing much |
| 20:32 | technomancy | akurilin: "readability and predictably felt somewhat decreased" is basically a perfect description of call/cc =) |
| 20:33 | akurilin | technomancy: I used to do REST input validation with exceptions + middleware at one point, that sucked terribly. |
| 20:34 | mmitchell | akurilin: i went down that same path actually, and decided instead that exceptions are for exceptional events only. I ended up doing something like this instead: http://adambard.com/blog/acceptable-error-handling-in-clojure/ |
| 20:34 | akurilin | Ended up with a monad approach like what mmitchell listed. |
| 20:35 | akurilin | I actually have 3 steps when request is handled: 1. validate input with Mississippi, 2. validate authorization of operation / relational stuff 3. perform operation, listen for SQL exceptions. |
| 20:35 | technomancy | sure, input validations are different from access control and the like |
| 20:35 | akurilin | With short circuiting at the first 2 |
| 20:36 | technomancy | exceptions for 401 and 403 are pretty reasonable IMO |
| 20:37 | akurilin | In my case that happens in step 2., I just end processing at that point and return a corresponding response map. |
| 20:37 | akurilin | I can see how one's situation might be a bit more complex though. |
| 20:38 | akurilin | Actually that makes me think that I might want to completely decouple ACL checking into its own middleware. Is that how people do it? |
| 20:38 | akurilin | Doesn't sound too trivial with a few roles and dozens of different routes. |
| 20:39 | bbloom | akurilin: are you stuck with traditional ACLs? |
| 20:39 | bbloom | like a giant back of user/object/permissions triples? |
| 20:39 | bbloom | b/c imo, that is no fun. |
| 20:39 | bbloom | s/back/bag/ |
| 20:40 | akurilin | bbloom: at this point I've yet to implement that. I have 4 roles: super admin, admin, group owner, user, each owning a hierarchical subset of the data. I need to figure out how to sanely support that. |
| 20:40 | akurilin | bbloom: what's a non-traditional ACL? |
| 20:41 | bbloom | akurilin: something closer to https://github.com/ryanb/cancan |
| 20:42 | bbloom | akurilin: essentially, you have a first class notion of an "ability" which is a thing that can check it's own authorization |
| 20:42 | bbloom | akurilin: https://github.com/ryanb/cancan/wiki/defining-abilities shows how they allow both procedural ability checking, but also relational so that it can aid in sql query generation |
| 20:43 | akurilin | This is going to be one hell of a project. |
| 20:43 | bbloom | akurilin: i think cancan is worth studying. it's my least hated approach to doing authentication |
| 20:44 | bbloom | what's your database tech? |
| 20:44 | akurilin | bbloom: yeah so it sounds like there are two concepts here: what actions the current authenticated role is authorized for, and what rows that specific agent has access to for those actions. |
| 20:44 | akurilin | bbloom: PG. |
| 20:45 | bbloom | akurilin: ah, cool a non-terrible database :-) if you're not afraid of stored procs and views and such, you can also do virtual ACLs |
| 20:45 | bbloom | where you define a view that executes business logic and generates the list of all possible ACLs and you join against that |
| 20:45 | akurilin | I'm honestly not comfortable enough with stored procs. |
| 20:46 | akurilin | I know at some point if you're enterprisey enough you can't get away with it, but oh well. |
| 20:46 | bbloom | heh |
| 20:47 | bbloom | basically, stored procedures are in this weird sweet spot where adding them makes your app faster b/c the db does extra work w/o having to send stuff down to the app.... then they start to hurt you b/c you have too many simultaneous users banging on the database |
| 20:47 | akurilin | So basically cancan does sql join generation as opposed to you yourself defining ACL tables and using those, right? |
| 20:47 | bbloom | one of the major awesome bits about datomic is that it basically lets you do databasy things in your own process as if you were writing stored procedures w/o the contention problem |
| 20:47 | akurilin | As in, they're all still joins, derp. |
| 20:48 | akurilin | bbloom: honestly I just don't want to migrate more than I need, nor debug / test sql functions, I'd rather keep all the nasty parts somewhere where I can contain it. |
| 20:48 | xuser | bbloom: how is the performance with PG as a data store? |
| 20:48 | bbloom | yeah, cancan takes a nested map where nested maps represent relationships, keys with values in them represent attribute equality |
| 20:48 | bbloom | xuser: postgres is a much much much better database than mysql |
| 20:49 | bbloom | xuser: but it's actually a database |
| 20:49 | bbloom | xuser: not an durable index or anything low level like that :-P |
| 20:49 | xuser | bbloom: I mean, how is the performance of datomic when using pgsql as a datastore |
| 20:49 | bbloom | oh, i have no idea |
| 20:49 | bbloom | i haven't used datomic for real work yet |
| 20:49 | bbloom | i think riak is the current favorite backend |
| 20:50 | bbloom | akurilin: that's kinda the whole activerecord philosophy. i'm over it. i've seen the datomic light :-) |
| 20:50 | xuser | datomic+pgsql vs raw pgsql would be a nice benchmark, to see if it lags behind to much |
| 20:50 | bbloom | akurilin: i want to my real programming language and bang on local data, not manage round trips to the db |
| 20:54 | akurilin | I hear you. I'd love to never have to do this again. |
| 20:54 | akurilin | Guess we're slowly getting there. |
| 20:55 | akurilin | I actually quite enjoy working with PG as long as I don't have to write any sprocs or try to enable plugins etc. |
| 20:56 | bbloom | yeah, psql is much preferable to any other SQL db i've worked with |
| 20:57 | akurilin | Some people seem to enjoy writing sprocs in JS for it, I've never tried though |
| 20:57 | akurilin | maybe I'll dig it |
| 20:57 | RickInAtlanta | can datomic use pg as a back end? |
| 20:57 | akurilin | but I'd still rather not spread myself too thin, got neough work to do in the web app |
| 21:02 | RickInAtlanta | sanity check, I have a seq that contains files, and a function that uploads a passed file. I want doseq, not map to upload my files, right? |
| 21:02 | test__ | Why the last command throw error, sholdn't it be the same as the second command? user=> (defn rule [x] (< (:test x) 10)) #'user/rule user=> (rule {:test 4}) true user=> (def rule [ {:rule (fn[x] (< (:test x) 10))}]) #'user/rule user=> ((:rule rule) {:test 4}) NullPointerException user/eval1896 (form-init1279335614049396589.clj:1) |
| 21:03 | rhg135 | RickInAtlanta: yup |
| 21:03 | RickInAtlanta | thx |
| 21:03 | arrdem | ,(doc cond->) |
| 21:03 | clojurebot | "([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression." |
| 21:05 | hyPiRion | test__: the last is a vector with a map, but I think you wanted a direct map instead |
| 21:05 | hyPiRion | It should work fine if you remove the `[]`s |
| 21:16 | test__ | thx |
| 21:17 | test__ | but why the second failed with the fist is good for the following:user=> (map (fn[alert] (filter-alert-by-rules rules alert)) (take 2 result)) ([4000001455 [3 4 6]] [4000003167 [3 4 6]]) user=> (map (fn[alert] (filter-alert-by-rules rules alert)) result) NullPointerException [trace missing] user=> (class result) clojure.lang.LazySeq user=> (class (take 10 result)) clojure.lang.LazySeq user=> |
| 21:18 | test__ | result is from a jdbc result: (def result (query db ["select * from dbo.table"])) |
| 21:34 | quizdr | what is the most elegant/idiomatic way to add an element to the end of a list? cons and conj both add to the beginning. i'd like to avoid loop/recur if possible. |
| 21:35 | egghead | quizdr: i think the most idiomatic way is to use a vector |
| 21:35 | egghead | since lists are optimized for prepend and vectors are optimized for append |
| 21:35 | egghead | and then its just a matter of using 'conj' |
| 21:36 | tmciver | conj adds to the end of a vector |
| 21:36 | egghead | and the beginning of a list |
| 21:38 | quizdr | and is I needed a list in the end just (apply list ...) to make it a list? |
| 21:38 | quizdr | or i suppose I could just use conj and then reverse in the end |
| 21:38 | quizdr | if i was working on a list, that is |
| 21:38 | akhudek | quizdr: you could, but if you already have a vector, why would you want a list? |
| 21:39 | egghead | quizdr: why would you need a list in the end btw? |
| 21:39 | quizdr | i don't already have a vector, i have a list and need to return a list |
| 21:39 | bbloom | and if you really just want something () shaped instead of [] shaped, you can get a seq in constant time |
| 21:39 | egghead | ,(= [:a :b :c] '(:a :b :c)) |
| 21:39 | clojurebot | true |
| 21:40 | bbloom | ,(= (conj [:a :b :c] :x) (conj '(:a :b :c) :x)) |
| 21:40 | clojurebot | false |
| 21:40 | egghead | ^ |
| 21:41 | egghead | quizdr: in my experience I rarely need to think about vector or list, and use vectors almost everywhere |
| 21:41 | quizdr | i have a list, not a vector, need to add to the end, and return the list, not return the vector. |
| 21:41 | quizdr | i could then just reverse it, I suppose, and use conj |
| 21:41 | quizdr | that is, use conj first, then reverse it. |
| 21:41 | alew | do you care about performance here? |
| 21:42 | quizdr | not at the moment. i'm appending one by one to a list |
| 21:42 | egghead | quizdr: if your goal is to append you should be using a vector instead of a list |
| 21:42 | akhudek | can you not just change the list to a vector? |
| 21:43 | quizdr | i realize that, but I am receiving a list from another codebase that is not my own, I could just call vec on it and then proceed with conj, perhaps is best approach? |
| 21:43 | egghead | ,(concat '(:a :b :c) '(:d)) |
| 21:43 | clojurebot | (:a :b :c :d) |
| 21:43 | alew | do they care that it is a list? |
| 21:44 | luser0 | they? the linkage gnomes? |
| 21:44 | egghead | there are a lot of ways to do it ofc |
| 21:44 | quizdr | concat is an interesting idea |
| 21:44 | egghead | constructing a whole new vector out of the list isn't going to be much better than using something like concat |
| 21:44 | alew | luser0: maybe they are relying on it to be a list to conj to the front |
| 21:48 | egghead | okay now that I have this om app rendering regular state over ajax polls, let's try to see about propagating browser event handlers back into the mix |
| 21:52 | egghead | does anyone know of a cljs lib that gives you something like an atom that persists to localstorage? |
| 21:53 | egghead | i wonder if that would be useable with om |
| 21:54 | bbloom | egghead: how hard could that possibly be to write? |
| 21:54 | brehaut | egghead: im not sure if that would need to be a seperate ref type; you could jsut hook watch right? |
| 21:55 | egghead | bbloom: not hard at all |
| 21:55 | alandipert | egghead: https://github.com/alandipert/storage-atom and yes it's very simple |
| 21:55 | bbloom | egghead: isn't it just localstorage.whateverTheWriteApi('some-key', (pr-str @db)) |
| 21:55 | bbloom | forgive my mixed javascript & clojurescript syntax |
| 21:55 | egghead | alandipert: you rule |
| 21:55 | bbloom | (inc alandipert) ; correctly trimmed of whitespace |
| 21:55 | lazybot | ⇒ 5 |
| 21:56 | dsrx | egghead: yes it exists oh and i was beaten |
| 21:56 | testclo | (def result (query db ["select * from dbo.table"])) |
| 21:56 | testclo | user=> (map (fn[alert] (filter-alert-by-rules rules alert)) (take 2 result)) |
| 21:56 | testclo | ([4000001455 [3 4 6]] [4000003167 [3 4 6]]) |
| 21:56 | testclo | why the following failed? |
| 21:56 | testclo | user=> (map (fn[alert] (filter-alert-by-rules rules alert)) result) |
| 21:56 | testclo | NullPointerException [trace missing] |
| 21:56 | testclo | user=> (class result) |
| 21:56 | testclo | clojure.lang.LazySeq |
| 21:56 | testclo | user=> (class (take 10 result)) |
| 21:56 | testclo | clojure.lang.LazySeq |
| 21:57 | testclo | user=> (class (first result)) |
| 21:57 | testclo | |
| 21:57 | testclo | clojure.lang.PersistentHashMap |
| 21:58 | dsrx | testclo: please use a pastebin like http://www.refheap.com/ rather than pasting long blocks of text directly in the channel |
| 21:59 | egghead | lol alandipert i'll have to make this use cljson :) |
| 22:00 | alandipert | egghead: you should, would be much faster to read |
| 22:00 | alandipert | egghead: but you know that already :-) any cljson glitches so far? |
| 22:01 | egghead | nope all parses smoothly and runs lightweight, thanks for making cljs a better place :p |
| 22:11 | testclo | |
| 22:11 | testclo | Thx, I just used refheap, and pasted again below |
| 22:11 | testclo | (def result (query db ["select * from dbo.table"])) |
| 22:11 | testclo | user=> (map (fn[alert] (filter-alert-by-rules rules alert)) (take 2 result)) |
| 22:11 | testclo | ([4000001455 [3 4 6]] [4000003167 [3 4 6]]) |
| 22:11 | testclo | why the following failed? |
| 22:11 | testclo | user=> (map (fn[alert] (filter-alert-by-rules rules alert)) result) |
| 22:11 | testclo | NullPointerException [trace missing] |
| 22:11 | testclo | user=> (class result) |
| 22:11 | testclo | clojure.lang.LazySeq |
| 22:11 | testclo | user=> (class (take 10 result)) |
| 22:11 | testclo | clojure.lang.LazySeq |
| 22:11 | testclo | user=>(class (first result)) |
| 22:11 | testclo | clojure.lang.PersistentHashMap |
| 22:11 | testclo | but looks like it still doesn't work for refheap |
| 22:13 | seubert | please stop |
| 22:17 | mmitchell | anyone commonly use clojure.core/delay? |
| 22:23 | ddellacosta | testclo: use https://www.refheap.com or https://gist.github.com for your samples or you are going to irritate people, and additionally, not get the help you need. |
| 22:24 | ddellacosta | testclo: that means, *don't* paste into IRC, paste into refheap or whatnot and put that link into IRC, if that's not clear. |
| 22:26 | egghead | alandipert: https://github.com/alandipert/storage-atom/pull/1 |
| 22:29 | alandipert | egghead: sweet, thanks! |
| 22:31 | dsrx | presumably that will break compat for anyone who was storing things previously |
| 22:32 | egghead | dsrx: :O you're right |
| 22:33 | egghead | wow alandipert enduro looks really nify too |
| 22:34 | alandipert | egghead: it might benefit from cljson too, i suspect cheshire might be faster than clj reader |
| 22:35 | bbloom | i haven't benchmarked it. is clj reader particularly slow? |
| 22:36 | alandipert | i dunno, but reading json might be faster |
| 22:36 | bbloom | why? they are both LL(1), right? |
| 22:37 | bbloom | sorry ignore me, brain is slowing down :-P |
| 22:37 | bbloom | surely the clj reader is slower b/c it does a bunch of computational-ish stuff rather than just parsing |
| 22:38 | bbloom | that said, i suspect an edn reader can be made every bit as fast as a json reader |
| 22:38 | hiredman | someone should go do that |
| 22:38 | egghead | well it's a native implementation of a json parser vs a js parser |
| 22:39 | egghead | not that the cljs reader isn't a good reader or performant but it does have to parse strings using js instead of c++ or w/e |
| 22:40 | bbloom | double duh. good point :-P |
| 22:41 | dsrx | egghead: using savagely optimized js you mean |
| 22:41 | egghead | ya dsrx |
| 22:41 | dsrx | JS is faster than C++, that's why nodeos is the future |
| 22:41 | egghead | asm.js |
| 22:41 | bbloom | i used asm.js to compile hello world and it was like 100k |
| 22:41 | egghead | loool |
| 22:42 | bbloom | er i mean emscripten |
| 22:42 | rurumate_ | I'm sorry but http://www.youtube.com/watch?v=bzkRVzciAZg |
| 22:42 | bbloom | i didn't bother to try google closure compressing it |
| 22:42 | dsrx | it's sort of nuts that emscripten works as well as it does |
| 22:43 | bbloom | rurumate_: ROFL the switch from pleasantries to fork stabbing got me good |
| 22:44 | bbloom | "you may recall sequential code, that's the code you can read" |
| 22:50 | ddellacosta | "I could have sworn you just said lisp" |
| 22:51 | rurumate_ | umm, how does a project with one file (README.md) have almost 1000 stars on github |
| 22:51 | rovar | have you seen the readme? it's amazing |
| 22:52 | hiredman | people are interested in the edn spec |
| 22:55 | rurumate_ | hiredman, huh? |
| 22:56 | hiredman | the edn spec repo is the repo at the top of my mind that is a single README.me |
| 22:56 | hiredman | md |
| 22:56 | rurumate_ | oh, ok |
| 22:56 | hiredman | I guess it only has 613 stars |
| 22:57 | rurumate_ | no I was talking about nodeos, the repo that contains the actual code has <100 stars it seems |
| 22:57 | guest1234 | does anyone have a well-structured Ring / Compojure app (that isn't Luminus..) ? Bonus if it has clean, informed clojurescript.. thanks |
| 22:58 | rovar | guest1234: the chord project has a sample app that is very basic with some nice extras (browser repl) I have been using the dacom template with success. |
| 22:58 | dsrx | rurumate_: the weird thing about those videos is that the creator has opinions like that mysql is a good choice for a sql database or that php is a solid web language |
| 22:59 | rurumate_ | maybe the creator is just making videos from scripts he gets from other people? |
| 22:59 | guest1234 | rovar: yeah, looking at chord. didn't know about dacom. thanks |
| 22:59 | guest1234 | somewhat of a n00b. trying to find 'good' examples of how to do things 'correctly' |
| 23:00 | guest1234 | I must've been out to lunch. Didn't know clojure existed til a few months ago... Wish I'd discovered it sooner. |
| 23:01 | rurumate_ | guest1234: if you want to write clean clojurescript, have a look at core.async |
| 23:01 | rurumate_ | that'll allow you to get rid of all the callbacks |
| 23:01 | technomancy | guest1234: no cljs, but I am somewhat proud of https://github.com/technomancy/syme |
| 23:02 | guest1234 | yeah, I watched David N.'s talk |
| 23:02 | guest1234 | man, he's good. |
| 23:02 | egghead | cool alandipert just added this new version of storage-atom to my project and it's working like a charm |
| 23:03 | rurumate_ | also sometimes it's a good idea to gather your state in an atom, then write a render function and bind it to the state vie add-watch |
| 23:03 | dsrx | this one is also very good http://www.youtube.com/watch?v=bzkRVzciAZg |
| 23:03 | dsrx | (Erlang The Movie II: The Sequel) |
| 23:03 | alandipert | egghead: terrific! |
| 23:06 | tmciver | dsrx: same link as the first. |
| 23:06 | guest1234 | technomancy: thanks. looking through syme... |
| 23:06 | rurumate_ | but I also found it hard to write large apps with many "views" in clojurescript |
| 23:07 | alandipert | egghead: i pushed 1.1.2 |
| 23:07 | rurumate_ | especially the "routing" part, and hiccup / dommy as a template engine has its limitations |
| 23:07 | dsrx | tmciver: oops, http://www.youtube.com/watch?v=rRbY3TMUcgQ |
| 23:08 | guest1234 | technomany: so you certainly don't have to set up routes in their own folder, 'refer' to them. (defroutes ...) all over the place. I'm running into issues that I'm certain are from poor code structure |
| 23:09 | egghead | thx alandipert, already added my dep on it :) |
| 23:11 | ddellacosta | guest1234: things are changing a lot--I think what a well structured Clojure + CLJS web app is has changed even in the past few months (for example, consider Om and what that brings to the table). Just something to keep in mind as you review different Clojure web apps. |
| 23:12 | guest1234 | ddellacosta: yeah. that's what I'm gathering. I'm not proficient enough yet to differenciate 'good' from 'mediocre' |
| 23:12 | ddellacosta | guest1234: and I would also argue that the app itself determines, to some extent, the structure of the codebase--on some apps having separate folders for routes is useful, in others I've had just a few routes in one file with a lot of message passing via web sockets/browserchannel + core.async. |
| 23:12 | guest1234 | or what's obsolete.. |
| 23:12 | ddellacosta | guest1234: unfortunately, I'm not sure there's much to do, at the present time, other than to do what you're doing--review a bunch of different apps and try to develop your own sense of what is good and what is an anti-pattern. |
| 23:12 | egghead | there are a lot of cljs frameworks/libs sprouting lately |
| 23:13 | guest1234 | ddellacosta: is any example of the latter on git? |
| 23:13 | egghead | ya just look at my repos |
| 23:13 | egghead | :p |
| 23:13 | ddellacosta | guest1234: er, hmm...don't have a good one that is open-source that I can point you to, I'm sorry. :-( |
| 23:14 | ddellacosta | guest1234: I would definitely take a look at pedestal, and go through dnolen's posts--he has helped shape the direction a lot of development is going, at least in terms of ClojureScript and front-end patterns (which has implications for how the back-end is structured)> |
| 23:15 | ddellacosta | guest1234: and I suggest pedestal because it represents a very specific approach that is useful to understand, not because it is the be-all-end-all or the best approach for all apps. |
| 23:15 | ddellacosta | FRP web app in Clojure, more or less. |
| 23:16 | guest1234 | ddellacosta: sure. will look more deeply at pedestal codebase. |
| 23:16 | guest1234 | is Caribou on par? inferior? or is that asking flame war. |
| 23:16 | egghead | there is also http://hoplon.io/ |
| 23:16 | guest1234 | "different" |
| 23:16 | ddellacosta | guest1234: yeah, just getting a sense of the flow of a pedestal app is probably good--the codebase itself is kinda tough to get through without a sense of how the app itself works first. |
| 23:16 | ddellacosta | yah, I still have to dig into hoplon...been neglecting it. |
| 23:17 | ddellacosta | Caribou seems to be more traditional, in the sense that you could probably use Caribou to get a CRUD app out quickly in a similar fashion to Rails or Django |
| 23:17 | ddellacosta | guest1234: but yeah, Caribou is worth examining too. I think the codebase is pretty clean and easy to grok, what I've read of it. |
| 23:18 | egghead | i've always leaned toward building my own stack since the libraries are all so modular |
| 23:18 | ddellacosta | guest1234: I think the main lesson is that there is no one approach in Clojure/ClojureScript for web application development (which is a good thing). |
| 23:18 | guest1234 | ddellacosta: first "need" is a fairly simple app - almost just one page w a bunch of dynamic updates. |
| 23:18 | guest1234 | a few routes... |
| 23:19 | ddellacosta | guest1234: in that case, I definitely would suggest checking out dnolen's posts on core.async and Om to start: http://swannodette.github.io |
| 23:19 | ddellacosta | guest1234: and then just copy some of the stuff from compojure, enough to get some routes up and running: https://github.com/weavejester/compojure/wiki |
| 23:20 | ddellacosta | ...others may have different suggestions for where to start, but that would be my take. |
| 23:20 | rovar | is there any way in LightTable to get the paredit ctrl-right/left behavior? |
| 23:20 | egghead | i have the source for this lil' om+compojure app up on github http://162.243.146.235:3000/ |
| 23:21 | ddellacosta | egghead: nice |
| 23:21 | guest1234 | ddellacosta: no. this is great. been investigating these, on my own. while learning syntax. just haven't had any 'curation' on best practices or patterns.. |
| 23:21 | egghead | guest1234: go through clojurescript 101 and the om tutorial by dnolen |
| 23:22 | ddellacosta | guest1234: it's tough. There is just so much out there, and it's moving so fast (in a good direction). But it's tough to wrap your head around as someone just coming in. I want to work on improving the documentation situation...I'm working on it. |
| 23:22 | ddellacosta | guest1234: actually talking to you is giving me some good ideas. Maybe it's time for a post on general approaches to architecture in Clojure web apps, similar to my dom lib survey...hmm |
| 23:23 | guest1234 | egghead: that's nice. what's your git name |
| 23:23 | egghead | guest1234: https://github.com/eggsby/warden still have a lot to do before it's ready to use tho :p |
| 23:23 | michaniskin | guest1234: feel free to join us in #hoplon if you have questions about it |
| 23:23 | guest1234 | is it like, you use Om, on its own.. or cljs with Selmer and EnFocus... ? |
| 23:24 | guest1234 | I guess either... just different approaches. both valid in their own context |
| 23:25 | guest1234 | michaniskin: thanks. I'll dig through hoplon as well. |
| 23:25 | ddellacosta | guest1234: yeah, part of it is really just trying out things and seeing what seems more mature, what fits your use-case, etc. There is not really a "this is the best" in Clojure-land, in my opinion. What is great is that there are a lot of excellent options out there. |
| 23:25 | egghead | guest1234: om is just representing the dom as trees so there are plenty of ways to manipulate those trees |
| 23:26 | ddellacosta | okay, I gotta get back to work...good luck guest1234, ping #clojure any time w/questions |
| 23:26 | guest1234 | yeah, is it really just new so prominent patterns have yet to emerge from battle testing production code.. |
| 23:26 | akurilin | Lein profiles question: is there a super-profile that I can set settings on and have them be overridden by the various dev/test/uberjar profiles? |
| 23:27 | guest1234 | the way that 'most' of the problems of django / rails / etc ... got fixed? (as best as those languages would allow ... |
| 23:27 | akurilin | Trying to set a default value on an env parameter in one single place. |
| 23:27 | dsrx | akurilin: there's the :user profile https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#declaring-profiles |
| 23:27 | egghead | guest1234: people are bringing over the lessons learned from those environments tho |
| 23:28 | egghead | compojure is basically sinatra, ring is basically rack/wsgi |
| 23:28 | egghead | of course superior because clj |
| 23:28 | akurilin | dsrx: do you know if dev will correctly merge with user? |
| 23:29 | guest1234 | egghead: right. |
| 23:29 | ddellacosta | guest1234, egghead : yeah, it's important to note that for most projects with a server-side component ring is always used...maybe the one lib that is universal in clojure web apps |
| 23:29 | ddellacosta | and on that note, I'm really leaving now |
| 23:29 | dsrx | akurilin: "The dev profile takes precedence over user by default." |
| 23:29 | guest1234 | ddellacosta: thanks! |
| 23:29 | ddellacosta | guest1234: cheers! :-) |
| 23:30 | akurilin | dsrx: care sharing where you're seeing those instructions? The giant readme sample profile? |
| 23:30 | dsrx | akurilin: I linked to the doc/PROFILES.md document above |
| 23:31 | dsrx | it's in the next section though |
| 23:31 | dsrx | "Merging" |
| 23:32 | akurilin | dsrx: oh sorry, I totally snoozed through that link, my bad. |
| 23:32 | akurilin | Long day :) |
| 23:32 | dsrx | np, I feel you |
| 23:34 | quizdr | did I see someone say a bit ago that js is faster than c++? is that right? |
| 23:35 | dsrx | quizdr: i was joking (but this is a thing some people believe) |
| 23:35 | guest1234 | "faster" to get stuff done. sure. |
| 23:35 | akurilin | dsrx: So ok, dev takes precedence over user, can the same be said for uberjar and test? |
| 23:35 | quizdr | dsrx ok i couldn't imagine that to be true |
| 23:35 | dsrx | http://stackoverflow.com/questions/17036059/javascript-is-4-times-faster-than-c lol |
| 23:36 | bbloom | the top answer is entertainingly polite |
| 23:36 | xuser | sure js could be faster than c++, depends on the implementation ;) |
| 23:58 | deadghost | is it weird I want to be friends with clojure |
| 23:58 | deadghost | like "bro, let's do some bro things together, BRO" |
| 23:59 | xuser | is he a being a good bro? |
| 23:59 | deadghost | clojure is my best bro |
| 23:59 | deadghost | all functional and shit |