#clojure logs

2014-01-23

00:00ddellacostatutysara: 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:01ddellacostatutysara: 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:03tutysaraddellacosta: 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:04akurilintechnomancy, sm0ke: partial + apply comp did the trick, thanks!
00:04ddellacostatutysara: right, I do remember doing that explicitly
00:06ddellacostatutysara: I don't remember explicitly, but I suspect it was security related, to make it harder to forge that value
00:08tutysaraddellacosta: 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:09ddellacostatutysara: what do you mean? Is there a reason you want to change it?
00:09ddellacostatutysara: I'm not sure what you want me to email you about.
00:12tutysaraddellacosta: 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:12ddellacostatutysara: already, if I remember I will...
00:12ddellacosta*alright
00:12ddellacosta(not already)
00:13tutysaraddellacosta: ok sure :)
00:13ddellacostatutysara: 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:14tutysaraddellacosta: :)
00:14ddellacostatutysara: 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:16tutysaraddellacosta: 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:16ddellacostatutysara: yeah, that just sounds like a bug. :-) Definitely file issues/pull requests for anything like this you find--that is the best way.
00:25tutysaraddellacosta: 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:26ddellacostatutysara: I'm trying to figure out what the spec says first, if it says anything
00:28tutysaraddellacosta: sure
00:31ddellacostatutysara: 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:36ddellacostatutysara: 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:37ddellacostatutysara: it looks like an error message should be appended in the response that can be checked.
00:38ddellacostatutysara: again, I'll take care of this as soon as I can, but won't be able to deal with it right away.
00:41tutysaraddellacosta: okie, np, may I create an issue to track this
00:41ddellacostatutysara: yes, please do!
00:41ddellacostatutysara: thanks
00:42tutysaraddellacosta: thanks again for your time :)
00:42ddellacostatutysara: thank you for using this library, and working through these issues--you are helping make this a better library!
00:47quizdrddellacosta i see you have a library for helping with google app engine, is that right?
00:48quizdri'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:48ddellacostaquizdr: and clojure? no, that's not me, I...am not a fan of google app engine...heh
00:48ddellacostaquizdr: I can say that heroku is going to be a *much* easier deploy
00:48quizdroh i was looking at this: https://github.com/ddellacosta/appengine-magic
00:48ddellacostaquizdr: ah, I probably forked it to give it a shot at some point. This is the original: https://github.com/gcv/appengine-magic
00:49ddellacostaquizdr: 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:49ddellacostaquizdr: that said, maybe worth giving it a shot yourself.
00:49quizdrright ok, i thought maybe you'd used it. i wish it was easier setting up and deploying clojure on various systems.
00:50ddellacostaquizdr: 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:51ddellacostaquizdr: Those are the most common ones that I know of for Clojure web apps.
00:51quizdri wish i could figure out Linode but I just don't have the background or patience
00:52ddellacostaquizdr: 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:52quizdrno i'm not much of a sys admin at all
00:53ddellacostaquizdr: well, it's one way to learn. ;-)
00:53quizdryour 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:54ddellacostaquizdr: 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:54ddellacostaquizdr: yeah, exactly--it's totally a money/time equation.
00:54ddellacostaquizdr: 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:55quizdrwhich of your libraries were you discussing before?
00:55ddellacostaquizdr: oh, that was friend-oauth2, tutysara is using it and has been finding some issues that we're trying to nail
00:55quizdryou are in tokyo is that right?
00:56ddellacostaquizdr: yep.
00:57quizdrthat would explain why you're always in here at this time of day!
00:57ddellacostaa haha, yeah--same as Singapore, huh?
00:57quizdri've been meeting to hop over tokyo one of these days, i hear great things about it
00:58ddellacostaquizdr: nice having more folks in Asia on here. :-)
00:58quizdri agree
00:58ddellacostaquizdr: yeah, come on by. I love Japan, but I'm biasd.
00:58ddellacosta*biased
00:59quizdrman, 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:59ddellacostaquizdr: 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:00ddellacostaquizdr: my personal favorite is tsukemen, especially tonkotsu
01:00quizdrthere 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:00quizdrthere are several varieties of tonkotsu here, in fact i had some last night!
01:03ddellacostaquizdr: nice...love the tonkotsu. :-)
01:04ddellacostaquizdr: 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:05quizdryeah i couldn't live without indian food
01:05quizdrin fact i chose to live in the Little India part of town
01:15n0n0hey
01:15n0n0what is a close match to ipython for clojure?
01:27tpopeambrosebs: didn't even know you were a vim user
01:28ambrosebstpope: :)
01:28xusertpope: you never gave emacs + evil a try?
01:29tpopeget out your jump to conclusions mat, xuser is ready to play!
01:30tpopeyeah I've played with it. there's still a huge emacs learning curve to get over
01:30ambrosebstpope: I can actually work sanely now on Typed CLJS. Type checker in CLJ, checking CLJS code.
01:30ambrosebstpope: loving it.
01:30tpopethat's awesome
01:33ambrosebsis there some way to combine :require and :require-macros now in CLJS?
01:33ambrosebsbeen a few months since I looked.
01:35safetyambrosebs: hi
01:35ambrosebssafety: hello
01:35safetyi'm a perth developer, didn't know you were based here
01:36safetyis there much clojure going on at uwa?
01:36ambrosebssafety: oh cool! Never met anyone using clojure in WA.
01:37safetyhaha me either. but i'm very much a noob, poking at the edges.
01:37safetywhat are you studying at uwa? i graduated from there about 10 yrs ago.
01:38ambrosebssafety: I've graduated with Bach CS honours
01:38safetyah ok, i see your dissertation on indiegogo
01:39xusertpope: was curious, I know your vimmer by heart ;)
01:39xusers/your/you'r/
01:41dsrxambrosebs: you can do something like (:require [foo.bar :as bar :include-macros true])
01:44ambrosebsdsrx: I remember something like that. wouldnt' include-macros be a map though?
01:44ambrosebsor a vector
01:45ambrosebsthis seemed to work: (:require [cljs.core.typed :refer-macros [ann check-ns]])
01:45alandipertambrosebs: https://github.com/clojure/clojurescript/commit/de6ee41b3b0e26020e01b409f97e513bce87456d
01:45ambrosebscool!
01:46ambrosebsalandipert: do I need :include-macros as well?
01:47alandipertambrosebs: i don't think so
01:47ambrosebsalandipert: ah got it. thanks :)
01:49quizdr,(split-with fn? '(#() 4 5 6)
01:49clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
01:49quizdr(split-with fn? '(#() 4 5 6))
01:49quizdr,(split-with fn? '(#() 4 5 6))
01:49clojurebot[() ((fn* [] ()) 4 5 6)]
01:49quizdrshouldn't the first split include the function?
01:51ambrosebs,(doc split-with)
01:51clojurebot"([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]"
01:51ambrosebs,(fn> '#())
01:51clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: fn> in this context, compiling:(NO_SOURCE_PATH:0:0)>
01:51ambrosebs,(fn? '#())
01:51clojurebotfalse
01:52quizdrah ,should have used a vector not a list
01:53quizdr(inc ambrosebs)
01:53lazybot⇒ 3
01:58arrdem(inc ambrosebs) ;; this man does not belong in the low karma club
01:58lazybot⇒ 4
02:00quizdr(inc arrdem)
02:00lazybot⇒ 16
02:00quizdri agree, and neither do you :)
02:00quizdr(if 16 is considered "low")
02:02arrdemquizdr: 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:17dsrxi can think of one very serious outlier =)
02:18TEttinger$karma TEttinger
02:18lazybotTEttinger has karma 13.
02:18TEttingerhow's that get there???
02:18lazybotTEttinger: How could that be wrong?
02:18dsrx$karma rhickey
02:18lazybotrhickey has karma 2.
02:18TEttingerhaha what how!
02:18dsrx$karma lazybot
02:18lazybotlazybot has karma 19.
02:19dsrx$karma clojurebot
02:19lazybotclojurebot has karma 32.
02:19TEttingerheh
02:21stirfoois there a standard way to initialize a defrecord from a map?
02:23stirfooI did something like (def make-foo ([m] (apply make-foo (map #(% m) [:x :y :z]))) ([x y z] (Foo. x y z)))
02:25stirfoodefn, not def
02:27dsrx,(defrecord Foo)
02:27clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/defrecord>
02:27dsrx,(defrecord Foo [x y z])
02:27clojurebotsandbox.Foo
02:27dsrx,(map->Foo {:x 1, :y 2, :z 3})
02:27clojurebot#sandbox.Foo{:x 1, :y 2, :z 3}
02:27dsrxstirfoo: ^
02:27logic_prog_why does >! on a closed channel succeed?
02:27stirfooah, thanks dsrx
02:28sm0ke$karma sm0ke
02:28lazybotsm0ke has karma 0.
02:28sm0keheh i guess i cannot increment for myself
02:28sm0ke(inc sm0ke)
02:28lazybotYou can't adjust your own karma.
02:28logic_prog_(inc logic_prog)
02:28lazybot⇒ 3
02:28logic_progyay
02:29logic_prog_but anyway, why does >! on a closed channel succeed?
02:29sm0ke(dec logic_prog)
02:29lazybot⇒ 2
02:29sm0keoh nice
02:29logic_prog_(inc sm0ke)
02:29lazybot⇒ 1
02:29sm0ke(* 100 logic_prog)
02:29dsrxstirfoo: np
02:31juxovecI 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:32logic_prog_why why why does >! on a closed channel not throw some type of error?
02:34eredlogic_prog_: on that note do you know any way to tell if a channel is closed
02:34ered?
02:35logic_prog_yes
02:35logic_prog_@(.-closed chan)
02:35eredah, thanks
02:35logic_prog_but there can be a race condition if I check then do a >!
02:35eredi want to do closed then a <!
02:36ered(so check if it's closed, if it's not then take from it)
02:36eredwill that cause a race condition?
02:36logic_prog_yeah
02:36eredoh
02:36logic_prog_any time you do (test) /// shit can happen (action)
02:36logic_prog_then, /// shit can happen <-- ths can cause a race condition
02:36eredi'm okay with it doing a little extra work
02:37eredjust that when it's closed at some point it will terminate before clearing out the channel
02:37logic_prog_well
02:37logic_prog_the problem is I need to make sure the work is done
02:37eredah
02:37logic_prog_so if it's pushed to a closed channel, it vanishes
02:37logic_prog_and I think the work is done, but hte work is not done
02:37eredin my case when any of them has done the work once it's fine
02:38logic_prog_who cares about your case? I want my case to work! :-)
02:38logic_prog_ered: how do you ensure that _someone_ has done the work?
02:39logic_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:39eredbecause when someone has done the work, it closes the source channel
02:39dsrxlogic_prog_: make another channel in the other direction?
02:46juxovecit was connection pooling, I put all things to (transaction ) and it was okay
03:30quizdron 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:31fredyrisn't that a pre-condition validator?
03:31quizdri don't know, what's that?
03:31fredyrhttp://clojure.org/special_forms#toc10
03:31clojurebotI don't understand.
03:32quizdrit's okay clojurebot, i don't either
03:33sm0keany cascalog user still awake?
03:33fredyr,(defn constrained-sqr [x] {:pre [(pos? x)] :post [(> % 16), (< % 225)]} (* x x))
03:33clojurebot#'sandbox/constrained-sqr
03:33fredyr,(constrained-sqr -1)
03:33clojurebot#<AssertionError java.lang.AssertionError: Assert failed: (pos? x)>
03:33quizdrah ok fredyr i get it
03:33fredyr:)
03:34quizdr(inc fredyr)
03:34lazybot⇒ 1
03:34fredyrwee
03:34quizdr1?! what the? that's a TRAVESTY !
03:34fredyrlol
03:34fredyrfirst time
03:34TEttinger(inc fredyr)
03:34lazybot⇒ 2
03:34fredyr:D
04:14fredyrshould've stayed at one
04:14fredyrkilled the entire channel
04:16TEttingerha
04:49ddellacostawhoops, I'm mixing my P.O.V.
04:49fredyr:)
04:49ddellacosta:-D
04:56tim_Hi, do many clojure devs use gradle instead of lein?
04:57TEttingertim_, all I can say is I use lein, but I know that clojars only fairly recently started supporting gradle
04:59tim_Thanks.
05:04clgvtim_: for "many" I'd say no. maybe "few" ;)
05:05tim_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:19fredyrmost definitely to get into the clojure way of doing things at least
05:20fredyrand for that example i would say its a good idea to use the clojure versions
05:20tim_ok, thanks.
05:21tim_Do you find yourself using much java in your own clojure projects?
05:22fredyrin general i would say that the interop is very good, so you usually don't need to wrap alot of the java projects
05:23fredyri've been doing mostly clojurescript lately, so im not the right person to ask
05:23fredyrbut previously i've used apache camel for example directly from clojure
05:24tim_Cheers.
05:28ddellacostatim_: 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:28ddellacostatim_: 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:30tim_Thanks for the advice.
05:31clgvtim_: 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:31AeroNotixThere'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:31AeroNotixI generally write it first directly using the Java interop and then write a lil' wrapper to make it nicer.
05:32AeroNotixlike, ctors take maps/kwargs and either call the ctor or use (doto) forms
05:32AeroNotixor w/e
05:32clgvAeroNotix: well the wrapper should add additional advantages otherwise it is a waste of time ;)
05:33AeroNotixclgv: sure, default args for a start
06:03AeroNotixanyone doing anything with paypal in clojure?
06:03AeroNotix(and authorize.net for that matter)
06:03AeroNotixmy latest project is using both for work, I'm hoping to open source my auth.net bindings
06:04hitekihi
06:05fredyrhiteki: hello there
06:06hitekifredyr: :)
06:12rurumateIs 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:17rurumatein 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:17clgvrurumate: 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:18rurumateclgv: thanks, I hope my second comment makes it clear?
06:18clgvrurumate: I know that there was at least one release plugin which had to increment the version number in the project.clj
06:19rurumateor maybe there is some trick with macros to achieve the same thing?
06:20rurumateclgv: I don't want to change things in project.clj itself, rather do some replacements somewhere below etc/
06:21rurumateit's a common thing to do, right?
06:21clgvrurumate: 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:22clgvrurumate: 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:28ivo163server irc.azzurra.org
06:37sm0ke(inc tpope)
06:37lazybot⇒ 2
06:37sm0ke(inc tpope)
06:37lazybot⇒ 3
06:37sm0ke(inc tpope)
06:37lazybot⇒ 4
06:37sm0keheh i just feel grateful
06:38quizdrsweet sm0ke
06:38sm0keyea man
06:38quizdr(inc sm0ke)
06:38lazybot⇒ 2
06:38sm0keyou should try fireplace sometimes
06:39sm0ke(inc quizdr)
06:39lazybot⇒ 2
06:39sm0kelol
06:39quizdri like a good fireplace, but i suspect I'm thinking of something different
06:39fredyrvim fireplace?
06:39sm0keobviously not a vimmer quizdr
06:39quizdri'm not a vimmer, no.
06:39quizdremacs here.
06:39sm0keok
06:40oskarkvobviously you're not a golfer
06:40sm0kevim golfer
06:40quizdrha ha, i can't even lift a bowling ball oskarkv
06:40oskarkv:)
06:40sm0kewtf does emacs stand for anyways?
06:40oskarkveditor macros
06:40oskarkvi think
06:40sm0kelawl
06:41quizdrsomeone asked that in the emacs channel and there were a ton of answers
06:41quizdrjust yesterday or maybe earlier today, can't remember
06:41quizdri use vi for quick one-off edits here and there, though I have started forcing myself to use emacs for those also.
06:43fredyrevil mode ftw
06:44sm0kei hear this evil mode a lot
06:44sm0kei think its kind of uncool
06:44sm0keeither use vim or emacs
06:44fredyrlol
06:44fredyrgreat argument
06:44fredyr:D
06:45sm0kei am serious
06:45fredyrim not getting into that :)
06:45fredyranyways lunch time
06:45sm0keyea map, just jump boats
06:45sm0keman*
06:46sm0kefredyr: have a good one
06:46fredyrty
06:46sm0kehmm i feel hungry now
06:46sm0kethere was this bullshit all over hn about soylent
06:46sm0kewhat happened did someone die?
06:46sm0kelol
06:47quizdrwhat is evil mode??
06:47lazybotquizdr: Uh, no. Why would you even ask?
06:48quizdryikez lazybot!
06:48sm0keemacs + vi
06:48sm0keit should be called vimacs instead
06:49locksmy emacs complained the other day
06:49locks"don't use the arrows!!"
06:49alewHey man, vim and emacs learning curves too steep? try vim + emacs at the same time!
06:50scapelol
06:50hyPiRionlocks: Psh, no need for arrows: https://github.com/hyPiRion/emacs.d/blob/master/hypirion/hypirion-defuns.el#L7-L10
06:51lockslol xD
06:51sm0kepot
06:52alewhyPiRion: I was just about to go do something similar, except maybe add a save all files and quit function remapping
06:54sm0kei think clojure should have a patch to detect the ide user is using
06:54sm0keand refuse to run on emacs OR vim
06:54alewor maybe when you use the arrow keys, emacs sends a tweet out exclaiming your embarassing moment
06:55sm0keif *jure is banned so should be emacs
06:55sm0keor vim
06:55sm0kewhich one should be left to the commiter
06:56sm0keit enforces a simplicity in terms of dev environment
06:56sm0keeveryone would work on one, and it would be awesome, full of features
06:58algernonsm0ke: you just described emacs.
06:59sm0keyea emacs it is
07:00AeroNotixI use the arrow keys, don't tell me how to be productive.
07:01sm0keAeroNotix: use vim
07:02sm0keOne weird trick to make your dev experience 10X better --> read below
07:02sm0keVIM
07:02AeroNotixsm0ke: Are you a time traveller?
07:03sm0keAeroNotix: i can be
07:03AeroNotixsm0ke: because you seem to have an ancient internet argument in your hands there
07:03AeroNotixNo-one cares, it's not funny. Stahp.
07:05sm0keAeroNotix: haha you seem to care
07:05sm0kei am just killing time
07:06sm0keand what was that _ancient_ argument anyways?
07:06AeroNotixsm0ke: emacs vs vim
07:06sm0kehaha never gets old
07:07AeroNotixno, no, i assure you it does
07:09sm0kewell if you say so
07:09sm0kebut somehow when i am talking about vim, some emacs user pops up with evil mode suggestion
07:10sm0keso i think the problem lies with the emacs users
07:10sm0kewhich leads me to the conclusion that
07:11sm0keemacs user is like a confused teenager
07:11sm0keOR confused teenagers ARE emacs users
07:13fredyrwow, such editor very hostility
07:14quizdrvim 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:14sm0kedid it sound hostile?
07:14sm0kei didnt intend to be, sorry
07:14fredyrwas more a reference of the editor wars in general
07:16fredyr*reference to, even
07:16lockseverything is shit anyway
07:16locksin Haskell you make your own text edit…
07:16sm0kewell for clojure people emacs makes perfect sense, you write lisp with an editor that is configurable using lisp ( other)
07:17fredyrlol was gonna say you forgot `switch to haskell`
07:17sm0kebut really, it is no good unless emacs is written itself in clojure
07:17locksI use Light Table
07:17lockswhich is written in clojure
07:17sm0kelocks: makes sense
07:18RickInAtlantadoes Light Table have paredit?
07:18locksand moves easier to get started with
07:18locksRickInAtlanta: partially
07:18sm0keLight Table in fact in coming year could be the new emacs
07:18locksbut it doesn't come with preset bindings, I don't think
07:18lockswhich was confusing me
07:19locksRickInAtlanta: https://cloudup.com/cPjLzynZdsB
07:19RickInAtlantawe 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:20locksI found it very easy to get started with
07:20daGrevisI give +1 to Light Table
07:20locksI basically open a file > make current editor an instarepl
07:20RickInAtlantathx for the link. you can map bidnings to command?
07:20locksRickInAtlanta: yes, it's quite easy
07:21lockshttps://cloudup.com/cMjUPqZ07q1
07:21locksthe panel to the right is the command panel
07:21RickInAtlantaI 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:21lockssearch for remap, pop it open, add the bindings to the left
07:21RickInAtlantaprobably ctrl-space would have gotten me there
07:21locksoops, I actually meant to search for keymap
07:22locksI feel like the paredit plugin should come with default keybindings
07:24RickInAtlantawhat little I have used LT for, I like it. I just need to spend a little bit of time getting familiar with it.
07:25RickInAtlantaOh, 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:25locksclick on the popup
07:25RickInAtlantaah, I didn't know there was a popup
07:26locksby popup I mean the result overlay thingie
07:27RickInAtlantasweet, thanks!
07:28RickInAtlanta(inc locks)
07:28lazybot⇒ 1
07:28locks:}
07:29AeroNotixwith uberjar am I supposed to be able to drag and drop the jar onto another machine and it Just Work?
07:31ucbAeroNotix: allegedly yes
07:31AeroNotixhmm, ok
07:45daGrevisthis is how my LightTable looks, locks http://i.imgur.com/WQlleDq.jpg
07:47locksdaGrevis: my train is too hired to red = bad
07:48daGrevislocks, you're talking about def's?
07:48locksyeah
07:48daGreviswell, that's just base16 colors
07:48locksah
07:49locksI wonder what distro you're using ;P
07:49daGrevishttps://github.com/chriskempson/base16
07:49daGrevislocks, can't tell :D
08:07ior3kdaGrevis: is that xmobar?
08:10daGrevisior3k, y
08:11ior3kdaGrevis: sorry about insisting, are you using trayer as well, or does xmobar come with a notification area?
08:11daGrevisior3k, i'm also using trayer. i have no problems with answering :P https://github.com/daGrevis/Dotfiles
08:14ior3kdaGrevis: nice, thanks... it seems you're not running gnome, is that right?
08:22Morgawrmmm
08:22MorgawrI'm trying to use https://github.com/clojure/tools.cli/ this to parse some command line args
08:22Morgawrwhat I want to parse is --in-port <number>
08:23MorgawrI tried to change the "-p" "--port PORT" strings to "--in-port" "--in-port PORT" but it doesn't seem to be working
08:23Morgawrdoes anybody know how I should do it?
08:24daGrevisior3k, nop, i'm running xmonad
08:25ior3kdaGrevis: ok, thanks, I'm running xmonad as well, but inside gnome (flashback). Wondering if I should just ditch gnome.
08:27Morgawrwelp 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:27Morgawrno wonder the command line parsing library was reporting no args
08:27RickInAtlanta:)
08:29daGrevisMorgawr, it's fine, we all have done it
08:29MorgawrI do it way too often haha
08:30daGrevis“Grab your best pair of parentheses: you're about to embark on the journey of a lifetime!“
08:30RickInAtlantawoot, what is that from?
08:30daGrevishttp://www.braveclojure.com/
08:31RickInAtlantanice
08:37atomphilafternoon 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:38atomphilin the original (javascript) library the search text is processed and then stored in an object which is referenced as it's needed
08:39atomphilshould 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:41daGrevis“then we call that sequence a "seq" because it's shorter and hipper“
08:41daGrevislol
08:47fredyratomphil: you should use atoms for storing application state
08:48fredyratomphil: if you have processing steps, you want to just chain them together and not store any intermediate steps, unless you have to
08:49fredyratomphil: unlike javascript, where you usually pass around a mutable object to processing functions, and mutate them in place
08:52atomphilfredyr: 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:55fredyratomphil: not exactly sure how you mean
08:56fredyratomphil: but if it makes sense to store the processed result for re-use you should do it
08:57atomphilfredyr: 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:57fredyratomphil: atom's great for that
08:57fredyratomphil: i thought you were talking about storing intermediate steps in a chain of processing steps in an atom first
08:59fredyr*intermediate results
08:59atomphilfredyr: 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:59fredyratomphil: sure
09:32daGrevishwo can I add elem to the end of the list? conj and cons adds only to the beginning :(
09:33oskarkvthere is no efficient way to do it
09:33oskarkvmaybe you can use vectors instead?
09:35fredyr,(conj [1 2 3] 42)
09:36clojurebot[1 2 3 42]
09:36dnolendaGrevis: lists are not as common in Clojure, many cases are better served by vectors
09:36dnolendaGrevis: still you can do this with concat
09:36dnolen,(concat '(1 2 3) '(4))
09:36clojurebot(1 2 3 4)
09:39jonathanjthe 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:40jonathanjoh, this is the ePub document
09:43CookedGryphonDoes anybody have any hints on how I'd go about debugging the following core.async error? https://www.refheap.com/26763
09:43CookedGryphonno implementation of method :emit-instruction
09:44CookedGryphonthe change to cause it seems really rather innocuous
09:47fredyrCookedGryphon: nice error :)
09:47fredyrCookedGryphon: perhaps a refheap on the go-block causing it?
09:47emlynCookedGryphon: related? https://groups.google.com/forum/#!msg/clojure/JHCtPfn_zlc/ivkEaisZXYwJ
09:49fredyremlyn: nice find
09:51CookedGryphonfredyr: https://www.refheap.com/410b67708ec91c52d7c2c9c04
09:51daGrevisdnolen, thanks! sorry for delayed response
09:51daGrevisoskarkv, i would use vectors, but it's for educational purposes
09:52CookedGryphonemlyn: not sure how that would apply to my code...
09:52devnhahaha oh my god @ google adwords
09:52devnhttps://twitter.com/ztellman/status/426165699384311808
09:53devnclojure adwords for google
09:53devn"Clojure too Slow? One weird library that Rich Hickey doesn't want you to know about."
09:53Wild_Cat`"Enlarge your parentheses NOW!"
09:55Wild_Cat`seriously though, these are hilarious.
09:55llasramDid he really buy the ads, or just mock them up?
09:55llasramIf the former, I'd really like to see them in the wild :-)
09:55arcatanif you google "clojure slow"...
09:56Wild_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:56llasramNiiiiice
09:56llasramThat's amazing
10:06Wild_Cat`(and of course there'd be the Haskell verion: "5 arrow transformer transformer combinators that will blow your mind!")
10:09fredyrCookedGryphon: when do you get the error?
10:09fredyrCookedGryphon: at macroexpansion
10:09fredyr?
10:10CookedGryphondon't think so... one second
10:12CookedGryphonyeah, yeh it is
10:12fredyrwhich version of core.async are you running
10:12fredyrCookedGryphon: it expanded fine for me w/ the latest core.async
10:13CookedGryphon0.1.267.0-0d7780-alpha
10:13CookedGryphonokay, i'll grab the newest one and see what happens
10:13CookedGryphonoh, that's the one that's in the readme
10:13fredyrCookedGryphon: hmm that's the same version as you wrote
10:14CookedGryphonI wonder... I might try it on a vanilla jvm
10:14fredyrCookedGryphon: have you tried a manual macroexpand?
10:14CookedGryphonI'm doing this on androyd
10:14CookedGryphonandroid*
10:14fredyrCookedGryphon: oh
10:14CookedGryphonyeah
10:14fredyrand that one also fails?
10:14CookedGryphonthat explodes half way through
10:14fredyrright, it worked for me to macroexpand
10:14fredyrwasn't a pretty sight to look at though :)
10:15fredyrholy statemachine, batman
10:15fredyrCookedGryphon: clojure 1.5.1 btw
10:16CookedGryphonyup
10:25CookedGryphonfredyr: okay, I've narrowed it down some more to a single change between works and explodes
10:25CookedGryphonhttps://www.refheap.com/c4ed35d77e7512dcbbbaa5ef4
10:26CookedGryphonboth actually work for my purposes, but I still don't see why I shouldn't be able to do the other
10:26fredyrno diff running on ordinary jvm?
10:26CookedGryphonhaven't tried yet
10:27fredyrCookedGryphon: could def be the when binding
10:27fredyrsame as what emlyn linked to
10:28fredyrwhere the try catch was interleaved with the loop/recur pair
10:29fredyrCookedGryphon: i mean, it's easy to imagine a state machine transitioning to get confused in those cases
10:29maku_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:29maku_To Clarify, this happens when I try to connect to a clojurescript project through the LightTable nrepl
10:31CookedGryphonfredyr: hmmm, the code really looks like it should work though...
10:31`cbpmaku_: you might have more luck posting in the lighttable google group
10:32maku_`cbp: thanks, will do!
10:51hitekihi (again)
10:51fredyrhiteki: :)
10:52`cbp~hi
10:52clojurebotexcusez-moi
10:52fredyr~clojurebot
10:52clojurebotclojurebot is broken
10:52hitekiwow! a french talking bot...
10:52`cbphe curses in irish though
10:53hiteki:)
10:57tim_anyone able to get html file reloading working when using enlive and compojure?
11:09clgv~swing
11:09clojurebothttp://java.sun.com/docs/books/tutorial/uiswing/
11:14btcNeverSleepshey all... I've got a little question symbols (which implement IFn)
11:14btcNeverSleepsThe 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:14btcNeverSleepsfound at: From: http://clojure.org/data_structures
11:15btcNeverSleepsso ,(:a {:a 1} 42)
11:15btcNeverSleeps,(:a {:a 1} 42)
11:15clojurebot1
11:15btcNeverSleeps,(:b {:a 1} 42)
11:15clojurebot42
11:15btcNeverSleepswhich is fine
11:15btcNeverSleepsHowever...
11:15btcNeverSleeps,('a 1)
11:15clojurebotnil
11:16btcNeverSleepsand I do *really* fail to understand how '1' is a map here (the doc says that the argument is a map)
11:17arrdem,('shit-works {'shit-works 43} "oh noez")
11:17clojurebot43
11:17btcNeverSleepsarrdem: that is not my question at all
11:17`cbpbtcNeverSleeps: welcome to dynamic typing
11:17arrdem(inc `cbp)
11:17lazybot⇒ 3
11:17`cbp(when (map? x) do-stuff)
11:18btcNeverSleeps`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:19arrdembtcNeverSleeps: no it isn't because the compiler does no static typechecking. period.
11:19btcNeverSleepsarrdem: what does the compiler have to do with runtime execution?
11:19arrdemareyoukiddingme.jpg
11:19btcNeverSleepsarrdem: no I'm new to Clojure
11:20arrdem,('a 1)
11:20clojurebotnil
11:20btcNeverSleepsI 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:20arrdem,(:foo 1)
11:20clojurebotnil
11:20arrdemright. okay.
11:20btcNeverSleeps,(:foo 1 42) ; gonna return 42
11:20clojurebot42
11:22arrdembtcNeverSleeps: 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:22btcNeverSleepsfor example: (peek (seq [1]))
11:22btcNeverSleeps,(peek (seq [1])) ;; ain't gonna return 'nil'
11:22clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to clojure.lang.IPersistentStack>
11:24whilobtcNeverSleeps: 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:24whiloif 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:25xnilis there a function exactly like `map` that returns nil?
11:25arrdemxnil: what would the point of such a function be? side effects?
11:25xnilyes
11:25arrdemxnil: you need doseq. map is lazy.
11:26`cbpor just dorun after a map
11:26arrdem`cbp: wai u do dis to me...
11:26xnil`cbp: is the effect equivalent?
11:27AMrDanHi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ?
11:27`cbpxnil: dorun realizes the lazy seq, doesn´t retain the head and returns nil
11:28gfredericksI prefer doseq because it looks imperative and side-effecty
11:28xnilaha
11:28gfredericksalso more features
11:29sdegutisI agree with gfredericks, doseq communicates "this does side-effects and don't refactor it thinking it's supposed to be functional" very clearly.
11:29btcNeverSleeps(doc get
11:29clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
11:29btcNeverSleepserf, wrong Emacs buffer (and typo anyway)
11:30gfredericksclojurebot: (doc get is a type anyway
11:30clojurebotYou don't have to tell me twice.
11:30gfrederickshaha typo
11:30gfredericksa dvorak typo in particular
11:32xnildvorak typos are the most prestigious typo
11:32xnils
11:33gfrederickscolemak is even snootier
11:33btcNeverSleepsoh 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:35AMrDanHi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ?
11:36AMrDanHi everyone, how are you? :) Can somebody help me with the SQL tags "update" and "delete" with sqlite, please ?
11:36`cbpAMrDan: this is a clojure channel
11:37AMrDan`cbp, yes! I'm trying in clojure
11:37rhg135Clj, SQL booth decorative
11:38AMrDanI'm trying to access my database and update the rows with clojure, but I can't
11:39AMrDanI have the connection, but cannot update, just insert and select
11:40`cbpAMrDan: are you using jdbc?
11:40AMrDan`cbp, Yes
11:41`cbpAMrDan: more specificity please. Code paste + error shown
11:42AMrDanThis is the code i'm trying: (with-connection db
11:42AMrDan (with-query-results rs
11:42AMrDan [
11:42AMrDan (str "update table set name = 'newName' where id = '%" param "%'" )
11:42AMrDan ]
11:42AMrDan (doall rs)
11:42AMrDan )
11:42AMrDan
11:42arrdem~refheap
11:42`cbpby code paste i meant use gist or something similar
11:43gfredericksAMrDan: with-query-results is not for updating
11:43AMrDangfredericks, i'm new to this. Can you help me please?
11:44arrdemAMrDan: he seems to be helping already...
11:44AMrDan'CBP, sorry, i'm desperate! .. heheh
11:45AMrDangfredericks, what do I use for updating and delete tags?
11:45`cbpAMrDan: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#UPDATE
11:46AMrDan`cbp, I tryed this one,... nothing
11:46AMrDan`cbp, it uses with-connection-db too
11:48gfredericksAMrDan: you might take a look at what other functions are in the clojure.java.jdbc namespace; might give you some good guesses
11:48gfredericksdocstrings are helpful too
11:49tim_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:50AMrDangfredericks, like this page: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/delete! ?
11:50gfredericksAMrDan: this also looks helpful: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
11:50gfredericksAMrDan: yeah that page is good too
11:51gfrederickstim_: you could maybe add an :init handler in your project.clj to start the nrepl server
11:52tim_ok, i'll give it a go. I did try the lein-ring plugin's nrepl option, but no luck.
11:53gfredericksI haven't even heard of that option
11:54gfredericksI don't normally use lein-ring though
11:54gtraktim_: lein-ring takes a configuration option to that effect, I believe.
11:55gtrakreally, it's quite simple to just not use lein-ring.
11:56gtrakluminus has a repl namespace that might be helpful to you: https://github.com/yogthos/luminus/blob/master/src/luminus/repl.clj
11:56gtrakand it also uses lein-ring
11:56tim_I tried adding ' :nrepl {:start true :port 9000}' to my ring config, but nothing is printed and can't connect.
11:57Anderkenthave you tried drawbridge? (I don't have full context here, only saw last message)
11:57tim_not yet, although i've heard it mentioned. Currently using lien-ring plugin.
11:58gtrakI also don't like lein-ring's auto-reload namespaces feature. I'll re-eval my code as I damn well please.
11:58Anderkenti think it's :start-repl? and :repl-port not :start
11:58Anderkentbased on https://github.com/weavejester/lein-ring/pull/72
11:58tim_if only it would work with enlive html templates!
11:58Anderkentoh nevermind that was changed I guess
11:58Anderkentit's :start? though according to the readme
11:59Anderkentnot :start
11:59`cbptim_: use selmer and turn cache off :-D
11:59tim_selmer? not heard of that.
11:59`cbptim_: https://github.com/yogthos/Selmer
11:59gfredericksdid cider go back to naming its stuff nrepl-*?
12:00tim_thanks anderkent, missed the ? dope!
12:00justin_smithwhat is the protocol that one must implement for get to work on your datatype?
12:00`cbpIassociative?
12:00gfredericksILookup I think
12:00`cbpim just guessing
12:01gfredericks,(get (reify clojure.lang.ILookup (valAt [_ k] ["your key is" k])) :my-key)
12:01clojurebot["your key is" :my-key]
12:02gfredericks,(get 42 43)
12:02clojurebotnil
12:02gfredericksit "works" on any datatype :)
12:02gfredericks,(get (Object.) (Object.))
12:02clojurebotnil
12:02justin_smith,(get "hello" 1) ; yeah
12:02clojurebot\e
12:02justin_smithmy point is, how do you tell get what to do with your data for get to work
12:02AMrDangfredericks, 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:03gfredericksjustin_smith: ILookup, as above
12:03AMrDangfredericks, what might that be?
12:03gfredericksAMrDan: what version of java.jdbc are you getting?
12:03splunkanyone 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:03justin_smithgfredericks: cool - I was trying to get "satisfies?" to work, and it's just giving me NPEs
12:04AMrDangfredericks, 0.0.6 and for sqlite 3.7.2
12:04`cbpoh jebus
12:04gfredericksAMrDan: pretty old java.jdbc; I'm on 0.3.0-alpha4
12:05`cbpwhere you get that version? :P
12:05justin_smith,(satisfies? clojure.lang.ILookup "hello")
12:05clojurebot#<NullPointerException java.lang.NullPointerException>
12:05justin_smithwhat am I doing wrong there?
12:05AMrDangfredericks, i will update my version to get it working ..
12:05gfredericksjustin_smith: it's not a protocol
12:05btcNeverSleeps,(get 1 42)
12:05clojurebotnil
12:06gfredericks,(instance? clojure.lang.ILookup "hello")
12:06clojurebotfalse
12:06AMrDan`cbp, I looked up in the project.clj
12:06`cbpAMrDan: I know that. I meant how did you put it there in the first place
12:07justin_smithgfredericks: but get works on strings
12:07justin_smithwhat check would have told me that?
12:07justin_smith,(get "hello" 1)
12:07clojurebot\e
12:07gfredericksjustin_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:07AMrDan`cbp, oh yeah!! hhahahahah sorry, my teacher told me to... I don't know why.. :/
12:07gfredericksjustin_smith: what's your higher-level goal?
12:08justin_smithto understand how and when get will work
12:08mmitchellcan anyone recommend httpkit OR the clojure async client here? https://github.com/neotyk/http.async.client
12:08gfredericksjustin_smith: probably best to dig into the source then
12:08justin_smithand potentially to make things you can call get on
12:08gfredericksjustin_smith: that second part is just ILookup
12:08justin_smithhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ILookup.java
12:08gfredericksjustin_smith: my guess is somewhere in the source is a big conditional with all the special cases
12:08AMrDangfredericks, not working yet .. same error message
12:09gfredericksjustin_smith: look at the source for clojure.core/get and dig from there
12:09justin_smithgfredericks: yeah, good guess, maybe I will find it some day
12:09gfredericksAMrDan: you restarted your process?
12:09AMrDangfredericks, like, cancel lein and run again? yes
12:09gfredericksjustin_smith: usually you end up in RT.java after a step or two and it's not much more complex than that
12:09justin_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:09AMrDangfredericks, lein deps, lein run
12:09justin_smithoh, so I look in RT.java and find the def of get
12:09justin_smithgotcha
12:10gfredericksAMrDan: okay, clojure.java.jdbc/update! definitely exists for me
12:10gfredericksjustin_smith: well look at (source get) first to be sure you know where to look in RT.java
12:10gfredericksI hadn't looked yet, but it looks like it does just call RT.get immediately
12:10justin_smithhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L644
12:11justin_smith(inc gfredericks)
12:11lazybot⇒ 37
12:11justin_smiththanks for the help
12:11gfredericksnp
12:13gfredericksAMrDan: can you paste your code that's not working on refheap.com
12:13AMrDangfredericks, ok...
12:15clgvyou can use "LATEST" as version in maven? :P not that I would
12:16AMrDangfredericks, https://www.refheap.com/26781
12:16seangroveHrm, no powerline in emacs packages...
12:16`cbpclgv: you can give it ranges i think
12:16`cbpversion ranges
12:16clgv`cbp: no I saw a literal "LATEST" in a maven pom
12:16gfredericksAMrDan: j/update! doesn't work because you're not requiring java.jdbc in the same manner (:as j) that you reported earlier
12:17gfrederickssee line 3
12:17AMrDangfredericks, i have to take exclude off?
12:17`cbpclgv: oh apparently LATEST and RELEASE are valid versions
12:21gfredericksAMrDan: no I would just switch line 3 to be (:require [clojure.java.jdbc :as j]) instead of :use
12:24AMrDangfredericks, ok man .. its working, tks
12:24AMrDangfredericks, :D so much !!! :D
12:24`cbpAMrDan: If I may ask where are you learning clojure?
12:26AMrDan'CBP, college, but i'm not learning, just doing a research.. my teacher helps some times
12:26`cbpOh ok
12:27llasramOnly one research? I usually try to do at least a few at a time
12:27AMrDan'CBP, you are telling this because of the 0.0.6 ..heheheh that was really deprecated..
12:27AMrDan:(
12:28`cbpAMrDan: No, I just got curious because you mentioned a teacher. So I was imagining a clojure classroom
12:28llasramAMrDan: This Leiningen plugin may help with that in the future https://github.com/xsc/lein-ancient
12:28tangrammerHi folks! can anyone give me an advise on developing mobile apps (android and IOs) with clojure?
12:28tangrammerhttp://stackoverflow.com/questions/21313107/what-is-the-preferred-way-to-use-clojure-for-making-a-mobile-app-android-and-io
12:28`cbptangrammer: My advice would be don't
12:29AMrDanllasram, thanks so much ... :D
12:29tangrammer`cbp: thanks, but … why?
12:30dnolentangrammer: w/ iOS you'll have better luck with the JavaScriptCore bridge and ClojureScript
12:30dnolentangrammer: I've tried it works great and I know other people are experimenting with it as well
12:31`cbptangrammer: performance mostly. Android doesn't have a jvm
12:31dnolentangrammer: it does limit you to iOS 7, but you could take the Ejecta approach for earlier OSs
12:31dnolentangrammer: hopefully in the future Android has sensible trasnparent JS bindings as well
12:32tangrammerdnolen: thanks for your help with real case comments ! I'll document it on my os question
12:34tangrammer`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:36frank____test
12:36`cbpWell 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:38seangroveI think core.async + om ios app could be a lot of fun to play with
12:39seangroveMight be time to revisit Kevin's angular/cljs/ios post
12:41locksseangrove: interesting idea
12:41tangrammerseangrove: Hi Sean, have you tried it?… just wondering about core.async on iOS a few hours ago
12:41dnolentangrammer: core.async on iOS works great
12:41dnolentangrammer: you can also do multithreaded CLJS on iOS
12:42dnolenseangrove: how did the SF CLJS meetup go?
12:42seangroveIt's next Monday, on the 27th
12:43seangroveNext month will be on React/Om if you want to come visit ;)
12:43seangrovednolen: I assume you've submitted something for Clojure/West on Om?
12:45dnolenseangrove: yep submitted a talk
12:50hyPiRiongfredericks: you forked clojure itself?
12:50llasramawww
12:50technomancyoh snap
12:50rasmustooshi
12:51_oggyam i allowed to use Vars (i.e. a top-level def) in the same namespace with a gen-class?
12:51llasram_oggy: Yes, but you really shouldn't be using gen-class
12:51arrdemhyPiRion: loooool
12:51_oggyllarsam: what should i be using?
12:51llasram_oggy: Well, depends on what you're trying to do with it :-)
12:52_oggyllasram: i need to write a plugin for a java app, and i need a named class
12:52technomancythere are definitely interop scenarios that justify gen-class
12:52technomancylike that
12:52sdegutisAre there any forks of Clojure that compile to YARV bytecode yet?
12:52gfrederickshttps://github.com/fredericksgary/re-rand/commit/3cbf5931dcdf5b5fa50ab2c54eee27ce2771ea72
12:53hyPiRiongfredericks: wow, that's amazing
12:53llasram_oggy: Does the app need to construct instances of the named class itself?
12:53_oggyllasram: the Java app does
12:53gfrederickshyPiRion: I think he implemented his own rand-nth
12:53gfrederickswhich involves constructing an intermediate vector and calling it immediately
12:54gfredericksthese were truly the wild days
12:54hyPiRionhah, amazing
12:54sdegutisI just feel like we're missing out on major growth potential by not being able to integrate natively with Rails.
12:54lvhHello :)
12:54llasram_oggy: Ok. My preferred solution in that situation is to implement a tiny stub class in Java which calls the Clojure Java API
12:54technomancymeh
12:54technomancythere is nothing wrong with a gen-class
12:55llasram_oggy: That's essentially what gen-class does for you, but by doing it yourself "manually" avoids several issues with AOT
12:55gfredericksis there still no standard solution for a common java.util.Random instance? I'm starting to use https://github.com/fredericksgary/four
12:55lvhMy 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:55llasram_oggy: And can make it waaaay easier to get the Java interface exactly as necessary, especially if it involves annotations
12:55technomancysdegutis: there was a talk at the first clojurewest about doing that with jruby and how terrible it was
12:55llasramtechnomancy: But but -- you love avoiding AOT!
12:55lvhI'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:56technomancyllasram: just resolve at runtime
12:56_oggyllasram: interesting. do you have any reading pointers?
12:56technomancyI hate transitive AOT
12:56seangrovesdegutis: CircleCI tried that originally, worth talking to arohner and Paul Biggar if you get a chance
12:56technomancybut I also hate writing java
12:56sdegutis:(
12:56edbondhow to replicate this in clojure (splat)? (ruby) a = [1,2]; [3, *a, 4]; # => [3,1,2,4]
12:57hyPiRionlvh: http://keminglabs.com/c2/ should give you a visualisation library in ClojureScript
12:57sdegutisFirst and foremost, I'm sorry that I confused you guys, since I was joking.
12:57seangrovesdegutis: I just realized that arohner gave the talk technomancy mentioned
12:57llasramtechnomancy: 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:57llasrams,some Java code,some existing Java code,
12:57technomancyllasram: I mean in the gen-class method calling require+resolve
12:58technomancytot avoid having the AOT be transitive
12:58seangrovetrolled by sdegutis ....
12:58sdegutisBut secondly, it makes me feel funny inside knowing that it could be mistaken for serious.
12:58hyPiRionedbond: (let [a [1 2]] `[3 ~@a 4]) -- note, this is not good code in general, use (concat [3] a [4]) instead
12:58sdegutisLike, kind of sad. Kind of disillusioned. I don't know what to call it.
12:58llasramtechnomancy: Oh, I see what you mean. Still means AOTing all of clojure.core
12:58lvhhyPiRion: Cool, thanks!
12:58technomancysdegutis: don't worry; you weren't in danger of anyone actually thinking it was a good idea
12:58technomancyllasram: that's already AOT'd though
12:58sdegutisseangrove: I honestly wasn't trying to troll, just making a brief joke :)
12:58sdegutistechnomancy: :D
12:59llasramtechnomancy: Hmm, you may be right. There was some issue... Either way, it's some hoops to jump though, and
12:59technomancyllasram: but it does lock you to a specifc clojure version
12:59edbondhyPiRion, thanks, concat looks valid.
12:59sdegutisOh 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:59edbond,(inc hyPiRion)
12:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hyPiRion in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:59llasramI'd prefer to jump through the "tiny amount of Java" hoop
12:59technomancyllasram: I guess if you already are comfortable writing java it's not a big deal
12:59technomancycomes down to personal preference
12:59edbondhm, how to inc here? :)
12:59hyPiRionedbond: remove the `,`
12:59llasram_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:59edbond(inc hyPiRion)
12:59lazybot⇒ 31
13:00llasram_oggy: And rhickey did a lightning talk on it at one point
13:00hyPiRion,(+ 1 2) evaluated actual code:)
13:00clojurebot3
13:01_oggyllasram: thanks
13:01llasram_oggy: Ah, here we go: http://skillsmatter.com/podcast/scala/impromptu-rich-hickey-lightning-talk
13:02clgvgfredericks: I use java.util.random instances in a function closure and pass around the function since I need repeatability via seeds
13:02llasramtechnomancy: 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:05seangroveSometimes I listen to bbloom and I wonder how much I have to learn and improve before he stops sounding like a babbling madman
13:05gfredericksclgv: I'm thinking about making libs paramaterizable
13:05seangroveHe may be a prophet come before his time
13:06clgvgfredericks: what do you mean exactly?
13:06gfredericksclgv: e.g., this re-rand lib
13:06gfredericksit makes calls to clojure's random functions
13:07gfredericksso if I want to use it, I can't do so deterministically
13:07gfredericksthus 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:07gfredericksI don't know any good reason this capability shouldn't be in clojure.core itself, but I never hear anybody talking about it
13:08clgvgfredericks: you could easily alter-var-root the rand function in core if really needed ;)
13:08llasram~guards
13:08clojurebotSEIZE HIM!
13:08clgv:D
13:09gfredericksyeah :(
13:09llasramI mean, seriously. This isn't Ruby here.
13:10clgvI alter-var-root defn for debugging and profiling ;)
13:11llasramhuh
13:12clgvbut yeah that's dev-time only ;)
13:15`cbpyou wat
13:16Anderkentclgv: I read that as 'I alter-var-root the alter-var-root fn for debugging and profiling' at first, and was like woah.
13:17edbondcljs doesn't have ns-resolve and *ns*. How can I get def-ed var from string?
13:17clgvAnderkent: rofl. nice read :D
13:17llasramlocks: Yes?
13:17clgvAnderkent: you should definitely (defmacro defmacro ...) ;)
13:18llasramedbond: You can't. They aren't reified -> available at runtime
13:18bbloomseangrove: i assume you're referring to my om/state email :-)
13:19bbloomseangrove: i tried not to assume "all readers are inside my brain". happy to elaborate/clarify where necessary
13:19edbondllasram, is there any way to get variable from string?
13:20`cbptimbre has a defmacro inside a defmacro i thought that was the craziest thing i've seen at the time
13:20sdegutisAnyone want to hear a riddle I made up?
13:20sdegutisI told it to my wife and kids the other day, and they seemed to like it.
13:20locksllasram: one more word about Ruby… :P
13:20s4muelHey 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:20lockssdegutis: is it about bees
13:20sdegutislocks: shh nobody else here heard it
13:20technomancys4muel: lazy seq of lines, I'd say. maybe line-seq.
13:21bbloomseangrove: but yeah, the "babbling madman" phenomenon is exceedingly common in my experience
13:21llasramedbond: 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:21bbloomseangrove: 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:22seangrovebbloom: 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:22bbloomseangrove: i am honored to have achieved the rank of "babbling madman.... worth listening to"
13:23seangrovebbloom: Well, keep it up, it's likely only the second half will change any time soon
13:25bbloomseangrove: 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:27clgv`cbp: I have a Meta-DSL to create a DSL of a certain type which also uses defmacros inside defmacro ;)
13:28`cbpWell I'm pretty proud that revise has only a single macro :-p
13:29eyepatchJust 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:29clgvrevise?
13:29`cbpclojure rethinkdb driver
13:29eyepatchIt's giving the a runtime error that I don't seem to be able tor ead.
13:29eyepatch*to read
13:29arrdem`cbp: theres a macro in there? I didn't see one...
13:29arrdemall the fns...
13:29`cbparrdem: it's the lambda macroç
13:29`cbpmacro even
13:30aperiodiceyepatch: 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:31riley526eyepatch: you probably want to map mult-3-or-5? over your vector of numbers
13:32aperiodiceyepatch: also the vec is unnecessary; take-while will turn it into a seq and produce a seq
13:32RickInAtlantadon't think take-while will give the behaviour you want
13:32aperiodicriley526: aww, don't give everything away, guys, eyepatch just wants help with the runtime error
13:32gfredericksbbloom: 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:32eyepatchI thought that take-while would do that.
13:32aperiodic,(doc take-while)
13:32clojurebot"([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
13:32riley526aperiodic: woops, my bad. at least I didn't write it out.
13:32riley526heh
13:33bbloomgfredericks: 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:33bbloomgfredericks: another example is a Customer class that knows it's Orders and the Order class knows it's customers
13:34gfredericksah ha
13:34eyepatchoh, yeah, take-while isn't what I want. I thought that map transformed the vector, which isn't what I want either.
13:34eyepatchThe simplest form of this would be to drop the elements for which pred is false.
13:35bbloomgfredericks: 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:35aperiodiceyepatch: yes, the functions that do that sort of thing are filter and remove
13:35gfredericksbbloom: sense made
13:35gfredericksbbloom: thanks
13:35RickInAtlantaeyepatch I think the brackets [] around your range are going to cause you a problem too
13:36RickInAtlanta,(take-while even? (range 10))
13:36clojurebot(0)
13:37radsbbloom: I just joined the channel but that sounds interesting. could you link me to the talk you're referring to?
13:37bbloomrads: http://www.hakkalabs.co/articles/clojure-software-dendrology
13:38radsty
13:38eyepatchThat all helped.
13:38RickInAtlantadid you get it working?
13:39eyepatchYes.
13:39RickInAtlantanice
13:40eyepatchWell, I'm impressed by the final code.
13:50gfredericks,(->> (range 10) (remove #(zero? (* (rem % 5) (rem % 3)))))
13:50clojurebot(1 2 4 7 8)
13:53mharjuHi! 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?&lt;load-of-crap&gt;
13:53guest1234code 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:53mharjuhttp://localhost:9000/?xpc=&lt;xxx&gt;
13:54`cbpguest1234: you can look at the luminus template
13:54mharjuthe 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`cbpguest1234: http://www.luminusweb.net/
13:55guest1234`cbp: thanks. looking at http://www.luminusweb.net/docs/routes.md
14:02mharjuI 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:05mharjuBTW, just to verify, you don't need auth to be able to be heard in here? :)
14:05RickInAtlantaI can hear you :)
14:05mharjuRickInAtlanta: Thanks, just a sanity check :)
14:05RickInAtlantaI, however, have no idea how help :)
14:06dobry-denI 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:07dobry-denIt seems heavy and backward (although simple) to do it on the read side
14:08dobry-denFor 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:14arrdemdobry-den: you could build such a system, but really all you do is increase net system load.
14:15arrdemdobry-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:17dobry-denarrdem: that's a good point. at least an unlucky user doesn't need to pay the toll.
14:17arrdemdobry-den: with some probability a user doesn't pay the toll.
14:18dobry-denarrdem: what do you mean?
14:18arrdemdobry-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:19xnilI'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:20arrdemdobry-den: technically its (/ swap-duration cache-lifetime)
14:20xnilI'd appreciate if someone could have a look and see if they see something wrong
14:22dobry-denarrdem: 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:23dobry-deneven worse isn't it every read that happens during the recomputation?
14:24arrdemfor that particular definition of an atom based cach I would agree with your assessment.
14:25dobry-denarrdem: i'm really naive here. how would you get around this then if your reads are responsible for recomputing the cache?
14:26sdegutisI think Julia just saved my Clojure IDE.
14:28`cbpwat
14:28sdegutis`cbp: Julia the language.
14:28sdegutishttp://julialang.org/
14:29Raynessdegutis: Elaborate!
14:29sdegutisThe 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:29arrdemdobry-den: sorry had to restart emacs there...
14:30arrdemdobry-den: I'm gonna reserve judgement on this cache implementation. Given ibdknox's rep there's probably something we're missing here.
14:30sdegutisMy new plan is to rewrite them in Julia itself, which will be embedded in the app, which makes scripting much saner.
14:30arrdem:P
14:30bbloomJulia is quite nice as a Python replacement in my mind
14:31`cbpsaner compared to clojure?
14:31sdegutisThe 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:31sdegutis`cbp: Swing ruined the Clojure route for me.
14:31dobry-denarrdem: how would you get around this issue if your reads are responsible for recomputing the cache?
14:32arrdemdobry-den: I think the trick here is that the (fn []) which may do the recomputing is run in an ordered transaction queue.
14:32`cbpsdegutis: is there a repo up somewhere? :D
14:32sdegutis`cbp: of what?
14:32`cbpsdegutis: your IDE
14:32sdegutis`cbp: yeah, one sec
14:32arrdemdobry-den: so while other reads will be blocked, only one "person" (client/transaction) will actually do the recompute work
14:33arrdemdobry-den: everyone else just has to wait in line, which they would anyway for a read I believe.
14:33sdegutis`cbp: but be warned, it's slightly-broken and I don't use it (mainly for the aforementioned reasons)
14:34`cbpsdegutis: okies
14:34sdegutis`cbp: https://github.com/sdegutis/Leviathan is the latest ObjC version
14:35sdegutisI 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:37sdegutis`cbp: you on a mac?
14:37`cbpsdegutis: i need to make a desktop app too and didn't like swing. I chose cljs + node-webkit though
14:37`cbpsdegutis: yeah
14:37arrdemdobry-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:37sdegutis`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`cbpsdegutis: looking forward to a first build :-D
14:43arrdemdobry-den: okay. atoms are entirely unordered/unsynchronized besides using the Java system atomic reference.
14:43sdegutis`cbp: hmm?
14:43arrdemdobry-den: it was agents which did transaction ordering.
14:44`cbpsdegutis: whenever you release it
14:44sdegutis`cbp: Leviathan?
14:44`cbpsdegutis: yeah
14:44sdegutisYou can already use it right now. It's just missing conveniences that I won't work without.
14:44`cbpsdegutis: I'll try it out this weekend then
14:45sdegutisk
14:50gfrederickssomehow upgrading cider made things 10x more buggy
14:50sdegutisI have a rule that I never ever upgrade anything that's in ~/.init.el
14:50gfredericksI wish I knew how to track versions better
14:51BronsaI'm still using slime.
14:51Bronsagfredericks: I use git submodules && freeze the libs at safe commits
14:51arrdemBronsa: heh
14:51sdegutisI'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`cbpIt always sounds like it's not worth to go from nrepl to cider :P
14:51`cbpwhat's the difference?
14:51technomancygfredericks: melpa?
14:51Bronsasdegutis: yeah. I don't think I'll ever upgrade magit again.
14:52sdegutistechnomancy: I've since changed my mind and agree with you on Melpa. I just wish Marmalade had more packages.
14:52arrdemI would discuss my various emacs package pains, but I don't want to jinx my currently stable setup :P
14:52technomancysdegutis: it used to be you could just M-x marmalade-upload-buffer and it would work
14:53gfrederickstechnomancy: yeah I use melpa I just don't know how to put a version in the init.el
14:53technomancywhich made it really easy to convince maintainers to publish to marmalade
14:53sdegutistechnomancy: that seems fragile tho
14:53technomancygfredericks: I don't know if you can. that's why I don't use melpa.
14:53sdegutislast time I checked you can't
14:53gfrederickstechnomancy: oh okay; what do I want to use?
14:53gfrederickshaskell?
14:53clojurebothaskell is for beardy awesome people
14:53technomancygfredericks: marmalade
14:54sdegutissee https://github.com/milkypostman/melpa/issues/7
14:54sdegutisHeh someone in #proglangdesign spoke highly of Haskell the other day, and convinced me that the arity-duplication problem (zipWith3, etc) is rarely encountered.
14:58gfrederickstechnomancy: okay actually I am using marmalade?
14:58gfredericksbased on my package-archives
14:58gfredericksare we talking about the software that downloads packages or the remote public repository?
14:59gfredericksI have no idea what I'm talking about emacs is so confusing
15:01gfredericksbundle install marmalade --via leiningen
15:01sdegutisgfredericks: like all good things, it takes time and energy to learn and become proficient and angry at it.
15:01arrdemmainly angry....
15:01sdegutisyes.
15:01gfredericksemacs: at least it's not vim
15:02sdegutissome days i seriously think of going back to vim. then the pain in my pinky goes away and im fine again.
15:03marcopol_gfredericks: vim users have a similar slogan...
15:04tos9(except instead of pinkies it involves vimscript and concurrency)
15:05mmitchellIs anyone using http-kit? Looks pretty awesome, but tempted to stick with what I've worked with in the past (clojure async/netty).
15:06clgvdid someone export graphs to GEXF with clojure, yet?
15:08clgvhmm well it's xml so any XML library should do, I guess
15:09maravillasmmitchell: i played with it a little last night and got a websocket connection running with chord in no time
15:09maravillasvery straightforward
15:09maravillasthat's the extent of my experience with it, though
15:09mmitchellmaravillas: cool, so using the server then?
15:09eggheadchord is cool
15:10mmitchellWhat's chord
15:10mmitchell?
15:10mmitchellgoogling...
15:10eggheadwebsocket clj<->cljs lib
15:10mmitchelloh nice
15:10maravillas"using" is a strong word :) just playing around with it so far
15:10mmitchellthanks, good to know
15:10maravillashttp://github.com/james-henderson/chord
15:10eggheadChord gave me credit even though I didn't contribute to the project, feels good
15:12dsrxis it reasonable to use chord on the server side w/ a different websocket impl on the client?
15:14seangroveUhg, trying to get clojurescript.test and om/react working together, not fun
15:14seangrovenoprompt figured it out a few days ago, hope he pops in soon
15:15gfredericks,((fn some-sets [] (set (repeatedly (rand-int 3) some-sets))))
15:15clojurebot#{#{}}
15:15gfredericks,((fn some-sets [] (set (repeatedly (rand-int 4) some-sets))))
15:15clojurebot#{}
15:15gfredericks,((fn some-sets [] (set (repeatedly (rand-int 4) some-sets))))
15:15clojurebot#<StackOverflowError java.lang.StackOverflowError>
15:18dsrxoh, i should probably just use http-kit for my thing
15:24reiddrapergfredericks: nice. hoping the test.check migration is imminent, which should speed up development again
15:25gfredericksreiddraper: w00t
15:27hyPiRion(inc reiddraper)
15:27lazybot⇒ 2
15:28gfredericksevery time I look at this function I have to consider reiddraper's shame for introducing a cyclic dependency
15:28reiddrapergfredericks: ha, you can actually blame cemerick for that one ;)
15:29gfredericksyou mean I've been considering the wrong person's shame this whole time??!
15:29gfredericksthis is super awkward
15:29reiddraperI approved the patch, so I'm not without shame too...
15:29gfredericksphew
15:30reiddraperso 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:30gfrederickshaha I love watching test frameworks run their tests: FAIL in (this-is-supposed-to-fail) (clojure_test.clj:9)
15:31gfredericksleiningen has something similar I think?
15:32seangroveAnyone have cljsbuild running tests automatically on recompile?
15:33hyPiRiongfredericks: the good old "failure-expected-here-dont-freak-out"? :)
15:33seangroveRight now ~40s turnaround on compilation + tests is pretty horrific
15:33pjstadigseangrove: https://github.com/jakemcc/lein-test-refresh
15:34gfrederickshyPiRion: ah yeah that one
15:34hyPiRionloving https://github.com/technomancy/leiningen/blob/master/test_projects/sample_failing/src/nom/nom/nom.clj
15:34seangrovepjstadig: Hrm, not sure this will work well with clojurescript.test
15:35gfredericksI guess that squirrel doesn't parse due to odd double-quotes at least
15:35seangroveYeup, an open issue about it
15:38gfredericksreiddraper: haha when I set the env variable some of the tests fail that check for how many times tests are run :D
15:38gfredericksI guess that means it works
15:38reiddrapergfredericks: yeah, those tests are a bit brittle, unfortunately
15:42gfredericksreiddraper: https://github.com/fredericksgary/simple-check/commit/318848ae3ea0f5fce0172589ac7be22f25005f13
15:42gfredericksI just pushed a patch release under my group name, so I'm happy for now.
15:43bbloomi just copied an `svn checkout` line from sourceforge and, instinctively, typed `git clone` before pasting it
15:43bbloomsvn checkout git clone ... does not work, unsurprisingly
15:43reiddrapergfredericks: seems sane to me
15:45reiddrapergfredericks: is there a way to set that just on the cmd line with leiningen?
15:46steckerhalterwhy is this becoming a Long? (bit-and (int \Y) 2r0111111)
15:46gfredericksreiddraper: at worst in the project.clj in :jvm-opts
15:47gfredericksreiddraper: 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:47gfredericks,(type (bit-and (int \Y) 2r0111111))
15:47clojurebotjava.lang.Long
15:48reiddrapergfredericks: yeah, a profile seems like a fine way of doing it
15:48gfredericks,(type ^int (bit-and (int \Y) 2r0111111))
15:48clojurebotjava.lang.Long
15:48hyPiRion,(type ^int (bit-and (int \Y) (int 2r0111111)))
15:48clojurebotjava.lang.Long
15:48stuartsierrasteckerhalter: Clojure always defaults to Long.
15:48Bronsaclojure.lang.Numbers/and is defined only longs/Objects and always returns a long
15:49Bronsa,(class (int (bit-and (int \Y) (int 2r0111111))))
15:49clojurebotjava.lang.Integer
15:49steckerhalterok, that explains it... thanks
15:49gfredericksdo 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:51gfredericksthat surprised me a little bit
15:52stuartsierraSupposedly on 64-bit architectures the difference between long and int is nonexistant.
15:52stuartsierraIt is very, very difficult to prove or disprove this in benchmarks.
15:52gfrederickswell it's gotta be somewhat existent to correctly preserve overflow :)
15:53bbloomit's very difficult to prove much of anything with benchmarks :-)
15:53stuartsierragfredericks: Good point.
15:53gfrederickssome 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:54stuartsierraAgain, that's the theory.
15:54llasramgfredericks: I'd figure that JITing would end up obviating any bytecode second-classing
15:55gfredericksllasram: yeah as long as it does notice the unnecessary conversion
15:56gfredericksI think conditionals; e.g., you can branch based on the value of an int but not a long
15:57deadghostso, how do you guys code
15:57bbloomsurely that's something the jit can trivially remedy, right?
15:58deadghostdo you have 8 hour non-stop coding sessions or what
15:58technomancyhow?
15:58clojurebotwith style and grace
15:58deadghostor small blocks of productivity
15:58gfredericksbbloom: surely
15:58technomancy~botsnack
15:58clojurebotThanks! Can I have chocolate next time
15:58xnil~botchocolate
15:58clojurebotIt's greek to me.
15:59xnilgreek chocolate?
15:59bbloomgfredericks: surely extensible byte code is the correct answer ;-)
15:59gfredericksbbloom: let's make jvms multimethods
15:59hyPiRiondeadghost: 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:59technomancydeadghost: the vast majority of actual programming work is maintenance, in which case 8-hour coding blasts isn't usually practical
16:01pjstadigseangrove: it doesn't work for clojurescript.test, but i think that is a desired feature
16:01pjstadigIOW patches welcome :)
16:01technomancydeadghost: 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:02deadghosttechnomancy, how many of those ended up with you thinking wtf was I thinking and what drugs was I on? when you were done?
16:02gfrederickstechnomancy: how many times has that happened since you were a babby owner?
16:03technomancydeadghost: well the most recent was grenchman, which hasn't really seen very wide adoption
16:03technomancyprobably partly due to the fact that I haven't actually had much reason to use it myself
16:03sdegutisJulia is my new favorite language <3
16:03technomancygfredericks: only happened once prior to parenthood, oddly enough
16:07gfrederickstechnomancy: do you like the inheritance aspect of multimethods?
16:07technomancygfredericks: never used it myself
16:07gfredericksyou're the only multimethod lover I know of
16:07llasramI love them too! I just also love protocols :-)
16:08gfredericksI wonder if rhickey regrets them
16:08hyPiRiongfredericks: multimethods have inheritance?
16:08gfrederickshyPiRion: totes magoats
16:08gfredericksyou can setup custom hierarchies even
16:08AeroNotixWhat should I use in place of multimethods, then?
16:08technomancy(doc derive)
16:08clojurebot"([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:09hyPiRiongfredericks: oh, like (derive ::foo ::bar)?
16:09AeroNotix,(derive ::foo ::bar(
16:09clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
16:09AeroNotix,(derive ::foo ::bar)
16:09clojurebotnil
16:09AeroNotix,(isa? ::foo ::bar)
16:09clojurebottrue
16:10gfrederickshyPiRion: here's a fun one:
16:10gfredericks,(proxy [java.util.HashMap clojure.lang.IDeref] [])
16:10clojurebot#<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:10gfredericks(due to multiple inheritance)
16:10AeroNotixhuh
16:10AeroNotixSo complex type hierarchies are broke, didn't we already know this?
16:11AeroNotixI've never seen this done right
16:11gfredericks,(prefer-method print-method java.util.Map clojure.lang.IDeref)
16:11clojurebot#<MultiFn clojure.lang.MultiFn@11e6116>
16:11gfredericks,(proxy [java.util.HashMap clojure.lang.IDeref] [])
16:11clojurebot{}
16:11hyPiRiongfredericks beat me to it
16:11technomancyAeroNotix: they're not necessarily type hierarchies
16:11technomancytehy're dispatch hierarchies
16:11gfredericksand prefer-method cleans it up :)
16:11technomancythat said, I've never found a use for it
16:12technomancygenuine need for user-defined polymorphism is rare enough as it is
16:12gfredericksI've used it once
16:12gfredericksit was fun though :)
16:12gfrederickshttps://github.com/fredericksgary/bitalgs/blob/master/src/bitalgs/sha1.clj#L9
16:14AnderkentI don't even know how to start parsing that
16:16gfredericks~how
16:16clojurebotwith style and grace
16:17AeroNotix"To all the ladies in the place with style and grace
16:17AeroNotix"
16:17mdrogalis~when
16:17clojurebotwhen is for side effects
16:17AeroNotix~why
16:17clojurebothttp://clojure.org/rationale
16:17mdrogalis~who
16:17clojurebotExcuse me?
16:17AeroNotix~whence
16:17clojurebotGabh mo leithscéal?
16:17Anderkent'when is for side effects' ?
16:18rasmusto~for
16:18clojurebotfor is not used often enough.
16:18technomancyAnderkent: on account of its implicit `do`
16:18Anderkentwhen is to avoid the terrible idea that one-handed ifs are. Yuck.
16:19technomancywhat's wrong with one-handed if?
16:19AeroNotixone-handed?
16:19mdrogalisOne-legged, thanks.
16:19technomancyAeroNotix: if supports two arities
16:20Anderkentit'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:20technomancyAnderkent: not if they actually know clojure
16:20Anderkentnope, even if they do actually know clojure
16:20mdrogalisThe place I work at has a style policy to omit braces on one line blocks in PHP.
16:21AeroNotixmdrogalis: that's a bad place
16:21AnderkentI'm tempted to say 'your place uses php' now
16:21mdrogalislool
16:21Anderkentbut i won't!
16:21technomancythat sounds like something you would do if you were still getting used to the idea of expressions vs statements
16:21Anderkentit'd be stereotyping
16:21brehautlol, clojure programmers accidentally deciding to do side effects
16:22dsrxwhere did bitemyapp go
16:22technomancydsrx: he'll be back at 0200 UTC
16:22logic_progi 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:22technomancythe witching hour
16:22bbloomtechnomancy: lol
16:22Anderkentlogic_prog: lein install already did that
16:22hyPiRiondsrx: he's writing on a broken lexer in python and crying his brains out
16:22brehauttechnomancy: thats morning UGT right?
16:22technomancybrehaut: natch
16:23tbaldridgehyPiRion: I told him to stop using clojure-py....
16:23logic_progAnderkent: no, it appears to have Created /Users/x/gh/core.async/target/provided/core.async-0.1.0-SNAPSHOT.jar locally
16:23logic_progbut it says nothing about putting it in ~/.m2
16:23bbloom6
16:24Anderkentit doesnt say it but it should be there
16:24tbaldridgehrm...line install works for me
16:24tbaldridge*lein install
16:24technomancylogic_prog: I can see how that would be somewhat confusing
16:24technomancythere's an old unix adage about being silent in the success case
16:25AeroNotixbecause that's what's supposed to happen
16:25AeroNotixSuccess
16:25AeroNotixNo need to shout about it
16:25logic_proghmm, https://gist.github.com/anonymous/8587061
16:25kephaleis the CCW update site working for folks?
16:25logic_progit looks like it installed in core/async/core.async rather than org/clojure/core/async/core.async
16:25technomancyAeroNotix: right, but it's not silent about generating the jar in the first place
16:25technomancywhich is slightly inconsistent
16:26technomancynot sure how I feel about that
16:26AeroNotix-vvv is for talk
16:27logic_progtechnomancy, tbaldridge, AeroNotix: it worked
16:27logic_proghowever, I did have to change my project.clj to use "core.async/core.async" rather than "org.clojure/core.async"
16:27technomancyAeroNotix: yeah, we've been discussing creating a LEIN_VERBOSE env flag or something
16:27Anderkentlogic_prog: seems like it's not respecting the parent pom?
16:27logic_progfor 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:27Anderkentthe project.clj in core.async seems weird
16:27Anderkentit doesnt specify the group
16:28Anderkentbut it has a pom.template.xml
16:28Anderkentthat does
16:28AnderkentI suppose they don't use lein to generate the artifact pom?
16:28logic_proghow awesome I am. I found 2 inconsistencies in popular clojure tools
16:28logic_progand I haven't even had lunch yet.
16:28tbaldridgeAnderkent: yeah, sorry about that, the pom is the only thing that's used by the clojure build server
16:28tbaldridgeand no, we don't use lein to build
16:28AeroNotixtechnomancy: 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:28AeroNotix*except stderr
16:28logic_progtbaldridge: thanks for putting in the put ret fix
16:29tbaldridgenp. Rich wrote it, but I ended up debugging it :-P
16:29Anderkentlogic_prog: so the fix you want to do is change the artifact name in asyncs project.clj to org.clojure/core.async
16:29Anderkentthen lein install will do what it shoud
16:33technomancyAeroNotix: it might need to wait for 3.x, but we should probably do a once-over of all the success-case output
16:34technomancyI 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:34tbaldridgeAnderkent: logic_prog: I just pushed code to core.async that adds org.clojure to project.clj
16:34Anderkent#iteratingquickly
16:34AeroNotixtechnomancy: I've noticed that the biggest offenders are plugins
16:35technomancyAeroNotix: ah, sure
16:35Raynesibdknox: Man. Just used LT for Python for the first time. So cool.
16:35technomancyAeroNotix: I'm not sure the plugin guide is clear enough about using main/info which can be silenced
16:35AeroNotixis 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:36technomancyAeroNotix: you can throw an ex-info
16:36AeroNotixcool, ok. So it just needs documenting then
16:36AeroNotixI was thinking if it's required then people can't miss it
16:36technomancyAeroNotix: but really there's not much use afaict for anything beyond "does it throw an exception? y/n"
16:36AeroNotixtechnomancy: for CI that's usually all you need
16:36technomancyAeroNotix: actually calling leiningen.core.main/abort is preferred
16:37AnderkentHm, I'm very confused about this discussion, guess my mental models of what lein plugins usually do is different than yours
16:37technomancyI'll make sure it's covered in the plugin guide before the next release
16:37AeroNotixnice!
16:37gfredericksis it weird that cheshire isn't extensible by default even though it has a JSONable protocol?
16:37dakronegfredericks: explain?
16:38Anderkent(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:38dakroneit is extensible
16:38gfredericksdakrone: via setting up alternate functions, right?
16:38technomancyAnderkent: it's a minimum, not necessarily the full solution
16:38Anderkentthough admittedly the plugin doesn't do that much, and delegates actual work to a library that's not aware of lein
16:38dakronegfredericks: do you mean overriding the core encoding methods? that's totally possible
16:39gfredericksdakrone: it doesn't seem public though;
16:39gfredericksi.e., I can extend JSONable but it felt like I was doing something dirty
16:39dakronegfredericks: you can use `add-encoder` to add an encoding function
16:39dakronefor a type
16:40gfredericksdakrone: that works for the core functions?
16:40dakronegfredericks: yes, the generation function checks for protocol implementations first: https://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L114
16:40gfredericksoh hmmmm
16:40gfredericksmaybe I am crazy
16:41gfredericksdakrone: thank you for uncrazying me I will try this out
16:41dakronegfredericks: if it doesn't work that's a bug :)
16:42technomancyAeroNotix: http://p.hagelb.org/lein-output.html
16:42technomancymost output comes from "known interactive" things where I don't think it's necessarily a problem
16:42technomancyrunning a repl, `lein help`, `lein new` etc
16:42technomancyand the warnings are legit
16:43technomancyjar/pom/uberjar is questionable though
16:43AeroNotixyeah, there's benefit to marking things "interactive" and "things which may be used in automation
16:43AeroNotix"
16:44AeroNotixAt the moment, on our jenkins build we use `lein uberjar' to release an artifact
16:44AeroNotixnot sure if that's the best idea, but we're learning.
16:44technomancyI think for compile/javac if we emit output only upon compilation failures that would be ideal
16:44technomancyAeroNotix: no, that's totally reasonable
16:44AeroNotixcool
16:46akurilinSilly qustion: is there a significant perf difference between drop-last and take?
16:46akurilinAs in, say I have 101 items and I want to drop the last one.
16:46Anderkenttechnomancy: 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:47gfredericksdakrone: 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:47gfredericksor did I miss some way to do that simplyer?
16:47akurilinThe former uses a map and the latter does lazy rec
16:47AeroNotixAnderkent: sure, it's ugly though. Also, things which just exit 0 are stupid, totally stupid. It's a CLI tool, lrn2interface
16:47Anderkentright, exit 0 is stupid.
16:47AeroNotixAnderkent: just because I *can* read some output, doesn't mean that that's what I'll read.
16:47technomancyAnderkent: I agree telling the user where the jar they asked for went is good
16:48AnderkentNo I definitely agree about exit codes.
16:48technomancyI am not so sure it's helpful to list every single namespace being AOT compiled though
16:48dakronegfredericks: there are helpers in ch.generate for that, see `encode-map`
16:48gfrederickswoah the impl of drop-last is weeeeird
16:48clojurebotAlles klar
16:48gfredericksclojurebot: woah the impl of drop-last?
16:48technomancyI guess if you have a really long compile it can be good to gauge the progress
16:48clojurebotwoah the impl of drop-last is weeeeird
16:49technomancygfredericks: what have you done
16:49gfredericksdakrone: omg the docstring totally told me to look at that exact function and then I didn't
16:49dakronehaha
16:49gfrederickstechnomancy: I wonder how many facts he picks up that way
16:50gfredericksdakrone: thanks a bagfull
16:50dakronegfredericks: you're welcome, good luck!
16:51technomancygfredericks: a ~forget-last command would help
16:51gfrederickstechnomancy: you act like this is a bad thing that has happened to us here today on this sacred ground
16:51gfredericksin front of all these witnesses
16:52hiredmanthe clojurebot-800 is a learing computer
16:53sdegutisTraced down failing tests for about 15 minutes, until I realized I just forgot to save the change I made.
16:53gfredericksclojurebot: the clojurebot-800 is a learing computer
16:53clojurebotIk begrijp
16:53turbofailnobody lears like clojurebot
16:53gfrederickssdegutis: happens to me once a week
16:53turbofailit is the leariest
16:54Anderkentsuch lear, wow?
16:54michaniskinlol turbofail, your nick is always a joy to me
16:55dsrxso lear, such goneril
16:56Anderkentztellman: when walking things with sleight, is there a way to tell what file/namespace is currently being walked?
16:57ztellmanAnderkent: *ns* should be bound
16:57Anderkentnot before the ns form is evaluated, I think?
16:57AnderkentI guess I care about the file, not the namespace
16:58ztellmanI'm not sure there's a way to tell the provenance of the forms that are being loaded
16:58ztellmanyou could easily alter-var-root clojure.core/load-file
16:58ztellmanin the :pre step for sleight
16:58Anderkenthm, that sounds like a fair aproach
16:59ztellmankeep 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:00ztellman:)
17:00ztellmanit's the "that sounds like a fair approach" response that really makes it, though
17:00Anderkentwell, all the transformations happen under load-file, right?
17:01ztellmanAnderkent: sure, just using 'binding' instead of an atom, is all I meant
17:01hyPiRiontechnomancy: or shitztellmancreates.tumblr.com
17:01ztellmanoh, and no
17:01ztellmansleight hijacks the reader
17:01ztellmanor rather, hijacks the input to the compiler
17:01hyPiRionre https://mobile.twitter.com/danielwithmusic/status/426133408498995201
17:01Anderkentso I guess I rebind sleight.core/load* ?
17:01ztellmanso it affects eval
17:01ztellmanAnderkent: wherever you still know what the file is
17:01ztellmanit's been a while since I've looked at it, I forget exactly what the function is
17:02ztellmanalso, PSA that wherever I say alter-var-root, you should probably be using robert.hooke instead
17:04trptcolini prefer to just (in-ns 'clojure.core) (def xyz) (in-ns 'original.ns)
17:04lvhHi!
17:04Anderkenttrptcolin: I have actually done that before.
17:05lvhI'm using clj-time. I've got an optimization problem involving start-dates and end-dates; I'm trying to minimize non-overlap.
17:05Anderkentwell, not with def, but still
17:05lvhI can't figure out how to find the number of days that two intervals *not* overlap.
17:06Anderkenttrptcolin: https://github.com/lshift/cloverage/blob/e2bb029e851a1c6dc79066de689f46870e150c88/cloverage/src/cloverage/coverage.clj#L87 :D
17:06gfredericksI 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:06lvhSo, 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:07ztellmanlvh: this may put you on the right path: http://stackoverflow.com/a/4446165
17:07trptcolini was just trolling, but alas i have too :( womp womp https://github.com/trptcolin/reply/blob/master/src/clj/reply/hacks/printing.clj
17:07dsrxa hacks namespace, nice
17:07clojurebotExcuse me?
17:07AnderkentHuh, is that because print-method is private?
17:07lvhztellman: Thanks, I'll start reading that :)
17:09hiredmangfredericks: to understand bean you have to undestand that "beans are just pojos" and who could understand that? it is just nonsense words
17:09Anderkenttrptcolin: I seem to be able to (defmethod print-method ...) from any namespace, not sure why you need to switch
17:09hiredmanbeans? who are those when they are at home?
17:09trptcolinAnderkent: i have no idea why i did that
17:10hiredmanthey
17:10Anderkenttrptcolin: haha :D
17:10AnderkentI have since moved on to (binding [*ns* (find-ns clojure.core)] ...)
17:10technomancyhiredman: heh
17:10technomancyreminded me of Jack Handy for some reason
17:11hiredmananyway, beans tend to have property accessor methods like getFoo, which is what bean reflects over, not fields
17:12eyepatchCertainly 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:12maravillastechnomancy: sounds like the "mankind" line
17:12Anderkent(indeed a bean is a class that has a no-args constructor and any 'public' properties should have get/set/is accessors)
17:12eyepatchGenerating 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:12stuartsierrabeans are degenerate structs
17:13AeroNotixeyepatch: there's no simple relationship between N and N-1th term in a fibonacci sequence, afaik
17:14eyepatchAeroNotix, there's phi and the constant and all that.
17:15AeroNotixeyepatch: ah
17:15eyepatchBut I'm avoiding math trickery. I'm just exploring what's possible with idiomatic Clojure
17:15eyepatchWhich I'm discovering is *really* easy to read, and somewhat harder to write.
17:18gfrederickseyepatch: I don't know what "under n value recursively" means
17:19Anderkentyeah, is that 'from 1 to n' or 'from n to 1'?
17:20Anderkentif 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:20Anderkenthm, I suppose that's not recursive
17:20turbofailsupposed to be "all fibonacci sequence numbers less than N"
17:20turbofailof which there really shouldn't be that many
17:21turbofailthe problem states "all fibonacci numbers less than 4e6"
17:21Anderkentright, and he wants a recursive solution
17:22turbofailyeah i don't know how you would do that recursively
17:23turbofailthere's no real way to do structural recursion on that
17:24Anderkenteyepatch: https://www.refheap.com/26802 - spoilers, obvsly
17:25AnderkentI can't think of a way to do this without lazyness
17:25Anderkentwell, you could modify fib to terminate recursion when cur > n, of course
17:25Anderkentthen you don't have to be lazy
17:26Anderkentalso, apparently something's wrong because I get a different sum :P
17:26Anderkentoh it's just even ones
17:31lvhhi
17:31lvhHow do I get clj-time intervals from dates
17:31lvhit only appears to work on instants in time.
17:32ztellmanlvh: a date describes an instant in time
17:32ztellmanyou could have a vector of two dates to describe an interval
17:34locksfredyr: 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:34lvhztellman: Yes, I understand. I have pairs of dates.
17:34lvhztellman: My point is that interval appears to only take *datetimes*. Not dates :)
17:34ztellmanlvh: sorry, assuming the simplest problem
17:35lvhztellman: this doesn't work: (interval (local-date 2014 01 10) (local-date 2014 01 5))
17:35lvhztellman: No problem :)
17:35lvhztellman: change local-date to date-time and all is wel
17:35lvhl
17:35lvhI guess there must be some way to tack on midnight... I'll plunge in the docs
17:35ztellmansorry, not an expert on clj-time
17:35ztellmanbest of luck
17:52dsrxa date represents a range of times, as does a standard datetime, as does anything with precision coarser than the planck time ;)
17:54eyepatchAnderkent, sorry, didn't notice someone noticed. When I said recursion I just meant without mutable code like mine.
17:54eyepatchI know that recursion is something different, I communicated poorly.
17:56eyepatchYour code was exactly what I was looking for.
17:56eyepatchI figured there was a part of the language I hadn't run into that could do what I wanted.
17:57noonian_can i use a protocol like IMap as a type to dispatch on for another protocol in cljs?
17:59Anderkenteyepatch: glad to be of use :)
18:01dnolennoonian_: you cannot
18:02sdegutison typing: https://www.destroyallsoftware.com/talks/useing-youre-types-good
18:02noonian_dnolen: thanks, i didn't think so because it wasn't working for me but a guy can dream
18:03mmitchellAnyone here know anything about the aleph lib?
18:03ztellmanmmitchell: some
18:03mmitchellztellman: Ahh! You :)
18:04mmitchellztellman: 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:05ztellmanyou can either add :auto-decode? true to the request, or use aleph.formats/bytes->string
18:05mmitchellI'm getting a lamina.core.channel.Channel
18:05ztellmanaha
18:05mmitchellok cool, i'll try that
18:06ztellmanif it's a channel, you'll need to also use aleph.formats/channel->input-stream
18:06Anderkentshouldn't it be something like (on-relized (hhtp-request) ... )?
18:06Anderkentah, wait, he blocks by defering nvm
18:06ztellmanthe channel implies it's a chunked request
18:06mmitchellI see
18:06ztellmansorry, chunked response*
18:07ztellmanif you want to handle either case, you can do a lamina.core/channel? test on the returned body
18:07ztellmananyway, hope that helps
18:08mmitchellztellman: yes, thanks!
18:08mmitchellztellman: so what does {:auto-decode? true} do?
18:09ztellmanmmitchell: 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:09ztellmanit may also handle application/xml, I forget
18:09mmitchelloh i see
18:10ztellmanactually, anything with text/* gets turned into a string
18:16mmitchellztellman: 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:17ztellmanyes, (-> response :body formats/channel->input-stream formats/bytes->string)
18:20mmitchellztellman: hmm, on calling bytes->string, it blocks on doesn't ever return
18:20ztellmanwhat does the response contain?
18:20mmitchellztellman: it's json
18:20mmitchellapplication/json
18:20ztellmana single json response?
18:20ztellmana streaming list of json?
18:20mmitchellhmm, i will have to look
18:21ztellmanbytes->string will only return once the input stream is exhausted
18:22ztellmansorry, got to run
18:22mmitchellztellman: oh it's "Transfer-Encoding chunked"
18:22ztellmanfeel free to email me if you have other questions, I'm my nick at gmail
18:22mmitchellztellman: no problem, thanks!
18:22mmitchellmuch appreciated
18:23ztellmanmmitchell: that must means it's chunked, not necessarily endless
18:23ztellmangoogle.com's homepage is chunked, for instance
18:23ztellmanif it's a finite response, bytes->string on the inputstream should return something, eventually
18:23ztellmanbut you might verify things are coming out of the channel
18:23ztellmananyway, gotta run
18:23mmitchellztellman: ok good to know, and that makes sense
18:25stirfooin a & {:keys ...} arguments list, why is the :or map not present in the :as map?
18:26stirfoothey defaults are bound ok in the body, but I would expect them to be in the :as map
18:26stirfoo*my* expectations =)
18:26bhaumantbaldridge: dnolen just making sure I posted this correctly in jira. http://dev.clojure.org/jira/browse/ASYNC-51
18:27Anderkentstirfoo: are you asking how come that happens, or why it was done that way?
18:28stirfooAnderkent: well, I was just wondering if that was in fact correct behavior
18:28stirfoobut the why would be nice to know
18:29Anderkentto the first, the :as part simply rebinds the arg. To the second, I don't actually know
18:29AnderkentI vaguely recall discussing this with someone else a while ago
18:30stirfooAnderkent: not a big deal, does it not seem sane to assume the :or would be present in the :as ?
18:30AnderkentI think you're thinking about it in the wrong order
18:30stirfooit's there, but it's not ;)
18:31stirfooAnderkent: probably
18:31Anderkentit'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:31Anderkentand the :or applies to the destructuring, not the argument
18:31AnderkentI suppose if it went the other way, then there'd be no way for you to actually access what was given to you
18:32dnolenbhauman: looks good to me
18:33stirfooAnderkent: ok, I'll just have to rethink my fn
18:33tbaldridgebhauman: looks good. I'll try to take a look at it soon
18:34bhaumantbaldridge: dnolen thanks guys, as far as I can tell it's pretty intense.
18:35dnolenbhauman: it's just map< right?
18:36bhaumanI don't think so. I defined my own simple version of map< and the same problem occurred
18:36Anderkenthttps://github.com/bhauman/checkmemleak/blob/master/src/checking_safari_leak/core.cljs#L59 that makes me wat
18:36bhaumandnolen: ^
18:36dnolenbhauman: it would be nice to confirm. looking at the map<, the nested reify seems suspicious to me.
18:37dnolenbhauman: like see if the issue occurs with map>
18:37bhaumandnolen: my own version of map was a simple map-chan and it looks like it leaked
18:38bhaumandnolen: I can add more tests to the repo if you'd like
18:39tbaldridgecan 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:40bhaumantbaldridge: What is your SafariWebContent usage at?
18:40Anderkenttbaldridge: it's definitelly good 6 times slower on safari then chrome for me
18:40technomancyis incanter still the quickest way to throw up a histogram?
18:41Anderkentactually nvm
18:41bhaumantbaldridge: 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:42tbaldridgebhauman: okay, mine's currently at 780MB, I'll see if it sticks there
18:42dnolenbhauman: is this with advanced optimizations?
18:43tbaldridgeokay, 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:43bhaumantbaldridge: did you first try the page without the leak and see the usage
18:43bhaumantbaldridge: ?
18:44bhaumantbaldridge: I was late to respond cause the page almost crashed my machine
18:44tbaldridgeokay, yeah, with the leak-false it sticks at about 36MB
18:44dnolenbhauman: the level of optimization makes a huge difference in memory usage
18:44`cbpnote to self: do not click on "this will cause memory leaks!" links
18:45dnolenbhauman: especially w/ core.async where otherwise you'll get tons of closures
18:45bhaumandnolen: tbaldridge just compare the usage of the two different examples
18:45Anderkentwait, how are you measuring the memory usage? Is there something like chrome devtools for safari?
18:45dnolenbhauman: yes I've done a lot of comparisons like this in the past
18:45`cbpAnderkent: activity monitor
18:45dnolenbhauman: you have no optimizations enabled here
18:45Anderkentoh, so it's on process level
18:45dnolenbhauman: we need to know that it affects productions optimization settings
18:46bhaumandnolen: I gotcha, I also experienced it at :simple
18:47dnolenbhauman: if you could republish examples that compiled w/ simple that would be informative as well.
18:47dnolenbhauman: in additions to no optimizations ones
18:48tbaldridgebhauman: 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:48bhaumandnolen: I'll mess with it a bit
18:48bhaumantbaldridge: thanks man
18:50technomancyuuuuuuuugh incanter's histogram is a macro
18:50technomancywhy would you do this
18:50turbofailha
18:52brehautclj 1.0 was crazy times
18:53eggheadhey brehaut
18:54eggheadthanks for writing necessary evil so I didn't have to
18:54brehauthi egghead. im sorry that you have to use it
18:54egghead:)
18:54brehautwhat is your misfortune?
18:55eggheadbrehaut: web ui for supervisord, only exposes itself via xml-rpc
18:55brehautwell thats delightful :(
18:55eggheadhttp://github.com/eggsby/warden
18:56eggheadlol brehaut could have been worse, yr lib helped a lot, hardly had to think about it
18:56brehautegghead: you have gotten lucky then. lots of api's exposed via xmlrpc seem to be quagmires in their own write
18:56brehaut(metaweblog anyone?)
18:56eggheadhttps://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:57egghead(guessing that is python/supervisord side)
18:57brehautwhich bit is the multicall ?
18:58eggheadbrehaut: just part of xml-rpc, not something necessary-evil concerns itself with
18:58brehautah
18:58eggheadbasically if the request body is an array of call specs
18:58brehautis it something necessary-evil should be concerning itself with?
18:59brehautand theres exactly zero concern for performance in n-e; its quite possible that large datastructures will be sluggish to encode or decode
19:00brehautthe use of schema is interesting btw
19:05eggheadbrehaut: 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:05brehautok cool
19:05eggheadbrehaut: 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:06brehautim always happy to not have to write any more code for that lib ;)
19:06eggheadlol
19:06brehaut(although i have wondered about implementing the client portion in cljs)
19:06eggheadif I run into any walls I'll send some PRs
19:06brehautok cool
19:55jarjar_primehello!
19:55x^2hey
20:01gfredericks,'^2 can-a-number-be-metadata
20:01clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map>
20:01gfredericks,(meta '^"string" foo)
20:01clojurebot{:tag "string"}
20:01gfredericksarrdem: this is different
20:01gfredericksstrings are not IObj either
20:02arrdemhum... I wonder what the implementation reason for this is..
20:03gfrederickswell
20:03gfredericksall metadata is maps
20:03gfredericksand there's a syntax for maps
20:03gfredericksand also some special case syntaxes for common cases
20:03gfredericksA) keywords, for setting {:foo true}
20:03arrdem,(meta ^{:tag 1} 'foo)
20:03clojurebotnil
20:03gfredericksB) symbols/strings, for setting {:tag foo}
20:04gfredericksmy guess is that B) is intended to be just for type hints, which only require symbols and strings
20:04bbloom,(meta ^{:tag 1} (quote foo))
20:04clojurebotnil
20:04bhaumandnolen: I updated the page http://rigsomelight.com/checkmemleak/index.html#comp-partial
20:04bbloom,(meta (quote ^{:tag 1} foo))
20:04clojurebot{:tag 1}
20:04arrdembbloom: oh okay. I see the distinction.
20:05bbloomarrdem: awesome :-)
20:05bbloomarrdem: nah, metadata has some weirdness. threw me for a loop a few times
20:05dnolenbhauman: excellent thanks
20:05bbloomarrdem: i enjoy this too:
20:05x^2,(read-string "test")
20:06bbloom,(identity ^{:foo (print 1)} {:bar (print 2)})
20:06clojurebottest
20:06clojurebot21{:bar nil}
20:06bbloomgets compiled to a with-meta call
20:06arrdembbloom: side effects are no fair :P
20:06bbloombut... look at the argument order:
20:06bbloom(doc with-meta)
20:06clojurebot"([obj m]); Returns an object of the same type and value as obj, with map m as its metadata."
20:06bbloomswapped! d'oh
20:07arrdembbloom: oh. that's great :D
20:07akurilinGotta say, getting used to comp makes for some really elegant solutions
20:08noonianhere'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:11x^2hey all, i am just getting started with Clojure. General opinions on the O'Reilly book?
20:11x^2i am slowly working my way through it now
20:11technomancyx^2: it's good!
20:11x^2:)
20:11x^2great
20:11x^2i am still at the beginning but this all seems very cool, I am new to lisp besides topical experience w/ scheme.
20:12x^2i like the 'code is data' concept, it seems so interesting!
20:12bbloomtopical as in you know some stuff about lispy ideas like homoiconic?
20:12bbloomor tropical, like you played with it on a beach one time?
20:12akurilinJoy of Clojure 2nd ed should be almost done, too bad it's a bit advanced.
20:12x^2hahaha
20:12akurilinDon't know what the next most recent book would be.
20:12x^2topical as in, i've written some basic programs in it
20:13akurilinyogthos' book on building web apps is cool if you intend on doing that at some point
20:13x^2and i just read the part in this o'reilly book about homoiconic languages like clojure
20:13RickInAtlantaakurilin what is yogthos' book?
20:13noonianis that clojure in action?
20:15brehautweb programmign with clojure or similar
20:15akurilinweb development with clojure
20:15RickInAtlantawow, cool. I missed that one
20:15RickInAtlantahttp://pragprog.com/book/dswdcloj/web-development-with-clojure
20:16akurilinFor me it was useful as a confirmation of the fact that I was doing my ring apps sufficiently idiomatically
20:16akurilinso it's good for cherry-picking some ideas here and there
20:16akurilinThe first time you write your first ring app, it's going to be pretty darn fugly
20:17akurilinI 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:19arrdemakurilin: haskell pushing isn't allowed until 2am UTC, but bitemyapp is usually happy to oblige.
20:19akurilinarrdem: I was just reinvigorating a recent #clojure meme.
20:20technomancyakurilin: error response codes in an ex-info
20:20technomancyit'll change your life
20:20akurilintechnomancy: right now I even dump exceptions into the response and bubble them up to the appropriate logger middleware
20:20akurilintechnomancy: I'll investigate the ex-info
20:26akurilintechnomancy: 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:28technomancyakurilin: right; you can throw (ex-info "not allowed" {:code 401})
20:28technomancycatch it in a middleware and turn it into a response map
20:28technomancyno need to therad it through all the intermediate functions
20:28akurilinLike a fancy goto :)
20:29akurilinI 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:30technomancyno, like call/cc =D
20:31akurilinInteresting, never heard of that before, absolutely no lisp xp outside of clj.
20:31akurilinI often wonder if I'm missing out.
20:32turbofailmeh. call/cc is better for making puzzles than for actual usage
20:32technomancynot particularly
20:32akurilinThen I think of Haskell. (I had to, come on)
20:32turbofailyou're not missing much
20:32technomancyakurilin: "readability and predictably felt somewhat decreased" is basically a perfect description of call/cc =)
20:33akurilintechnomancy: I used to do REST input validation with exceptions + middleware at one point, that sucked terribly.
20:34mmitchellakurilin: 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:34akurilinEnded up with a monad approach like what mmitchell listed.
20:35akurilinI 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:35technomancysure, input validations are different from access control and the like
20:35akurilinWith short circuiting at the first 2
20:36technomancyexceptions for 401 and 403 are pretty reasonable IMO
20:37akurilinIn my case that happens in step 2., I just end processing at that point and return a corresponding response map.
20:37akurilinI can see how one's situation might be a bit more complex though.
20:38akurilinActually that makes me think that I might want to completely decouple ACL checking into its own middleware. Is that how people do it?
20:38akurilinDoesn't sound too trivial with a few roles and dozens of different routes.
20:39bbloomakurilin: are you stuck with traditional ACLs?
20:39bbloomlike a giant back of user/object/permissions triples?
20:39bbloomb/c imo, that is no fun.
20:39bblooms/back/bag/
20:40akurilinbbloom: 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:40akurilinbbloom: what's a non-traditional ACL?
20:41bbloomakurilin: something closer to https://github.com/ryanb/cancan
20:42bbloomakurilin: essentially, you have a first class notion of an "ability" which is a thing that can check it's own authorization
20:42bbloomakurilin: 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:43akurilinThis is going to be one hell of a project.
20:43bbloomakurilin: i think cancan is worth studying. it's my least hated approach to doing authentication
20:44bbloomwhat's your database tech?
20:44akurilinbbloom: 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:44akurilinbbloom: PG.
20:45bbloomakurilin: 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:45bbloomwhere you define a view that executes business logic and generates the list of all possible ACLs and you join against that
20:45akurilinI'm honestly not comfortable enough with stored procs.
20:46akurilinI know at some point if you're enterprisey enough you can't get away with it, but oh well.
20:46bbloomheh
20:47bbloombasically, 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:47akurilinSo basically cancan does sql join generation as opposed to you yourself defining ACL tables and using those, right?
20:47bbloomone 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:47akurilinAs in, they're all still joins, derp.
20:48akurilinbbloom: 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:48xuserbbloom: how is the performance with PG as a data store?
20:48bbloomyeah, cancan takes a nested map where nested maps represent relationships, keys with values in them represent attribute equality
20:48bbloomxuser: postgres is a much much much better database than mysql
20:49bbloomxuser: but it's actually a database
20:49bbloomxuser: not an durable index or anything low level like that :-P
20:49xuserbbloom: I mean, how is the performance of datomic when using pgsql as a datastore
20:49bbloomoh, i have no idea
20:49bbloomi haven't used datomic for real work yet
20:49bbloomi think riak is the current favorite backend
20:50bbloomakurilin: that's kinda the whole activerecord philosophy. i'm over it. i've seen the datomic light :-)
20:50xuserdatomic+pgsql vs raw pgsql would be a nice benchmark, to see if it lags behind to much
20:50bbloomakurilin: i want to my real programming language and bang on local data, not manage round trips to the db
20:54akurilinI hear you. I'd love to never have to do this again.
20:54akurilinGuess we're slowly getting there.
20:55akurilinI actually quite enjoy working with PG as long as I don't have to write any sprocs or try to enable plugins etc.
20:56bbloomyeah, psql is much preferable to any other SQL db i've worked with
20:57akurilinSome people seem to enjoy writing sprocs in JS for it, I've never tried though
20:57akurilinmaybe I'll dig it
20:57RickInAtlantacan datomic use pg as a back end?
20:57akurilinbut I'd still rather not spread myself too thin, got neough work to do in the web app
21:02RickInAtlantasanity 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:02test__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:03rhg135RickInAtlanta: yup
21:03RickInAtlantathx
21:03arrdem,(doc cond->)
21:03clojurebot"([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:05hyPiRiontest__: the last is a vector with a map, but I think you wanted a direct map instead
21:05hyPiRionIt should work fine if you remove the `[]`s
21:16test__thx
21:17test__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:18test__result is from a jdbc result: (def result (query db ["select * from dbo.table"]))
21:34quizdrwhat 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:35eggheadquizdr: i think the most idiomatic way is to use a vector
21:35eggheadsince lists are optimized for prepend and vectors are optimized for append
21:35eggheadand then its just a matter of using 'conj'
21:36tmciverconj adds to the end of a vector
21:36eggheadand the beginning of a list
21:38quizdrand is I needed a list in the end just (apply list ...) to make it a list?
21:38quizdror i suppose I could just use conj and then reverse in the end
21:38quizdrif i was working on a list, that is
21:38akhudekquizdr: you could, but if you already have a vector, why would you want a list?
21:39eggheadquizdr: why would you need a list in the end btw?
21:39quizdri don't already have a vector, i have a list and need to return a list
21:39bbloomand if you really just want something () shaped instead of [] shaped, you can get a seq in constant time
21:39egghead,(= [:a :b :c] '(:a :b :c))
21:39clojurebottrue
21:40bbloom,(= (conj [:a :b :c] :x) (conj '(:a :b :c) :x))
21:40clojurebotfalse
21:40egghead^
21:41eggheadquizdr: in my experience I rarely need to think about vector or list, and use vectors almost everywhere
21:41quizdri have a list, not a vector, need to add to the end, and return the list, not return the vector.
21:41quizdri could then just reverse it, I suppose, and use conj
21:41quizdrthat is, use conj first, then reverse it.
21:41alewdo you care about performance here?
21:42quizdrnot at the moment. i'm appending one by one to a list
21:42eggheadquizdr: if your goal is to append you should be using a vector instead of a list
21:42akhudekcan you not just change the list to a vector?
21:43quizdri 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:43egghead,(concat '(:a :b :c) '(:d))
21:43clojurebot(:a :b :c :d)
21:43alewdo they care that it is a list?
21:44luser0they? the linkage gnomes?
21:44eggheadthere are a lot of ways to do it ofc
21:44quizdrconcat is an interesting idea
21:44eggheadconstructing a whole new vector out of the list isn't going to be much better than using something like concat
21:44alewluser0: maybe they are relying on it to be a list to conj to the front
21:48eggheadokay 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:52eggheaddoes anyone know of a cljs lib that gives you something like an atom that persists to localstorage?
21:53eggheadi wonder if that would be useable with om
21:54bbloomegghead: how hard could that possibly be to write?
21:54brehautegghead: im not sure if that would need to be a seperate ref type; you could jsut hook watch right?
21:55eggheadbbloom: not hard at all
21:55alandipertegghead: https://github.com/alandipert/storage-atom and yes it's very simple
21:55bbloomegghead: isn't it just localstorage.whateverTheWriteApi('some-key', (pr-str @db))
21:55bbloomforgive my mixed javascript & clojurescript syntax
21:55eggheadalandipert: you rule
21:55bbloom(inc alandipert) ; correctly trimmed of whitespace
21:55lazybot⇒ 5
21:56dsrxegghead: yes it exists oh and i was beaten
21:56testclo (def result (query db ["select * from dbo.table"]))
21:56testclouser=> (map (fn[alert] (filter-alert-by-rules rules alert)) (take 2 result))
21:56testclo([4000001455 [3 4 6]] [4000003167 [3 4 6]])
21:56testclowhy the following failed?
21:56testclouser=> (map (fn[alert] (filter-alert-by-rules rules alert)) result)
21:56testcloNullPointerException [trace missing]
21:56testclouser=> (class result)
21:56testcloclojure.lang.LazySeq
21:56testclouser=> (class (take 10 result))
21:56testcloclojure.lang.LazySeq
21:57testclouser=> (class (first result))
21:57testclo
21:57testcloclojure.lang.PersistentHashMap
21:58dsrxtestclo: please use a pastebin like http://www.refheap.com/ rather than pasting long blocks of text directly in the channel
21:59eggheadlol alandipert i'll have to make this use cljson :)
22:00alandipertegghead: you should, would be much faster to read
22:00alandipertegghead: but you know that already :-) any cljson glitches so far?
22:01eggheadnope all parses smoothly and runs lightweight, thanks for making cljs a better place :p
22:11testclo
22:11testcloThx, I just used refheap, and pasted again below
22:11testclo (def result (query db ["select * from dbo.table"]))
22:11testclouser=> (map (fn[alert] (filter-alert-by-rules rules alert)) (take 2 result))
22:11testclo([4000001455 [3 4 6]] [4000003167 [3 4 6]])
22:11testclowhy the following failed?
22:11testclouser=> (map (fn[alert] (filter-alert-by-rules rules alert)) result)
22:11testcloNullPointerException [trace missing]
22:11testclouser=> (class result)
22:11testcloclojure.lang.LazySeq
22:11testclouser=> (class (take 10 result))
22:11testcloclojure.lang.LazySeq
22:11testclouser=>(class (first result))
22:11testcloclojure.lang.PersistentHashMap
22:11testclobut looks like it still doesn't work for refheap
22:13seubertplease stop
22:17mmitchellanyone commonly use clojure.core/delay?
22:23ddellacostatestclo: 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:24ddellacostatestclo: that means, *don't* paste into IRC, paste into refheap or whatnot and put that link into IRC, if that's not clear.
22:26eggheadalandipert: https://github.com/alandipert/storage-atom/pull/1
22:29alandipertegghead: sweet, thanks!
22:31dsrxpresumably that will break compat for anyone who was storing things previously
22:32eggheaddsrx: :O you're right
22:33eggheadwow alandipert enduro looks really nify too
22:34alandipertegghead: it might benefit from cljson too, i suspect cheshire might be faster than clj reader
22:35bbloomi haven't benchmarked it. is clj reader particularly slow?
22:36alandiperti dunno, but reading json might be faster
22:36bbloomwhy? they are both LL(1), right?
22:37bbloomsorry ignore me, brain is slowing down :-P
22:37bbloomsurely the clj reader is slower b/c it does a bunch of computational-ish stuff rather than just parsing
22:38bbloomthat said, i suspect an edn reader can be made every bit as fast as a json reader
22:38hiredmansomeone should go do that
22:38eggheadwell it's a native implementation of a json parser vs a js parser
22:39eggheadnot 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:40bbloomdouble duh. good point :-P
22:41dsrxegghead: using savagely optimized js you mean
22:41eggheadya dsrx
22:41dsrxJS is faster than C++, that's why nodeos is the future
22:41eggheadasm.js
22:41bbloomi used asm.js to compile hello world and it was like 100k
22:41eggheadloool
22:42bbloomer i mean emscripten
22:42rurumate_I'm sorry but http://www.youtube.com/watch?v=bzkRVzciAZg
22:42bbloomi didn't bother to try google closure compressing it
22:42dsrxit's sort of nuts that emscripten works as well as it does
22:43bbloomrurumate_: ROFL the switch from pleasantries to fork stabbing got me good
22:44bbloom"you may recall sequential code, that's the code you can read"
22:50ddellacosta"I could have sworn you just said lisp"
22:51rurumate_umm, how does a project with one file (README.md) have almost 1000 stars on github
22:51rovarhave you seen the readme? it's amazing
22:52hiredmanpeople are interested in the edn spec
22:55rurumate_hiredman, huh?
22:56hiredmanthe edn spec repo is the repo at the top of my mind that is a single README.me
22:56hiredmanmd
22:56rurumate_oh, ok
22:56hiredmanI guess it only has 613 stars
22:57rurumate_no I was talking about nodeos, the repo that contains the actual code has <100 stars it seems
22:57guest1234does anyone have a well-structured Ring / Compojure app (that isn't Luminus..) ? Bonus if it has clean, informed clojurescript.. thanks
22:58rovarguest1234: 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:58dsrxrurumate_: 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:59rurumate_maybe the creator is just making videos from scripts he gets from other people?
22:59guest1234rovar: yeah, looking at chord. didn't know about dacom. thanks
22:59guest1234somewhat of a n00b. trying to find 'good' examples of how to do things 'correctly'
23:00guest1234I must've been out to lunch. Didn't know clojure existed til a few months ago... Wish I'd discovered it sooner.
23:01rurumate_guest1234: if you want to write clean clojurescript, have a look at core.async
23:01rurumate_that'll allow you to get rid of all the callbacks
23:01technomancyguest1234: no cljs, but I am somewhat proud of https://github.com/technomancy/syme
23:02guest1234yeah, I watched David N.'s talk
23:02guest1234man, he's good.
23:02eggheadcool alandipert just added this new version of storage-atom to my project and it's working like a charm
23:03rurumate_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:03dsrxthis one is also very good http://www.youtube.com/watch?v=bzkRVzciAZg
23:03dsrx(Erlang The Movie II: The Sequel)
23:03alandipertegghead: terrific!
23:06tmciverdsrx: same link as the first.
23:06guest1234technomancy: thanks. looking through syme...
23:06rurumate_but I also found it hard to write large apps with many "views" in clojurescript
23:07alandipertegghead: i pushed 1.1.2
23:07rurumate_especially the "routing" part, and hiccup / dommy as a template engine has its limitations
23:07dsrxtmciver: oops, http://www.youtube.com/watch?v=rRbY3TMUcgQ
23:08guest1234technomany: 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:09eggheadthx alandipert, already added my dep on it :)
23:11ddellacostaguest1234: 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:12guest1234ddellacosta: yeah. that's what I'm gathering. I'm not proficient enough yet to differenciate 'good' from 'mediocre'
23:12ddellacostaguest1234: 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:12guest1234or what's obsolete..
23:12ddellacostaguest1234: 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:12eggheadthere are a lot of cljs frameworks/libs sprouting lately
23:13guest1234ddellacosta: is any example of the latter on git?
23:13eggheadya just look at my repos
23:13egghead:p
23:13ddellacostaguest1234: er, hmm...don't have a good one that is open-source that I can point you to, I'm sorry. :-(
23:14ddellacostaguest1234: 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:15ddellacostaguest1234: 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:15ddellacostaFRP web app in Clojure, more or less.
23:16guest1234ddellacosta: sure. will look more deeply at pedestal codebase.
23:16guest1234is Caribou on par? inferior? or is that asking flame war.
23:16eggheadthere is also http://hoplon.io/
23:16guest1234"different"
23:16ddellacostaguest1234: 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:16ddellacostayah, I still have to dig into hoplon...been neglecting it.
23:17ddellacostaCaribou 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:17ddellacostaguest1234: 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:18eggheadi've always leaned toward building my own stack since the libraries are all so modular
23:18ddellacostaguest1234: 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:18guest1234ddellacosta: first "need" is a fairly simple app - almost just one page w a bunch of dynamic updates.
23:18guest1234a few routes...
23:19ddellacostaguest1234: in that case, I definitely would suggest checking out dnolen's posts on core.async and Om to start: http://swannodette.github.io
23:19ddellacostaguest1234: 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:20ddellacosta...others may have different suggestions for where to start, but that would be my take.
23:20rovaris there any way in LightTable to get the paredit ctrl-right/left behavior?
23:20eggheadi have the source for this lil' om+compojure app up on github http://162.243.146.235:3000/
23:21ddellacostaegghead: nice
23:21guest1234ddellacosta: 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:21eggheadguest1234: go through clojurescript 101 and the om tutorial by dnolen
23:22ddellacostaguest1234: 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:22ddellacostaguest1234: 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:23guest1234egghead: that's nice. what's your git name
23:23eggheadguest1234: https://github.com/eggsby/warden still have a lot to do before it's ready to use tho :p
23:23michaniskinguest1234: feel free to join us in #hoplon if you have questions about it
23:23guest1234is it like, you use Om, on its own.. or cljs with Selmer and EnFocus... ?
23:24guest1234I guess either... just different approaches. both valid in their own context
23:25guest1234michaniskin: thanks. I'll dig through hoplon as well.
23:25ddellacostaguest1234: 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:25eggheadguest1234: om is just representing the dom as trees so there are plenty of ways to manipulate those trees
23:26ddellacostaokay, I gotta get back to work...good luck guest1234, ping #clojure any time w/questions
23:26guest1234yeah, is it really just new so prominent patterns have yet to emerge from battle testing production code..
23:26akurilinLein 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:27guest1234the way that 'most' of the problems of django / rails / etc ... got fixed? (as best as those languages would allow ...
23:27akurilinTrying to set a default value on an env parameter in one single place.
23:27dsrxakurilin: there's the :user profile https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#declaring-profiles
23:27eggheadguest1234: people are bringing over the lessons learned from those environments tho
23:28eggheadcompojure is basically sinatra, ring is basically rack/wsgi
23:28eggheadof course superior because clj
23:28akurilindsrx: do you know if dev will correctly merge with user?
23:29guest1234egghead: right.
23:29ddellacostaguest1234, 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:29ddellacostaand on that note, I'm really leaving now
23:29dsrxakurilin: "The dev profile takes precedence over user by default."
23:29guest1234ddellacosta: thanks!
23:29ddellacostaguest1234: cheers! :-)
23:30akurilindsrx: care sharing where you're seeing those instructions? The giant readme sample profile?
23:30dsrxakurilin: I linked to the doc/PROFILES.md document above
23:31dsrxit's in the next section though
23:31dsrx"Merging"
23:32akurilindsrx: oh sorry, I totally snoozed through that link, my bad.
23:32akurilinLong day :)
23:32dsrxnp, I feel you
23:34quizdrdid I see someone say a bit ago that js is faster than c++? is that right?
23:35dsrxquizdr: i was joking (but this is a thing some people believe)
23:35guest1234"faster" to get stuff done. sure.
23:35akurilindsrx: So ok, dev takes precedence over user, can the same be said for uberjar and test?
23:35quizdrdsrx ok i couldn't imagine that to be true
23:35dsrxhttp://stackoverflow.com/questions/17036059/javascript-is-4-times-faster-than-c lol
23:36bbloomthe top answer is entertainingly polite
23:36xusersure js could be faster than c++, depends on the implementation ;)
23:58deadghostis it weird I want to be friends with clojure
23:58deadghostlike "bro, let's do some bro things together, BRO"
23:59xuseris he a being a good bro?
23:59deadghostclojure is my best bro
23:59deadghostall functional and shit