#clojure logs

2014-01-17

00:00charequizdr why do you always do that
00:06gtraknrepl-complete drunk coding begins now.
00:13quizdrif cider uses nrepl, then why are things that are nrepl-based not always working in cider?
00:13gtrakquizdr: because suck
00:14quizdrbecause suck?
00:14gtrakwell, what specifically? :-)
00:14gtrakI'm just starting to dig into that stuff, it's a little messy.
00:15gtrakbut pretty neat at the same time.
00:16quizdri see various "cider compatibility fixes" on mailing lists for emacs live, overtone, others.
00:16gtrakit seems like there's a loose spec but a lot of de-facto implementations of things.
00:16gtrakit's just a young project.
00:16gtrakwe were all using swank a year ago.
00:17hiredmannrepl is a protocol, there was an an email nrepl client, called nrepl.el, which was renamed to cider
00:17quizdryeah this the fastest moving dev tech i've encountered
00:18hiredmanthat rename broke things
00:18quizdrso it primarily a naming issue, not so much a major change in how things are done
00:18gtrakI'm noticing more cool than broken so far.
00:18hiredmanit happend, I dunno, some time in the last six months
00:19hiredmanwell, right after it was renamed, it was blown part in to a million files
00:19gtraklike it picks up the port from a file if you start a server outside of emacs.
00:19hiredmanwhich definitely broke everything
00:19hiredmanand made to depend on some emacs packaging nonsense which depends on all kinds of other stuff and broke everyeones stuff
00:20carkan makes me type "cider clojure" instead of just "nrepl" in google
00:21TEttingercark, you don't want yours "cider fix" from martinelli
00:23hiredmanit is terrible, bbatsov(who is running nrepl now) seems to revel in maintaining things like style guides for clojure, without, as far as I can tell, having written any clojure
00:23hiredmanI mean cider
00:23hiredmanthe (only?) nrepl server I know of is in contrib and the defactor standard of the protocol too
00:24gtrakthey seem pretty friendly so far.
00:24dsrxhey now that's unfair hiredman https://github.com/bbatsov/praxis/blob/master/clojure/praxis/src/praxis/rot13.clj
00:24carkyou can't tell if someone is doing lot's of clojure by just looking at github
00:25dsrx^
00:25hiredmancark: "as far as I can tell"
00:26dsrxthis 'richhickey' guy only has four original sources repos written in clojure on github, he's hardly an authority figure :P
00:26hiredmanI write lots of clojure for work and for fun, and I have seen his stlye guide, and I was not impressed
00:26gtrakhave you ever been impressed with a style guide?
00:26hiredmanI just know some day someone is going to say to me "well the style guide says ..." and I am going to scream
00:26seancorfieldSince this hot potato topic has come up, I'll side with hiredman and add my bitter complaints to the mess that bbatsov has created, IMO.
00:27quizdrtake the google c++ style guide, for example. you'd think google knows a thing or two about writing software. but a lot of people disagree with their style points.
00:27seancorfieldI have been extremely unimpressed with bbatsov's responses on the Clojure list about the stupid renaming of nrepl.el
00:27dsrxsome of the google c++ style guide is there because of accidents of history at google specifically
00:27gtrakmy company has a style guide too, I don't remember what's in it.
00:27seancorfieldBasicually he says "Fuck you! - update your dev env!"
00:28hiredmannever upgrade anything, never use anything that forces you to upgrade
00:28quizdri'm sure this issue will be resolve at the next meeting of the clojure standards committee
00:28seancorfieldMaking a change that forces every single user to faff around like that is terrible
00:28seancorfieldas hiredman says, it broke everything associated with nrepl.el
00:29seancorfieldand it creates an unknown (non-zero) amount of work for every single user of nrepl.el for no good reason at all
00:29dsrxi guess i was lucky to have started with clojure just after it was renamed =)
00:29seancorfieldThe renaming was completely unjustified IMO
00:29carki spent several hours completely redoing my emacs config
00:29hiredmanI wonder if I can find the pr
00:29carktho now it's working better than ever =)
00:29hiredmanmaybe it was an issue
00:30seancorfieldYeah, I don't want to migrate because it's not just me - it's my whole team
00:30gtrakit's always been pretty broken for me, but if I can figure it out within 30 minutes I don't blame anyone else, since I don't really care to learn elisp for real.
00:30dsrxhmm...
00:30carkbtw is ritz fixed yet for cider ?
00:30dsrxif only emacs had some way of grouping functions and variables together into names, and then requiring those from some other code, but using them with a different name
00:31quizdri just use other clojure devs emacs configs on github until i find one i like.
00:31dsrxyou could call them 'namespaces'
00:31gtrakI'm still using the supposedly defunct 'starter kit'
00:31quizdrthen i tweak it slightly to help my tired eyes with larger fonts
00:31quizdri think starter kit is in mine as well
00:31seancorfieldcark: ritz works just fine with nrepl :)
00:31carkseancorfield: go ahead stab me some more
00:32quizdri don't even know what starter kit supposedly is. i'm so lazy on IDE setup. Apple spoiled me with Xcode for many years.
00:33carkwhile we're bitching, what i don't like is the "war on" :use
00:33carkand the fact it isn't available in clojurescript
00:33gtrakmeh use is lame
00:33RaynesIt isn't? Splendid!
00:33hiredmanhttps://github.com/clojure-emacs/cider/issues/375
00:33gtrakit makes namespaces entirely incomprehensible if you didn't write themm.
00:33hiredmanugh
00:34carkthere are many cases when you want to quickly model something, and use is very nice then
00:34gtrakwhen you work on a large codebase, you want to make 'explicit' easier.
00:34gtrak:refer :all is still there.
00:34gtrakyou just have to know it's there.
00:34hiredmancark: :require :refer :all
00:34carkhah man, been working with clojrue for years now, and didn't know about that
00:34RaynesYep.
00:35gtrakcark: good :-)
00:35RaynesIf you want to purposely write bad code, Clojure lets you. Particularly because it's useful for tests.
00:35gtrakno one will yell at you for not using :refer :all
00:35gtrakI will yell at you for using :use
00:35hiredmanhttps://github.com/clojure-emacs/cider/issues/375#issuecomment-25488294
00:36carkwell that's my point, sometimes you want to quickly throw something together to see if it will work, we're not always programming in the large
00:36carkexploratory programming !
00:36gtrakmine has never suffered.
00:37gtrakI'd rather use a one-letter alias than use
00:37noonianyeah, i use use from the repl all the time
00:38gtrakif I have a bunch of utils, I stuff them in a u/
00:38carkgtrak: hah ! now who's doing bad things !?
00:38quizdrhiredman that's an interesting thread, sheds light on both sides of the issue
00:38gtrakit's less bad, and it's explicit.
00:38cark=)
00:39gtrakcark: at least I know there's no chance of calling a function where I don't know where it came from.
00:39gtrakif I have to move stuff out of the utility namespace, it's relatively easy to do so.
00:39gtrakin practice, it doesn't get huge.
00:40gtraktrying to learn some code where it has 20 namespaces 'used', even if 'only', is really really hard.
00:41carkmy biggest clojure program uses only :use ... stopped updating it to new clojure version since the big contrib explosion
00:41carkstill works nice, but lein is frustratingly refusing to work like it used to !
00:41gtrakah yea, I'm glad that happened though.
00:42carkfunny thing is, the program compiles using ant, but i need lein to work with emacs =/
00:43gtrakthe only trouble I've had since 1.3 is stupid tests relying on hashkey ordering.
00:43gtrakbecause order of keys tends to be consistent, unless the algo changes.
00:43carkmy old program is still on 1.2 =/
00:44gtrakif it's seq'd at some point... then order starts to matter.
00:45hiredmanthe first clojure program I ever "deployed" pre 1.0 is still out there cranking away, I don't even know if I still have the source, but the guy I wrote it for writes emails and complains if the server part goes offline
00:45hiredmanbuilt using make
00:45carkhaha make
00:45carkahwell true and tested =)
00:46hiredmantechnomancy did not release lein until sometime later
00:46carkmy thing i started coding the day I managed to AOT compile a test program ...I think it was before 1.0 too ... not quite sure anymore
00:46carkbut i still have the source at least =) and maintain it still
00:48tpopeomg at this nrepl.el rename thread
00:48tpopeI thought the foreplay rename was contentious
00:48charelets talk about making a game in clojure
00:50carki don't think clojue is a good fit for games
00:50quizdrcark why not? have you read Land of Lisp? makes some neat examples of lisp for gaming
00:50gtrakwhat kind of games?
00:51charewhat kind of game do you like
00:51carkclojure is quite fast, but there is nevertheless a penalty for using persistent data structures, you end up coding in a non idiomatic way
00:53gtrakI think it would be relatively easy to optimize immutable code
00:54gtrakyou wouldn't want to write a physics engine in it
00:54carkyes but there is a whole lot of hashing going on with clojure
00:54charewe aren't trying to make a super high end graphics game don't need full optimization
00:54gtrakcark: records?
00:55carkyes that works, but how about vectors ?
00:55seancorfieldhmm, we have a couple of legacy :use clauses in some old tests but that's about it... and we have a handful of :require :refer :all clauses... but mostly we either :require :as or have a limited :require :refer
00:55gtrakarrays are there if you want them.
00:56noonianarrays and transients
00:56carkgtrak: exactly what i'm saying, non-idionatic =)
00:57gtrakcark: well, you can return a mutated array just fine, it's only if you pass the intermediate steps around that it gets to be a problem.
00:57nooniantransients are pretty idiomatic i think
00:57carknoonian: sure
00:58gtrakI tried to do this in cljs, it didn't look too bad, but it was a little annoying.
00:58carkgtrak: still you can't go about cosning like crazy and expect to maintain a pristine 60fps
00:58carkconsing*
00:58gtrakcark: cons is probably not what you want ever.
00:58carki mean allocating =)
00:58gtrakah.
00:59nooniani use cons when i want to stick something on the front of a collection even if its a vector
00:59gtrakcache thrashing from linked lists is going to hurt in any language.
00:59hiredmanin the lisp tradition "consing" is synonymous with "allocating memory"
01:00carkyes writing lisp is habit forming
01:01carki think sequences are "32 by 32" even for lists in clojure ?
01:01hiredman" still you can't go about [allocating] like crazy and expect to maintain a pristine 60fps"
01:01hiredmanwhich no one has ever argued with
01:01gtrakI've got a low-level background.. I would notice if I did something like that.
01:01hiredmancark: no, lists are linked lists
01:01gtrakthat's a problem in java too.
01:01carkhiredman: was it seqs then ?
01:01gtrakbut immutability just exacerbates it
01:02carkhiredman: i mean lazy seqs
01:02hiredmancark: seqs are an abstraction, there can be different implementions under the hood
01:02hiredmanby 32 by 32 you mean chunked seqs?
01:02carkthat's the name
01:02carkyes
01:03hiredmanthey can be, unfortunately
01:03carki'm not a native english speaker, sometimes it's a bit hard to recall a word =)
01:03gtrakyou probably don't want laziness either
01:04carkso yes there are many reasons to avoid clojure for games
01:04gtrakcark: I don't know man.. I'd use it for that.
01:04gtrakI wouldn't force myself to write java for fear of writing myself into a corner in clojure.
01:04hiredmanthere are many reasons to avoid the jvm
01:05gtrakif that's the comparison.
01:06carktoo bad though, because core.async would make for very readable code in a game (state machines everywhere)
01:07quizdri can also think of many creative advantages to using clojure for games. but "games" is such a huge category. text games, high fps games, browser games, social games, turn-by-turn vs realtime, etc.
01:07hiredmana go ai
01:07dnolenquizdr: many of which Clojure(Script) would be perfectly fine for.
01:08carkwell
01:08dnolenquizdr: playing around w/ React has made me realize you could probably be even make a ridiculous fast underlying engine that Clojure could idiomatically interact with
01:08carkthere is more than the 60fps problem, there is also the huge memory footprint of clojure data
01:09quizdrassuming clojurescript has full HTML5 support, I can't see why you couldn't have very fast graphic performance in a browser with clojurescript, if you are targeting the web of course
01:09gtrakcark: I wouldn't use persistent data-structures for fast-changing state.
01:09quizdrafter all the browser only sees javascript, right? so you get some major potential right there.
01:10carkis it you dnolen that showed me a long time ago a example of clojurescript doing a wolfenstein style labyrinth walk ?
01:10quizdrwhy would clojure data require more memory than any other program? it organizes memory differently, but why a larger footprint?
01:10dnolencark: yes
01:10carkdnolen: that was pretty impressive, but if i recall you had to cram very much in a single function
01:10dnolencark: just like the original JavaScript it was based on
01:11quizdrwell clojure is very good at cramming a lot into a single function ;)
01:11carkhaha macros upon macro ...to a 2Mb function
01:15tutysaratried the Facebook example in - https://github.com/ddellacosta/friend-oauth2-examples/blob/master/src/friend_oauth2_examples/facebook_handler.clj
01:17tutysaraIt went to Facebook for auth and came back to http://localhost:3000/authlink, I had given access for the app in Facebook login, still getting - "Sorry, you do not have access to this resource"
01:18tutysarawhat could have been wrong?
01:20kakosWhat is the best book for learning Clojure? I'm an experienced programmer with lots of experience with Lisp, Scheme, Haskell, Scala, and Java.
01:20gtrakkakos: joy of clojure
01:20gtrakor clojure-programming if you want help with tooling and such
01:21ddellacostatutysara: checking it out now, one sec.
01:21quizdri've hit three clojure books, and the most accessible is by Stuart Halloway, a good balance between useful and beginner-friendly.
01:22quizdrBut the best i've seen for a truly deep look at the language is the OReilly book which could be a bit intimidating for some readers
01:23kakosquizdr: Well, beginner-friendly is not what I'm looking for. I've programmed CLisp for a couple of decades now, so I think I can advance beyond the beginner books. I want a book that is both a good and quick introduction to the language as well as one that can be a great reference down the road.
01:24gtrakkakos: joy of clojure is the most philosophical one
01:24gtrakI've heard clojure programming is good otherwise
01:24gtrakthat's the o'reilly
01:24quizdryes the oreilly is quite a book
01:25kakosLooks like a new version of JoC is coming out in Feb
01:25quizdrJoy of clojure and also clojure in action, and also Halloway's book, are all due out now or in the next couple months with second editions
01:25gtrakthe manning MEAP on the first edition is how I learned
01:25quizdrthe one book to definitely stay away from is the Apress book
01:26testclor is an nested lazy seq like ( (...), (...)), it was got by map function which is compuation intensive, so I tried to use future to get the work done, and then combine the data, but the future doesn't work: after defind the following statement, upc is idle, when I use @r1 to defer, then it begins to work and upc is high, but I don't want it to calculated lazy, is that doable?
01:26testclo(def r1 (future (vec (first r))))
01:26testclo(def r2 (future (vec (second r))))
01:26testclo(def r3 (future (vec (take 3 r))))
01:26kakosWhat version does the O'Reilly book cover?
01:26quizdrthe Oreilly book is about 1.5 years old
01:26kakosThat's a shame. Apress has put out a few books I really liked
01:27quizdrit's very much hit or miss with Apress. they named it "practical clojure" trying to ride on the coatails of "practical common lisp" which was a runaway hit. but the clojure book is just a waste of time
01:27kakosPCL was an amzing book
01:28quizdri agree
01:28ddellacostatutysara: sorry, not sure what is up, I'm getting the same thing. May take me some time to figure out and I can't do so now--I'll put something in github issues and update it ASAP.
01:29clojurebotIn Ordnung
01:30tutysaraddellacosta: okie, sure... was it working before with Facebook login?
01:31kakosThanks for the info, gents.
01:31quizdrdo I understand correclty that use of "recur" without use of "loop" still guarantees tail call optimization?
01:31ddellacostatutysara: it was the last time I tried it, probably a few months ago. I suppose it's possible that something changed with Facebook, but not sure right now what it would be. Will investigate when I have time.
01:31tpopequizdr: correct
01:31quizdrtpope thanks
01:32tutysaraddellacosta: let me take a look at the google wf if that is working
01:32ddellacostatutysara: okay
01:33dnolenkakos: O'Reilly book is pretty much up-to-date as far as language, it's changed little, perhaps some of the tooling and library stuff needs updating
01:34quizdrthere are some examples in the oreilly book which kinda blew me away in terms of algorithm design
01:39charedoes anyone know a list of all dynamically typed functional languages besides clojure
01:40echo-areaI don't know a whole list, but Racket is one of them
01:41echo-areahttp://docs.racket-lang.org/ts-guide/
01:42chareI'm wondering what other dynamically typed functional languages look like, racket is too similiar to clojure
01:44TEttingerhttp://altjs.org some of these are functional...
01:52dnolenchare: Racket is pretty multi-paradigm
01:52charednolen: i'm looking for what other dynamically typed functional languages look like not another lisp like language
01:52tutysaraddellacosta: same error with google authentication as well
01:52ddellacostatutysara: okay, will take a look when I have time
01:53gtraksuccess...
01:53ddellacostatutysara: probably some basic configuration I'm forgetting about right now
01:53ddellacostatutysara: and it works for you with other providers?
01:54tutysaraddellacosta: I tried with Facebook
01:54ddellacostatutysara: weren't you using the github example yesterday?
01:54tutysaraand google and got the same errors
01:55tutysaraddellacosta: I had my own errors configuring Github, I will try that again and update you
01:55ddellacostatutysara: okay
02:00gtraktpope: progress, works in emacs with slight modifications.. https://github.com/gtrak/nrepl-complete/blob/master/src/nrepl_complete/middleware.clj
02:01ddellacostatutysara: sorry I know the issue
02:01gtraktpope: cljs is next, I'll let you know how I figure out piggieback detection.
02:01tpopegtrak: sweet
02:01ddellacostayou need to define a credential-fn to associate the role with the token
02:01tutysaraddellacosta: with github also same thing, i noticed it is not going to acces_token url
02:01tutysaraddellacosta: ohh okie, great :)
02:02ddellacostatutysara: take a look at the test app in the friend-oauth2 tests here: https://github.com/ddellacosta/friend-oauth2/blob/master/test/friend_oauth2/test_helpers.clj#L65-L67
02:03ddellacostatutysara: I'll update the examples with this ASAP. In the meantime that should get you going. Sorry I forgot that, and thanks for testing this out and exposing the issue!
02:04tutysaraddellacosta: thanks, yrw
02:45tutysaraddellacosta: thanks everything started working
02:46ddellacostatutysara: great.
02:46ddellacostatutysara: just saw you added a new pull request, had github changed some settings recently?
02:46tutysaraddellacosta: may i know what is the use of config-auth option for workflow
02:46quizdrin emacs how do i see the full path of the file i have open in a buffer?
02:47tutysaraddellacosta: not sure, but I had to change :access_token to :access-token and add a :identity key to extract the token
02:49peterdonquizdr: I use C-x C-v to see the full path
02:49ddellacostatutysara: hmm, strange...I'll check it out. re: config-auth, deprecated as far as I know. Will update examples.
02:51ddellacostaquizdr: I don't know how to get the file path but you can do M-x pwd for the working directory. The filename of course will be listed at the bottom above the mini-buffer.
02:52ddellacostapeterdon: nice, didn't know that one...
02:52quizdrddellacosta perfect, exactly what I needed
02:52squidzhas anybody gotten om working with lighttable?
02:52quizdrthe emacs channel ignored this rather basic question ;)
03:06piranhasquidz: not yet, I suppose https://github.com/swannodette/om/issues/58 is a problem
03:16logic_progcore.async makes programming fun again
03:16logic_progmaking every thing go "hmm, I should make this into a go process" is like learning how to program all over again
03:21logic_progwhat's a good name for a global queue
03:21logic_progthat everything throws stuff on
03:21logic_progi'm thinking of calling it "backbone"
03:22TEttinger"pile"
03:23TEttingerall praise ztellman! My game has excellent performance even on -client JVMs, thanks to primitive-math issuing at least 400 warnings about reflection in math
03:23TEttingerand fixing all of them by hand...
03:23quizdri thought for sure I saw something once about the unless function, but I don't see it in the API docs, was I mistaken?
03:25TEttingerquizdr, that's like a (when (not condition) body) right?
03:25quizdryeah
03:26quizdreasy enough to implement on one's own but I thought it was in a book I read. maybe not
03:26TEttinger,(defmacro unless [pred body] `(when (not ~pred) ~@body))
03:26clojurebot#'sandbox/unless
03:27TEttinger,(unless (= 1 2) (str "whee"))
03:27clojurebot"whee"
03:27quizdror (defmacro unless [test & branches] (conj (reverse branches) test 'if))
03:28fredyr,(when-not (= 1 2) (str "wow" "such" "doge"))
03:28clojurebot"wowsuchdoge"
03:28quizdr,(defmacro unless [test & branches] (conj (reverse branches) test 'if))
03:28clojurebot#'sandbox/unless
03:28quizdrwhoops i just overwrote yours
03:28quizdr,(unless (= 1 2) (str "whee"))
03:28clojurebotnil
03:28TEttingerhm
03:29quizdr,(macroexpand '(unless (= 1 2) (str "whee")))
03:29clojurebot(if (= 1 2) (str "whee"))
03:29fredyr,(macroexpand-1 '(when-not (= 1 2) (str "wow" "such" "doge")))
03:29clojurebot(if (= 1 2) nil (do (str "wow" "such" "doge")))
03:30quizdr,(unless (= 1 2) (str "yo") (str "not yo"))
03:30clojurebot"yo"
03:31quizdrtwo different interpretations of unless, i guess
03:32amalloyunless is just when-not
03:33quizdrah ok
03:33TEttinger,(def unless when-not)
03:33clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/when-not, compiling:(NO_SOURCE_PATH:0:0)>
03:33TEttinger:-(
03:36quizdrthat's interesting
03:41charedoes lisp and scheme have functional data structures like clojure does?
03:43TEttingeryes. not the same of course, it's never the same
03:43chareso how do their immutable data structures work?
03:43charecompared to clojure
03:43TEttingerthey don't have immutable one usually
03:44TEttingerclojure's pretty unique in the immutable persistent data types, except for stuff like haskell and maybe some ML variants
03:45charebut if you have a list A and you cons onto it to get a list B you can refer to both A and B, in that sense lisp and scheme have persistent data structures?
03:45TEttingerI've never used common lisp, from what I understand it has a lot of mutable data types
03:46quizdryes common lisp is totally imperitive if you want to use it that way.
03:46RaynesTEttinger: https://www.youtube.com/watch?v=y9zp16GJeDY
03:46quizdrmutating data is the normal thing to do
03:46quizdrin cl
03:47quizdrin common lisp I found it very confusing, however, not that the data itself was mutable, as that is easy to understand, but rather, some core functions would mutate data and others would return new data, and it was never clear unless you just memorized which did which
03:48PupnikTEttinger: popular languages usually have a lib with persistant data structures
03:48quizdrmuch easier when you know that all functions (except those with exclamation points) are returning new data, and all data is immutable unless you opt in with an agent or atom, etc
03:49TEttingertrue, Pupnik
03:55chareok so in lisp how do you do the equivalent of this haskell code foo :: [Int] -> ([Int], [Int]) foo list = (list, 5:list)
03:57chareyou guys know how to at least do that in clojure right?
03:59ucbso foo is a function that takes a collection of Int and returns a pair of two collections of Int, where the first element in the tuple is the original collection, and the second is the collection with the first items dropped?
04:00ucbchare: ^
04:00charewhat no?
04:00charethats a cons not a drop
04:00ucboh, right, sorry, haskell is not my strongest suit
04:00ucbI interpreted 5:list as pythons slice operator :)
04:01ucbin any case, this should do the trick (fn [coll] [coll (cons 5 coll)])
04:01chareand thats guaranteed not to create a copy of the list?
04:02ucbI'd think so
04:02charewhat do you mean you "think"
04:03ucbI mean I'm not entirely sure but that I think that's the case.
04:04charehow can you not be a lisp expert!!!!
04:05ucbchare: have a good day.
04:05fredyrchare: it is a persistent structure
04:05fredyrso if will share the list
04:05fredyrand not copy it
04:06charebut it will let you edit the list unlike clojure right?
04:06fredyrunlike clojure?
04:07fredyrif you mean unlike haskell, so no
04:07kawAre you asking about Common Lisp?
04:07charei mean clojure
04:07chareclojure got immutable lists right
04:08fredyrso you're talking about common lisp?
04:08chareyes
04:08fredyrok
04:08fredyrso then it is mutable by default
04:08fredyrbut for cl questions there are better channels i would guess
04:11quizdri was quite impressed with common lisp until i looked at clojure.
04:11quizdrnow i really do see what all the fuss was about with clojure.
04:12NoinafaraWhere can I read about clojure idioms for designing an application?
04:12NoinafaraI worry that my application, when I get to writing it, might well be "classical Object Oriented" - probably some variant of MVC/MVP.
04:12quizdrNoinafara that's a rather broad question. the clojure "way" is well written about in several books.
04:13Noinafaraquizdr: Any websites you can recommend?
04:13quizdrbooks, yes. depending on your background, the OReilly book or Halloway's book
04:15NoinafaraMy background is mostly python, C++ and delphi.
04:15NoinafaraBut $30 for a book is remarkably cheap - don't have the budget for one at the moment, but for $30, maybe...
04:15amalloyhalloway's book is *really* old. i wouldn't recommend it to anyone picking up the language now
04:15khaledlol
04:15quizdri'd recommend the Pragmatic Publisher's book by Halloway -- the second edition, not the first that amalloy mentions
04:16quizdrthe second edition was just released a few days ago actually
04:16khaledhow can you be in the computing world and crying like a child for money you dont have
04:16NoinafaraHmm, THe O'reilly one is a beginner one.
04:16Noinafarakhaled: No, it's just that this is far down the list of priorities at the moment.
04:16khaledlol, i dont give you the clue of how get every book you want
04:17quizdrOReilly is a deep read. If you are totally new to the language, you might get a bit further faster with the basics using Halloway's book.
04:17khaledbecause it's not fair for the wrtiter, and you have to grow up and be able to find resources on the big world of the internet
04:18amalloyquizdr: Programming Clojure 2e by halloway appears to be from 2012. where do you see it a few days old?
04:18quizdramalloy i have it let me check
04:18NoinafaraNo, I mean, O'Reilly is more of a reference, I'm after _idioms_ and _design_.
04:18amalloyamusingly, http://www.amazon.com/Programming-Halloway-published-Pragmatic-Bookshelf/dp/B00E6TU47U thinks it is over 2000 years old
04:19Raynesamalloy: Wow, the only part of Stuart that has aged past 35 is his hair.
04:19NoinafaraNo, I think what I really want is a patterns book.
04:19RaynesWouldn't think him to be 2000 years old.
04:20khaledNoinafara: go on youtube and type clojure you will find so much presentation and video tutorial by the author of books and clojure language inventor
04:20NoinafaraI don't like videos.
04:21quizdramalloy you are right, it is a different book by the same publishers about Clojure web development that was just released last week. the 2nd edition Halloway book is not that old though, same as the Oreilly, they cover the major additions to the language since the first edition
04:21khaledrick hickey in a vido it's not a video it's peace of geniuosity
04:22amalloyyeah, 2nd edition isn't *that* old. i didn't realize there was a second
04:22Noinafarakhaled: Unless it's subtitled, the video isn't much use to me.
04:22quizdrNoinafara incidentally you'll read in these books about how "design patters" are not that useful as they are in object oriented programming, where design must be crafted a lot more around state considerations that are much better by default in clojure
04:23quizdrthe one book to steer clear of is the Apress book, but most others are in pretty good shape, and second editions of two well-known books (joy of clojure and clojurein action) are coming out in the next couple months
04:23Noinafaraquizdr: Even so, one must organise the code.
04:23khaledjust this video is a "chef d'oeuvre" of two big mind http://www.youtube.com/watch?v=wASCH_gPnDw
04:24quizdrwell, do as you wish, but these are some good recommendations.
04:24NoinafaraI'm taking note of their TOC's. :)
04:32chareI just got banned from #lisp for saying clojure > lisp
04:36wedrchare: dont start flamewars :-)
04:36chareyou guys agree i'm right?
04:36chavezguchare: clojure is a lisp.
04:36chavezguclojure is not common lisp but, it is a lisp. "Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system."
04:37chareits lisp++
04:37kzarwhat's with the #clojure trolls recently? :(
04:41khaledcan i use leiningen as a replacement of ant/maven/gradle even if my project is not composed by clojure codes?
04:43chareomg this is the thing i hate about java ecosystem, wtf is the difference between ant maven and gradle
04:43quizdrkhaled it's a free country. just kidding. leiningen does automatically work with clojure dependencies, i wouldn't think it makes sense as the ideal tool if you're not using clojure
04:44khaledquizdr: ok, thanks for your advice
04:45khaledchare: lol, it seems you are not comming from the java world ;) anyway welcome to the jvm world
04:46charekhaled explain
04:48khaledchare: ant+ivy/maven/gradle are the defacto standard of the java build tools even if there are not standardized(by a jsr), and the fact you dont see see difference means you cannot comming from the java world that's all that's is
04:48khaledit
04:49chareso tell me about java world
04:49john2xping bitemyapp.. got a question about revise
04:51khaledchare: what kind of story do you want to here, i could give you some "fable"(kids stories) like "Grimm Tales"
04:52khaled-here+ear
04:52chareJUST TELL
04:52khaledansel and gretel ?
04:52khaledchare: be serious pleaz or specific to allow us to have a productive talks
04:54warpykhaled: why are projects moving from maven to gradle? how is it superior?
04:54chareso I come from haskell world khaled you gotta start from the beginnings of java world
04:55warpychare: ant, maven, gradle are build tools like cabal
04:56warpythey are based on different philosphies and hence have different ways of working and different feel
04:56khaledwarpy: some... only some, because the xml config is less hackable than a grooy dsl, and the build lifecycle is not seen in the same philosophy, in gradle everything turn around the task
04:56warpybut essentially they just compile the java code
04:56charewtf how did it end up with 3 build tools
04:57warpychare: because java has a big community and different people created different tools as per their own philosphies
04:57khaledchare: clear and simple because this had not been standardized by a jsr
04:57warpykhaled: so, gradle = ant + groovy?
04:58khaledwarpy: to be simple when you target the jvm you see like this
04:59khaled+can
05:00khaledand each tools came at different time, some are evolution other are revolution
05:01chareok so to setup what do I download i download eclipse, then somehow get clojure working????, then get which of ant maven and gradle?
05:02khaledchare: sorry i could not figure you was coming from other than the jvm world, cause in my mind every clojuriste of aprenti are a java programmer
05:02khaledchare: you can use simple text
05:02warpychare: you dont *need* eclipse for clojure. and leiningen is the defacto build tool
05:03khaledchare: sorry not simple text , but sublime text
05:03khaledchare: i found it the best text editor, but if you are a emacs user , take emacs
05:04quizdrkhaled clojure programmers are likely either java programmers or common lisp programmers. i fall into the latter groups. i've never written a line of java in my life.
05:05warpychare: i also use sublime text + leiningen
05:05fredyrquizdr: i see a venn diagram joke opportunity with that partitioning :)
05:05warpyemacs is too complicated for me ...
05:05khaledchare: http://sublimerepl.readthedocs.org/en/latest/
05:06khaledwarpy: he same for me
05:06khaled+t
05:07fredyrtbh i use to be the same
05:07fredyrbut paredit was what won me over to emacs
05:07fredyr*used
05:07warpymaybe i wrote clojure professionally, i'd give emacs a try
05:08fredyri went a weird route, sublime -> vim -> emacs -> emacs/evil
05:08khaledthe probleme with emacs if you did not learned it at school or having a peer to surround you, the learning curv is too hard comparing to intellij+lacjure eclipse+plugin sublim+repl
05:09khaledthe fact is that emacs is just a beast when you dompted this animal
05:10warpytrue
05:10warpyi am yet to try eclipse + ccw
05:10warpyhow does it compare
05:10fredyrits pretty good i would say
05:10warpyto other setups
05:10khaledwarpy: you 'll gain nothing by moving from sublim to eclipse
05:11warpythats what i feared and i stuck to subl
05:11khaledyou 'll just lost 1go of ram and 2minutes every restarting
05:11fredyrlol
05:11ior3k1khaled: I'm not sure if I agree with your statement about Emacs' learning curve. I think the only "weird" thing is that you use the language (lisp) to configure the editor
05:11warpywell, i use eclipse all the time anyway ...
05:11ior3k1coming from other editors, I expected there to be a dsl to configure emacs
05:12clgvwarpy: I work with it since more than 3 years
05:12fredyrwarpy: then you won't have problems with project setup and such, so i think eclipse might be an advantage then
05:12fredyralso iirc the repl evaluation was a bit smoother in ccw
05:12amalloyior3k1: you're arguing elisp isn't a dsl?
05:12fredyrthan sublime-repl
05:13ior3k1amalloy: not at all, it didn't seem a dsl at the time... for example, if you compare it with how vim does it
05:13ior3k1amalloy: it's hard to explain... it feels more... down to the metal
05:13khaledeclipse is just a piece of ish in term of usability, even if its architecture/ecosystem is a wonderful
05:14quizdri find emacs quite a joy to use, but its in the setup and config of emacs that i really lose patience. if you use an existing emacs config that works, that really helps. actually using emacs is not that hard, though.
05:14khaledintellij is just the IDE
05:14khaledintellij com ed+laclojure if for me better than eclipse
05:14warpyi am just used to eclipse
05:15ior3k1quizdr: I agree with the "joy" part. I have no problems configuring it as well
05:15warpyhave nothing against intellij
05:15khaledi hace everyting against eclipse
05:15khaledlol
05:15quizdrconfiguring emacs with various dev packs, scripts, etc, can get a bit messy wrap your head around
05:16clgvwarpy: you know that you can just download a CCW standalone to try it quickly
05:16ior3k1quizdr: interesting, I never felt that, once I got into the "right" mindset
05:16ior3k1I don't even use package.el
05:16clgvwarpy: for integration in your current eclipse the plugin path is the way to go.
05:17charewtf where is ubuntu ppa for latest eclipse
05:17quizdrputting all the moving pieces together, nrpel, various editing modes, paredit, etc, it's certainly more than most IDEs
05:17khaledchare: stop right now
05:17khaledchare: dont use any java thing from ppa
05:18khaledonly openjdk
05:18khaledchare: dowload eclipse from the website
05:19warpyclgv: i'll check it out next time i do something in clojure
05:19clgvchare: eclipse is an easy manual download ;)
05:19charewhy openjdk over oracle jdk
05:19khaledunpack and fix your .profile .bashrc to give the global env who could be need
05:19clgvchare: why the other way around?
05:21khaledchare: because oracle jdk is not distributed in default ppa
05:22Southyopenjdk and oracle jdk are so similar now, from Java 8 they will be exactly the same as openjdk are developing project lambda
05:22khaledyou'll only find openjdk who is the OSS project where oracle jdk is not OSS even if it's free
05:24rohniquizdr: Which is to be expected, emacs is an OS not an IDE and has various package managers to help you out, e.g. el-get ;)
05:27clgvrohni: yeah, emacs would be such a great OS if it only had a decent editor ;)
05:27kzar...
05:28khaleddefinetly, the editor is coming from another age
05:28SouthyProblem is that none of the other editors have the functionality. LightTable is probably mu best hope for a 'modern' clojure editor
05:28khaledthe only text editor i can stand who run into the terminal is nano
05:29chareI WANT ECLIPSE NOW
05:29chareWHERE IS PPA UBUNTU
05:29clgvchare: eclipse for clojure dev?
05:29khaledSouthy: for me, the best clojure editor who will come is the intellij based ide
05:30charewhat else would I need eclipse for?
05:30khaledhttp://cursiveclojure.com/
05:30Southykhaled: that will be nice, I use intellij for all my java development, but it will cost, where LightTable is now open source.
05:30clgvchare: windows/linux? 32/64Bit?
05:31clgvchare: anyway choose for yourself http://doc.ccw-ide.org/documentation.html#_install_counterclockwise
05:31khaledSouthy: no it's based on the community edition so it's free as a free beer
05:32Southykhaled: what you mean next time it's my round? :P
05:33SouthyCursive will be available as an IntelliJ plugin for use with the Community or Ultimate editions, as well as a standalone Clojure-focused IDE. It will be a commercial product, at a similar price point to PyCharm or RubyMine.
05:33Southy^ From the website you linked
05:33Southyso only free as the plugin version, not the standalon
05:33Southye
05:34Southykhaled: have you used the EAP version?
05:35khaledSouthy: yes
05:35Southyis it stable/usable?
05:35khaledSouthy: very usable
05:35SouthyI might give it a go
05:56tutysaracan we use two workflows with friend say to allow outh login using either google or Facebook login?
05:57tutysaraddellacosta: can we do something like use either Facebook or google outh to authenticate using friend-ouath2
06:01katoxis it possible to use cljx with cider-test?
06:02katoxthe tree structure is something like src/clj/ns1 src/cljs/ns2 src/cljx/ns3
06:02katoxI thought that if I mirror that in test dir, the mode would work but apparently not
06:02ddellacostatutysara: I'm sure there's a way but I can't think of a simple method off the top of my head, unfortunately.
06:02katoxdoes anyone know what to change in .el?
06:04ddellacostatutysara: would be work building a demo to give it a shot though.
06:04ddellacosta*worth
06:06tutysaraddellacosta: ;), I am thinking of passing multiple uriconfig to outh2/workflow function in a map and using the "GET /login" to show the different providers and set them in request before posting to "/login", then read the provider and use them in redirect-to-provider! and request-token functions
06:07tutysaraddellacosta: just an initial thought, haven't gone through the code much
06:08ddellacostatutysara: yeah, I'd have to dig into it again to give you a good answer, and I can't at the moment...your questions have provoked me to look at code I haven't thought about deeply in a few months. ;-)
06:09ddellacostatutysara: but I suspect it is possible.
06:11tutysaraddellacosta: agh great :). I can try doing this and see if it works, if you have some ideas on how this can be done please get back to me when you find some time
06:12ddellacostatutysara: sure--add an issue to friend-oauth2 to keep it on my radar, will you?
06:12tutysaraddellacosta: sure will do that, thanks
06:12ddellacostatutysara: thanks!
06:22noidi,(java.nio.file.Paths/get (into-array ["lol"]))
06:22clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: java.nio.file.Paths>
06:22noidi,(import 'java.nio.file.Paths)
06:22clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: java.nio.file.Paths>
06:22noidianyway, that results in a ClassCastException [Ljava.lang.String; cannot be cast to java.net.URI
06:23noidiPaths has two arities, but for some reason Clojure picks the wrong one and then complains that the cast fails http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html
06:23noidihow can I make it call the right method?
06:27clgv,(System/getProperty "java.version")
06:27clojurebot#<SecurityException java.lang.SecurityException: denied>
06:28clgvnoidi: you need to give an explicit first argument there
06:31clgvnoidi: that should work (defn paths [^String path & more] (Paths/get path ^"[Ljava.lang.String" (into-array String more)))
06:32clgvskip the type hints if you like since they are not needed
06:35noidithanks
06:35noidiit's still strange that Clojure picks the wrong method when called with one argument
06:36clgvnoidi: it does not. it picks the only available method with arity 1
06:36clgvnoidi: the other one you intended to use has arity 2
06:36clgvnoidi: the whole variable args in java is just compiler magic ;)
06:37noidiah, right
06:37noidimakes sense
06:37clgvnoidi: String... just means String[] on JVM level
06:37clgvah not even that but Object[]
06:37noidiI misread the javadoc
06:37noidias taking 0..n arguments
06:58niclWhat does & {:as something} do in function parameters?
06:58very-curious-prohttp://programmers.stackexchange.com/questions/224512/lisp-clojure-replace-parentheses-with-indents
06:58niclI know that & allows binding all further arguments. And I know :as can bind a symbol to all parameters collectively. But what does it do within curly braces?1
06:58nicl!
07:00rmrfchikare there non-greedy regexps? now (re-seq (re-pattern "X.*Y") "XfY X6Y")
07:00rmrfchikgives ("XfY X6Y"), and I want ("XfY" "X6Y")
07:03peterdon`,(re-seq (re-pattern "X.*?Y") "XfY X6Y")
07:03clojurebot("XfY" "X6Y")
07:06peterdon`rmrfchik: use .*? to make it non greedy
07:06rmrfchikpeterdon`: thanks!!!
07:07very-curious-prohttp://programmers.stackexchange.com/questions/224512/lisp-clojure-replace-parentheses-with-indents
07:10progoyeah. How about no :)
07:30quizdrif i pass a list or anything that isn't a vector to a destructuring form like [[a]] that clearly expects a vector, it works; does this mean that vec is implicityly getting called on the argument?
07:41ro_stdnolen: quick question - are om/transact! and om/update! meant to be used outside the root? or else can we mutate the atom directly and expect om to do the right thing?
07:45rurumate_,"test"
07:45clojurebot"test"
07:46jjcomernicl: The & {:as something} trick is use to group the extra params into a map. So (f :a 1 :b 2 :c 3) would bind the map {:a 1 :b 2 :c 3} to "something"
07:47nicljjcomer: nice, thanks.
07:48charequizdr do you eat at quiznos?
07:48ro_stso you can (fn [& {:as kwargs}] …) and kwargs will be a map?
07:48jjcomerro_st: yup!
07:48ro_stthat rocks
07:51charesomeone buy me pepperoni pizza
07:51charei'm hungry
07:51chareare you hungry?
07:51quizdrsince we are talking about desturing, i'll repeat my question from earlier: if i pass a list or anything that isn't a vector to a destructuring form like [[a]] that clearly expects a vector, it works; does this mean that vec is implicityly getting called on the argument?
07:57fredyr,(macroexpand-1 '(let [[a b] [1 2]] (+ a b)))
07:57clojurebot(let* [vec__27 [1 2] a (clojure.core/nth vec__27 0 nil) b ...] (+ a b))
07:58fredyrquizdr: ^^
07:58fredyrquizdr: it just expands to nth
07:58quizdrah, i see
07:59sverihi, I am trying to figure out how to work with cheshire, when i use the "parse-string" function of it i get back a PersistentArrayMap and i dont really have a clue how to work with it, does someone have example code where i could look how to do it?
08:00quizdrfredyr that's a nice trick for understanding implemenations with macroexpand even if you arent writing a macro. i dig it
08:04tcrayfordsveri: that's just a map, you work with it like any other map in clojure
08:04tcrayfordIf that's confusing to you, I guess you should go look at some beginner tutorials
08:06jjcomersveri: I know one gotcha with cheshire is that it will parse json keys to strings unless you use (parse-string json-str true) which will use keywords
08:06tcrayfordnote that if you're parsing arbitrary user data, you always want to parse to strings
08:06tcrayfordotherwise you can cause some "interesting" GC problems for your jvm
08:07jjcomervery true :)
08:07sverijjcomer: thanks for the hint, thats one thing that bugged me
08:07sverithat i could not use keywords
08:08fredyrquizdr: yes it is :)
08:08tcrayfordsveri: note 99% of the time, unless the json source is completely trusted, you want strings anyway
08:08sveritcrayford: thank you too, i read a lot of tutorials and i am on my second book already, but without some hands on experience its hard to connect the dots
08:09sveritcrayford: but isnt it easier to work with using keywords?
08:09tcrayfordsure is, but it won't cause your JVM to crash
08:09tcrayford(as in, keywords can, strings won't)
08:10sveritcrayford: ok, that makes sense, so to get soemthing out of it i have to use (get map "key"), right?
08:10tcrayfordyeah
08:11sveriok, thank you all very much :-)
08:11tcrayfordor you could convert a safe set of the json keys to keywords (which is what I usually end up doing)
08:11tcrayfordlike, parse json, do select-keys, then just convert toplevel keys to keywords
08:12sveritcrayford: ok, i may try that later :-)
08:13jjcomersveri: Instead of 'true' you can pass in a function for key parsing, into which you could build in some defensive parsing
08:26borkdudewhat is the opposite of select-keys
08:27tcrayfordborkdude: what do you mean?
08:27borkdudetcrayford I mean, remove keys from a map
08:27borkdudekey-vals
08:27tcrayfordnot sure there's an inbuilt for that specifically
08:27tcrayfordguess you can just use filter though
08:28borkdudesure ok
08:28cemerick,(dissoc {:a 5 :b 6 :c 7} :a :c) ; borkdude: what about this?<<
08:28clojurebot{:b 6}
08:28tcrayfordhaha, welp
08:30borkdudelol
08:31borkdudeThat is what you get when you don't program Clojure for 3 months... #crying
08:32tcrayfordI've been nearly full time in clojure since uh, before leingingen existed, and I forgot it :/
08:32tcrayfordam currently all up in the guts of lein uberjar spitting out corrupt jars during downtime though, so not toooo surprised
08:34ddimaborkdude: personally I always have a laminated version of the clojure cheat-sheet on my table ;)
09:22qerubIs there any way to disable Leiningen's standard JVM switch `-XX:TieredStopAtLevel=1` when using `lein try`?
09:23qerubAh, unsetting LEIN_JVM_OPTS might work… D'oh.
09:23tcrayfordyou can also use ^:replace
09:24qerubAh, yes. Thank you qerub. :p
09:24qerubtcrawley: I have no project.clj when using `lein try`.
09:24tcrayfordoh, haha
09:24tcrayfordtrue
09:25tcrawleytcrayford: again? one of us has to go.
09:25tcrayfordhaha
09:26qerubtcrayford, tcrawley: Oh, sorry about that. But yes, one of you has to go. ;)
09:26tcrawleyqerub: heh, no worries
09:28hyPiRionqerub: yeah, the trick is to do `export LEIN_JVM_OPTS=''`
09:30clgvqerub: why is that jvm option important if you are only trying something?
09:31qerubclgv: I like to use `lein try criterium some-library-a some-library-b` for one-off benchmarking.
09:33qerubLike here: https://gist.github.com/qerub/8031665 (Anybody else find that result surprising BTW?)
09:34hyPiRionclgv: it's because Clojure programs are very slow to startup, so Leiningen uses some specific options to speed up startup at the sacrifice of advanced optimisations. Some JVMs don't have those options available, and sometimes you want those advanced optimisations
09:35clgvqerub: just add criterium to ~/.lein/profiles.clj
09:35clgvhyPiRion: I know. I was just curious about his motivation.
09:36hyPiRionah
09:36qerub[cont.] I'd expected commons.lang3.StringUtils.split(Char) to beat Pattern.split(String)…
09:36qerubclgv: Yeah, I could do that. Thanks.
09:37qerubOh, damn, I should avoid reflective calls.
09:38clgvdefinitely
09:39qerubI'd incorrectly assumed that Clojure would infer all the needed types.
09:39qerub*rebenchmarking*
09:39clgvnot in interop when there are overloaded methods
09:40clgvwith same arity
09:40hyPiRionyay lein check
09:41qerubI had (def test-input "a string") and (org.apache.commons.lang3.StringUtils/split test-input \.) and had assumed test-input would be annotated as ^String automatically.
09:42clgvhyPiRion: yeah I had an alias for the same task until a few weeks ago when I noticed there has been added a lein task to do that
09:46AeroNotixgrrr emacs is segfaulting
09:46AeroNotixI have some plugin which makes it segfault
09:46AeroNotixnot sure which one
09:46clgvlol I first thought the purpose of the plugin is to segfault it :P
09:47AeroNotixyeah that'd be pretty useful
09:47AeroNotixM-x segv
10:23daGrevisi'm trying to re-implement if as a macro just for fun
10:23daGrevisthis is what I have so far http://vpaste.net/eTtpA
10:23daGreviswhy isn't get call returning correct quoted-expr?
10:26jcromartieyou need to quote the return value of your macro
10:29daGrevisjcromartie, something like this? http://vpaste.net/RplCu
10:32shafirehi
10:33shafiredo you have noticed differences running clojure on openjdk7 or oracle jvm7?
10:33coventrydaGrevis: That evaluates both branches.
10:34daGreviscoventry, nop, no branch is evaluated
10:37coventryYou're right, neither branch appears in the macro output, which is also a problem. :-)
10:39daGreviscoventry, http://vpaste.net/b5scV i get correct cond returned. don't know how can I say to eval it instead of returning it thought :(
10:39clojurebotExcuse me?
10:40carkdoing a map lookup for an if expression is kind of heavyweight =)
10:42daGreviscark, that's not the point here. :P just wanna see if I can really implement if. that would be so awesome! :)
10:42cark=)
10:44daGrevislol any help
10:46tutysarasritchie: hi, I was able to run the examples from friend-oauth2, we were missing the credential function and after correcting that, things were fine
10:46sritchienice
10:47sritchiemake sure it works with a failed auth too
10:47marukswhy is fn a macro ? (macroexpand '(fn [x] x)) => (fn* ([x] x))
10:47tutysarasritchie: i haven't tried a failed login, thanks for bringing that up, let me try that. any luck on the blog post
10:47maruks(macroexpand '(fn [x] x))
10:48jonasenmaruks: fn has built in destructuring. fn* does not
10:48maruksOMG fn turns into fn*
10:48maruksok, I see
10:48sritchietutysara: polishing this AM :) so easy to procrastinate on writing. thanks for the push, let me get to it
10:49jonasen,(macroexpand '(fn [[x y]] x))
10:49clojurebot(fn* ([p__27] (clojure.core/let [[x y] p__27] x)))
10:49maruksawesome
10:49tutysarasritchie: I am also looking to implement a workflow that support authentication using either Facebook/Google/Github where the user selects one of the providers to authenticate, did you tried something like this?
10:49sritchieyeah, but not for login
10:52tutysaramost websites usually give some combination of them for oath, and I wanted to give these options to the user :)
10:53`cbp
10:53tutysarasritchie: I saw from the comments to one of the issues in friend-oauth2 that you had implemented a workflow on your own, does it support multiple providers?
10:53tutysara:)
10:54sritchieyeah, I can gist it
10:54clojurebotHuh?
10:55sritchieit does the token negotiation and callback, etc for a bunch of providers
10:55sritchieBUT, I haven't written anything for storing the tokens, etc
10:55tutysarasritchie: wow fantastic, yes please if you have some time
10:55sritchieyeah, one sec
11:03coventrydaGrevis: You likely can't write if without using primitives which use if in their own definitions. It's a special form. "http://clojure.org/special_forms#Special Forms--(if test then else?)"
11:04coventrydaGrevis: You could write a version like yours which evaluated both branches and only returned the results from one branch, but that has different semantics, which are important if one of the branches has side effects.
11:04carkcoventry: he's not in chan anymore
11:04coventryThanks. Oh, well.
11:05sritchietutysara: https://gist.github.com/sritchie/9a7d9b1b22339a6e2dff
11:07sritchietutysara: so the way this works is that you navigate to yoursite/oauth/facebook, or /oauth/strava -
11:07sritchieand if that particular provider is in the config map,
11:07sritchieboom, it negotiates
11:07sritchieusing that schema that I laid out
11:08sritchieI haven't tried that standalone, just migrated it out of hte project,
11:08tutysarasritchie: cool, let me try with a couple of providers and see how it all goes
11:09sritchienice
11:09sritchieyou'll need liberator and compojure for this...
11:09sritchiethat's about all
11:09sritchieoh, cheshire, clj-http
11:09sritchie[crypto-random "1.1.0"]
11:17matt444Is there a function that calculates where a number falls between a min and max number?
11:17matt444Or should I write my own?
11:18matt444for example (fake function name): (between 0 10 15) ;; returns 10
11:18matt444(between 0 10 4) ;; returns 4
11:18mdrogalis,(contains? (into #{} (range 10) -1))
11:18clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/into>
11:18mdrogalis,(contains? (into #{} (range 10)) -1)
11:18clojurebotfalse
11:19matt444mdrogalis: I thought about range but those are ints
11:19matt444I need to support arbitrary floats
11:19mdrogalismatt444: Ah, yeah you're on your own. :)
11:19matt444mdrogalis: thanks, thought i'd ask first
11:20bbloommatt444: i believe the function is generally called "clamp"
11:20mdrogalisSure :)
11:20coventry,(#(max %1 (min %2 %3)) 0 10 4)
11:20clojurebot4
11:21matt444bbloom: not in clojuredocs, you're saying i can find one though?
11:21kzarmatt444: something like this? (defn between [& args] (second (sort args)))
11:21matt444coventry: will try this real quick
11:21dnolen,(let [x 2] (< 1 x 3))
11:21clojurebottrue
11:21dnolenmatt444: ^
11:21bbloommatt444: it's not in clojure, that's just the common name for a function that takes three numbers and min/max-es it in to range
11:22matt444wow, lots of good answers, thanks everyone
11:22mdrogalisbbloom: TIL. Nice
11:25TimMckzar: Oh, that's cute!
11:25kzar?
11:25kzarOh sorry I forgot I had posted some code there
11:26TimMckzar: second sort
11:26sritchietutysara: lmk how it goes
11:26sritchieI can package this up into a lib if it's useful
11:28tutysarasritchie: looks neat and pleasent with records and all keys in inputs listed
11:28tutysara:)
11:28sritchieyeah, the schema stuff is good
11:29jcromartieso Enlive doesn't like headers inside anchors
11:29jcromartiealthough that's valid HTML5, so I'm told?
11:30tutysarasritchie: would be great if it could be made into a general purpose lib
11:30sritchietry it out and let me know if you run into any issues with your other providers;
11:30sritchieif you need extra params, etc
11:30sritchiethen let's do it
11:30sritchieI'll make a project
11:35zerokarmaleftsritchie: can you explain what you're doing with (= :dev mode) in the facebook config?
11:35sritchieyeah, I'm using the test oauth tokens, instead of the live ones
11:35sritchiein development mode
11:36sritchieyou can set up test and prod API keys when creating a facebook app
11:36ddellacostasritchie: that code looks familiar ;-)
11:36sritchie:)
11:36sritchieddellacosta: yeah man, let me add a credit to the gist -
11:36tutysarasritchie: yes have noticed it
11:36ddellacostasritchie: thanks. :-)
11:36sritchieddellacosta: also, if you can figure out how to merge this into your stuff, let's do it
11:36ddellacostasritchie: yeah, dunno. There's a bigger conversation to be had re: future of Friend
11:37tutysara(s/optional-key :auth-query) {s/Keyword s/String}}) - can this be replaced with something else
11:37zerokarmaleftddellacosta: that sounds ominous
11:37sritchieadded: https://gist.github.com/sritchie/9a7d9b1b22339a6e2dff
11:38sritchieddellacosta: cemerick, gotta get some love from you on friend!
11:38sritchieddellacosta: I'd be happy to help with Friend stuff
11:38sritchieddellacosta: we just need to get some types in play, and think a bit more about the API
11:38sritchieit confounds routing with workflows
11:38ddellacostazerokarmaleft, sritchie: yeah, I mean, I think it's telling that sritchie had to role his own to get it to work smoothly for him. I'm pondering the right way to do this.
11:39sritchiewell, this was because I;'m not logging in with oauth2
11:39sritchieI wanted to negotiate for the tokens to associate with a user acct
11:39sritchiebut yeah, clearly it's similar
11:41ddellacostasritchie: yeah. Probably shouldn't start this conversation late on my Friday night after I've had a few beers...haha. But seriously, I think there are some things to think about here. I think the Clojure web stack needs an easier authn/authz lib, which was Friend's original motivation, but it's not quite there.
11:41zerokarmaleftsritchie: ok, so you're just redacting boths sets of keys
11:41sritchieyes
11:41sritchieyeah
11:42zerokarmaleftsritchie: also, why aren't you using schema with the facebook config? I'm not familiar with its usage
11:42sritchieand leaving the original function structure that I'm using
11:42gtrakibdknox: would light table have anything to say about nrepl middlewares? I'm working on an auto-complete implementation that'll work with piggieback.
11:42sritchiezerokarmaleft: oh, whoops
11:42sritchiejust forgot to
11:42zerokarmaleftsritchie: ok :)
11:43sritchiefixed
11:43tutysarasritchie: ohh nice, let me refer to the latest gist
11:44tutysarasritchie: :require [schema.core :as s - this code is from which lib?
11:45sritchiefrom prismatic's schema
11:45sritchieI added the required deps at the bottom
11:45jcromartieI'd like enlive to work with HTML5… seems like a sensible thing, no?
11:45lvhHi!
11:46jcromartiehttps://github.com/cgrand/enlive/issues/90
11:47cemericksritchie, ddellacosta: just replied briefly to the friend-oauth2 issue that's been threading the past couple of days. I'm not really clear on what the problem(s) or suggestion(s) are.
11:48sritchiecemerick: link?
11:48cemerickhttps://github.com/ddellacosta/friend-oauth2/issues/13#issuecomment-32574048
11:48lvhSo, I'm a clojure newbie; I'm trying to wite some code that will do hotel room allocations. I have a bunch of users; users consist of names, genders, start dates and end dates
11:48sritchiethe fact that two of the three return values from a workflow are just maps is confusing, I think
11:48lvhWhat would be the appropriate data structure to use? A list of whats?
11:48sritchieand the use of structural typing to distinguish a friend auth map;
11:49sritchiecemerick: in a sort of undocumented way was really confusing
11:49lvhMaps would work, but seem a bit silly for something with such a fixed record like structure.
11:49lvhalso, are genders something I should break out symbol for, or not?
11:49cemericksritchie: you mean, credential map vs. ring response map?
11:49sritchieyes
11:49sritchiecemerick: I think wrapping records, like (defrecord Authentication […..]) and (defrecord RingResponse [m]), or even just the first,
11:49sritchieand assume that any other response is ring,
11:49sritchiewould be helpful
11:50sritchiecemerick: or even a workflow protocol -
11:50sritchiewith "accept?", "handle", where "handle" returns either an Auth map or a failure
11:50sritchiecemerick: the other issue, I think, is that routing is handled inside the workflows -
11:51sritchie"accept?" is sort of tied up with routing
11:51cemericksritchie: isn't that just replacing one predicate for another?
11:51sritchieyou mean replacing the internal wrapping (when pred … ) that all the workflows use?
11:52justin_smithlvh: a map of maps, don't use a list when you want to be able to look things up
11:52justin_smithif you hit a performance bottleneck, change the map of maps to a map of records
11:52cemericksritchie: I'm talking about s/metadata on a map/record type
11:53justin_smithlvh: the reason to wait is that for interactive development changing the record on the fly leads to annoyance and fumbling, and the syntax for working with maps vs. records, once they are created, is identical
11:53sritchiecemerick: I guess it'd be good for me to write up what I find confusing
11:53lvhjustin_smith: Okay, fair enough :)
11:53lvhjustin_smith: I don't really want to look things up though. I'm trying to pair people.
11:54justin_smithlvh: pairing based on what?
11:54lvhjustin_smith: Matching start, end dates + matching genders.
11:54justin_smithI assume once you have a pair you need to look up the people paired for example
11:54cemericksritchie: Please. In any case, the current approach is pretty clearly documented in the README. Flowchart diagram and everything! :-P
11:54sritchiethere's for sure WAY more documentation than teh typical lib
11:55sritchiemajor props for that
11:55lvhjustin_smith: I'd expect the pairing function to return a list of pairs of people; what lookup am I issing?
11:55lvhmissing*
11:55cemericksritchie: now what's this about routing?
11:55sritchiebut even with all that, it's telling that both ddellacosta and I, after many hours of working with the lib and implementing workflows, both find it quite confusing
11:55sritchiecemerick: well, many workflows only apply on certain routes
11:55sritchiethe interactive-form takes a path, for example, and returns nil for requests that aren't hitting "login"
11:56sritchiecemerick: life became really hairy when I wanted to write a json login that applied to some path, but had to give different responses for different accepted content types
11:56sritchieso I was having to use compojure's internal route matching code in my workflow
11:57sritchiecemerick: since I wanted to log a user in at "/oauth/:provider", for example
11:57justin_smithlvh: but, if you consider the flow of actions, I assume you have a list, you extract two matches, and return what remains - it may be simple to assoc by a unique identifier, and update to mark as matched with some id, and then search the list for unmatched on the next go
11:57cemericksritchie: why internal? A workflow is just a function, so can be the top-level of a (logically-speaking) whole other ring app, if desired.
11:58jcromartieany reason why someone *wouldn't* want to use Jsoup for enlive? seems like it should be the default
11:58jcromartieit is much more up to date than tagsoup
11:58justin_smithlvh: though of course implementation is up to you, you could just have a list, and return a list with the matches removed - but then your code spends a lot of time list-walking...
11:58sritchiecemerick: what if I want to wrap that in two workflows?
11:58sritchiecemerick: if I wrap an inner ring app,
11:58sritchieand I want to auth on /oauth/:token,
11:59sritchiehow am I supposed to have my workflow catch taht response and do auth?
12:00cemericksritchie: Now I'm confused. Workflows aren't middleware, they can't catch responses...
12:00cemerickAre you wanting to redirect to a login upon an unauthorized req?
12:00sritchiecemerick: so what's happening here
12:00sritchiehttps://github.com/cemerick/friend/blob/master/src/cemerick/friend/workflows.clj#L75
12:00sritchiewhen login uri, and a post request...
12:01lvhjustin_smith: Suppose I write a function that does the eager-match part (so finds one pair of exactly matching (gender, start-date, end-date)); how would I keep calling it until it doesn't work anymore (ie there are no exact match pairs left; either no-one left, one person left, or only inexact pairs left)?
12:02sritchiecemerick: that workflow is absolutely intercepting that response
12:02cemericksritchie: there's no ring response anywhere there
12:03justin_smithlvh: you could iterate or loop and take results until no new matches are found, then return matches + unmatched
12:03cemericksritchie: `request` is a ring request; the fn returned by `interactive-form` validates the credentials it provides, or passes the request on to the login failure handler
12:03sritchiecemerick: that line I pointed to us confounding routing for sure
12:04sritchielike, say I wanted to build this, but log in a user to a custom account
12:04sdegutisSo, it turns out Swing is kind of hard to "theme". Making it look like Windows 8 seems pretty intimidating.
12:04sritchie"/accounts/:custom-account-id/login"
12:04sritchiecemerick: how would you deal with that?
12:04broquaintsdegutis: Not even when using (native!)?
12:04broquaint(From seesaw)
12:04jcromartiesdegutis: make your app "authentically Java" :)
12:04cemericksritchie: by not using the stock interactive-form workflow, which presume a single fixed login URI :-)
12:05tutysarasritchie: [paddleguru.util.liberator :as l -> can you change this in gist when you find time
12:05jcromartieor "unapologetically 90s"
12:05sritchiecemerick: so, most of the guts would be the same
12:05sritchiebut they're trapping inside that (when <route-matches> … ) predicate
12:05justin_smithlvh: something like this, I wrote it but haven't ran it :) (loop [matches [] unmatched input] (if (empty? unmatched) [matches nil] (let [match (find-match unmatched)] (if match (recur (conj matches match) (remove-matches match input)) [matches unmatched]))))
12:06sritchiecemerick: I'm not trying to bust on your library, I'm using it and like it
12:06cemericksritchie: There's no reason why a better interactive-form workflow couldn't just return a ring handler that uses all the usual userland compojure bits to do whatever routing it wants prior to or as part of authentication
12:06justin_smithmaybe find-match could return the match + the things not matched and remove the remove-matches step
12:06sdegutisbroquaint: I'm not on Windows 8 so no :)
12:06sritchieI'm just giving feedback that it's extremely confusing, and I think I have a tremendous tolerance for confusing code, after my monad trips
12:06sdegutisjcromartie: you mean just use the Metal look-and-feel?
12:06cemericksritchie: no worries; I just think you're expecting the default workflows to do more than they do :-)
12:07sritchieI can gist the code that I had to write to handle content type negotiation in these workflows
12:07cemericksritchie: the line you pointed out is there in the form it is because I didn't want friend to require compojure
12:08cemericksritchie: if you did it without writing a new workflow, then I suspect it's pretty gnarly
12:08sritchieno, I wrote new workflows
12:08cemerickoh; well, then I'd expect it to be pretty sane ;-P
12:10coventrysdegutis: How did you get stuck with the job of making a windows-8-themed app out of swing?
12:10sdegutiscoventry: That's a different way of looking at it.
12:11sdegutiscoventry: I just want to make something like LightTable (i.e. a flat theme) but in Clojure.
12:12broquaintsdegutis: Aha :)
12:12coventryOh, sounds like a fun project.
12:12sdegutisI thought it was going to be fun. But then I got stuck early on trying to make it look pretty.
12:12sdegutisAnd it looked really intimidating to do in Swing.
12:13sdegutisCall me shallow, but I don't want to use an app that isn't pretty, and I won't write an app that I won't use. So I put the project on hold.
12:14lvhjustin_smith: I'm having trouble parses that (if (empty? unmatched) [matches nil] (let ... ;; isn't an if supposed to have two exprs in it?
12:14justin_smith[matches nil] is one expression
12:15justin_smithand it should have three - the condition, the true case, and the false case
12:15lvhjustin_smith: yes, I just realized how to parse that; sorry, brainfart :)
12:15justin_smithnp
12:16justin_smithI so often use the "small literal vector to return multiple values" idiom that I forget it can be non-obvious
12:16lvhjustin_smith: So, (if match (recur ...)) means (if (nil? match) (recur ...)); right? Is truthiness-to-check-for-nil idiomatic?
12:17justin_smithyeah, very much so - and it is (if (not (nil? match)) ...
12:17lvhjustin_smith: Awesome, thanks. Dinnertime for me, but thank you for the help so far!
12:18justin_smithnp, glad it was helpful
12:21sdegutisAnd man, LightTable is so nice looking these days. I can't wait until someone completes the paredit plugin, then I can use it full time.
12:22lockssdegutis: that person could be you ;)
12:22sdegutislocks: I am not talented enough to do that.
12:23sdegutisPlus I imagine AST mutation is probably not pleasant or easy in Clojure.
12:23jcromartiesdegutis: how do you mean?
12:24justin_smithsdegutis: clojure excells at it, it's just a dissoc followed by an assoc and then replace the state
12:24justin_smithit's like maybe one of the things clojure is most bestest at
12:24sdegutisjustin_smith: even when the dissoc and assoc are deep within a nested structure?
12:24sdegutis(and in different places)
12:24justin_smithupdate-in
12:25lvhjustin_smith: I'm surprised remove-matches is a function; I'd expect there to be a dissoc or unconj or something
12:25lvhjustin_smith: althoguh perhaps you wrote that with different implementations in mind
12:25justin_smithlvh: it's pseudo-code :)
12:25sdegutisI figured you couldn't use update-in because it'd be hard to build the traversal param at runtime.
12:26justin_smithsdegutis: well, you could use a zipper instead, but in my experience a known path to the thing you are grabbing / spot to insert suffices
12:27sdegutisHmm maybe I just need to redesign my AST then.
12:27mikerodclojure.walk :)
12:27sdegutisOh wait, I don't have an AST, I gave up on it because I couldn't make the app look pretty in Swing.
12:29gtrakwhy does piggieback get an atom in the message's :session key, but my middleware gets a uuid-str?
12:29gtraknrepl middlewares
12:29sdegutisIt's kind of strange that HTML+CSS is the easiest way to customize how a cross-platform app looks. Surely we'd have done better by now.
12:29justin_smithgtrak: because of the order of the middlewares I assume?
12:30gtrakjustin_smith: would you know which one's responsible?
12:30justin_smithno, not at all, sorry
12:30gtrakthat's my guess, too.
12:30justin_smithI usually do a binary search repositioning the middleware that isn't seeing the data transformation it needs :)
12:31justin_smitheventually you find the magic spot
12:31gtrakI usually do a brute-force search..
12:32justin_smithwell, since order is significant, binary search is faster - anything after the magic one gets the data it needs, anything before does not
12:32justin_smiththough of course before and after can be tricky concepts with some middleware :)
12:33gtrakah yea.
12:39gtrakyea, ok, it's the session middleware.
12:41lvhjustin_smith: During dinner, a background thread joined, and suddenly your map comment made total sense.
12:41justin_smithheh, do tell
12:42lvhjustin_smith: If I turn everthing into a {[gender start-date end-date] [people...]} map, suddenly it's way easier to generate the pairs.
12:43justin_smithand you can generate that with a group-by
12:44justin_smith(group-by (juxt :gender :start-date :end-date) people)
12:44justin_smith(inc juxt)
12:47jocrauI am experimenting with om (https://github.com/swannodette/om). How can I deref the current application state (from root) in an event handler? (to sync the client app state with the server app state)
12:48jocrautried (om/read state #(put! endpoint/outgoing-changes (om/join % [])))
12:50lvhjustin_smith: why would I increment juxt?
12:50justin_smithI was trying to
12:50justin_smithit is an informal channelism to show appreciation
12:50justin_smith$karma juxt
12:50justin_smiththere was no result shown since I have already incremented it in the past
12:51lvhjustin_smith: Ahhh; okay, that makes sense :)
12:51justin_smithahh, lazybot is not online it seems
12:51lvhSomehow in #python we end up doing x++ even though it's not even valid syntax
12:51justin_smithright
12:51justin_smithsame deal
12:52lvhkeywords being functions is still kinda crazy to me but I guess I'll get used to it :)
12:52matt444How can a function (not a defn) refer to itself?
12:52bbloomlvh: keywords being functions is the single best idea in clojure
12:52justin_smithmatt444: letfn
12:52justin_smithmatt444: or named fn
12:53matt444justin_smith looks let letfn is what i need, thanks
12:53justin_smith,((fn example [x] (if (< x 5) x (example (- x 10)))) 33)
12:53clojurebot3
12:53matt444oh
12:53justin_smithsee above if you just want an fn that refers to itself
12:53matt444didn't know you can do that
12:54justin_smithalso the (fn some-name []...) thing makes stack traces much more readable
12:54lvhSo, I'm using a fairly standard lein new whatever ;; project with emacs. I figured out how to do cider-jack-in; is there an easy way to run the tests, or do I just use lein in a term
12:54bbloommatt444: it's also useful as "documentation", like if you have (f #(whatever) #(other-thing)) and can't remember the order of arguments, you can use (fn some-name ...) to clarify
12:54justin_smithlvh: I like to require clojure.test in the repl and (test/run-tests)
12:55justin_smithbbloom: yeah, good point - naming helps clarify intent
12:56coventryjocrau: It's a bit messy, but try (.-value %) instead of om/join.
12:57lvhjustin_smith: (require "clojure.test") doesn't seem to be it. How do I spell that?
12:57lvh(Also paredit-mode appears to be off in my REPL window by default; will things go horribly wrong if I enable it? That seems like an obvious win to me)
12:57justin_smith(require '[clojure.test :as test])
12:57lvhjustin_smith: Thanks! Why is that vector quoted?
12:58lvhI feel bad asking soo many silly questions :)
12:58olliefris there a way to EASILY plot stuff in Clojure, ideally from the console. i am exploring simple dynamical systems (discrete iterative functions) and they work well in Clojure because of lazy sequences, but i would like to be able to plot the orbits as well - a quality xy scatterplot would suffice
12:58justin_smithbecause clojure.test is a symbol in that expression, as is test
12:58justin_smithlvh: sometimes output from the repl confuses paredit, such that I need to C-u M-x paredit-mode in order to force it to turn on even though things are not balanced
12:58lvhYay! that worked. Thanks :) also has the benefit that it doesn't take six hours to run the tests :)
12:59justin_smithlvh: otherwise it seems to work
12:59justin_smithlvh: just remember to reload any definitions / reload any changed test namespaces before running the tests again, of course
13:01lvhI'm assuming that using java.util.Date is okay? IIRC it's immutable, so that's nice.
13:02technomancya reasonable-looking assumption, unfortunately one that is not correct
13:02technomancyjava.util.Date is the opposite of okay
13:03bbloomlvh: it's MUTABLE
13:03bbloomlvh: in jvm land, the correct answer is: "use joda time"
13:03lvhthat is unfortunate
13:04bbloomthere are several clojure wrappers for joda time, but i don't know if any are good
13:04technomancyquite =(
13:04bbloomshouldn't be too problematic to use joda time directly
13:04lvhhm
13:04bbloomalso, time is hard.
13:05bbloomeven more unfortunate is js/Date
13:05justin_smith,(class #inst "2014-01-17T18:02:19.115-00:00")
13:05clojurebot#<SecurityException java.lang.SecurityException: denied>
13:05technomancyhow can it be worse?
13:05bbloomwhich copies java.util.Date and all of its flaws, then manages to add some new ones too
13:05justin_smith,(type #inst "2014-01-17T18:02:19.115-00:00")
13:05clojurebot#<SecurityException java.lang.SecurityException: denied>
13:05justin_smithblergh
13:05bbloomtechnomancy: oh, it can be worse
13:05lvhclj-time looks nice
13:06technomancycopying the zero-indexed months struck me as pretty hilarious
13:07jocraucoventry: That was the right direction, thanks. Wrapped it in om/allow-reads and deref on -state.
13:09coventryThere's got to be a cleaner way to do this sort of thing.
13:10jocrauAgreed. It's pre-alpha though and already a lot of fun stuff in there.
13:11coventryOh, yeah, it's great, I'm just hoping someone will come along and recommend such a more skillful approach.
13:13lvhcalendaring is always pretty hard
13:13coventrys/such a/a/
13:13lvhI mean come on leap days inserted in the 24th, except recently, when its the 29th, unless you're in hungary
13:14bbloommeanwhile, even UTC is fucking broken. damn leap seconds
13:16justin_smithhell, leap seconds even break the unix epoch counter
13:17technomancyone good way to detect an advanced civilization is to find a planet whose year is an even multiple of its day
13:17technomancybecause it's easier to shift the orbit of your planet than to deal with leap years, leap seconds, etc
13:17jjl`_that was my next question
13:17koalalla1ayup. throw up some sails and slow down the planet
13:17justin_smith(inc technomancy)
13:18jjl`_koalalla1a: er no, it's slowing down, not speeding up
13:18koalalla1ajjl`_: i imagine some planets have the opposite problem too though
13:19rplacait's funny how some of the easiest seeming problems in CS (like time and date management and text formatting) actually turn out to be some of the hardest
13:19bbloomtechnomancy: lol awesome
13:19koalalla1anot funny at all. it's very disturbingly sad and frustrating
13:19bbloomtechnomancy: one day we are all startled awake
13:19bbloom... by the acceleration of the planet
13:19rplacakoalalla1a: I meant funny strange, not funny ha-ha
13:19bbloomsome guy working on calendaring software HAS HAD ENOUGH
13:20technomancyrplaca: it's really all very simple until you have to start accounting for humans
13:20koalalla1arplaca: i know, just being a pain ;)
13:20rplacakoalalla1a: :)
13:20jcromartie"funny uh-oh"
13:20kzarI've spent the last 2 or 3 months adding timezone support into a legacy application written in Javascript and Python
13:20rplacatechnomancy: eventually the system will eliminate that problem
13:20lvh(inc technomancy)
13:20koalalla1athat kind of funny makes me want to throw my hands up and become a dog walker
13:20lvhis it promising if I think that is gross because it is side-effectful
13:21justin_smithyes
13:21lvhI mean I just created a new technomancy with more karma!
13:21kzarif you can avoid doing calendars / dates/ times / timezones please do
13:22lvhit makes perfect sense for your timezone to be 1hr and 40s before GMT
13:22lvh(I'm looking at you, Sweden)
13:22bitemyappkzar: bet you'd kill for a non-terrible type system right about :)
13:22rplacathe only thing I've found that even comes close for dealing with time is Joda time
13:22kzarI found a bug in chrome and a bug in moment-js so far along the way
13:23rplacait's far from perfect, but way ahead of the other systems (esp. what's avaialble in languages like python and JS)
13:23rplaca*available
13:24kzarI recommend this video http://www.youtube.com/watch?v=GBKqRhn0ekM
13:24kzaralthough nothing will really prepare you for the crazy
13:24jjl`_for most purposes, it's not too painful. i'm glad i won't be programming when we start adding multiple leap seconds a day though
13:27kzarI really want to get a job doing clojure so I can spend my time learning clojure instead. It's hard to learn much in evenings when you've been coding all day
13:28jcromartiekzar: I'd recommend finding a local Clojure meetup
13:28kzarI'm not sure there are any in Bristol
13:29shep-werkkzar: not yet :-)
13:31lvhHow do I drag in deps in my project.clj? I'm in emacs but my file won't compile: FileNotFoundException Could not locate clj_time/core__init.class or clj_time/core.clj on classpath: clojure.lang.RT.load (RT.java:443)
13:32technomancylvh: typically you restart your repl when you ad deps, but there is athing called alembic that lets you avoid restarts
13:33lvhtechnomancy: so cider-restart?
13:33lvhtechnomancy: Cool, thanks :)
13:33olliefrkzar yo bristol functional is a good start
13:33olliefrkzar nokia here in bristol develops in clojure and they host bristol functional
13:33kzaroh sweet
13:33jcromartiebig ups to the bristol functional mandem
13:34kzarhaha
13:34kzarolliefr: sound I'll go to the next one
13:34olliefrkzar http://brisfunctional.github.io
13:35olliefrkzar there's a google group; all the announcements are there
13:35bitemyapplvh: (require '[alembic.still :as alembic]) (alembic/load-project)
13:35nDuffHeh.
13:35TimMctechnomancy: Tidal resonance could also account for that.
13:36technomancyTimMc: could it fix things on earth, because that would be awesome; let's get some more tides going.
13:37TimMcI dunno. I think the Moon's influence probably complicates any Earth/Sun resonance.
13:38lvhWhere can I find the differences between use/load/require/import etc?
13:38lvhThey are completely opaque to me
13:40justin_smithlvh: load is for ugly ass hacks
13:40justin_smithlvh: use is for the repl
13:40`cbpimport for java classes, require for clojure vars, load to run clojuree code in a file, use to never be used
13:40justin_smithrequire is for actual code you ship
13:40justin_smithimport is for java classes, and is orthogonal to the others
13:40justin_smith`cbp: use is nice in the repl sometimes!
13:41bitemyappjustin_smith: write an Emacs macro ya bum.
13:41bitemyappjustin_smith: don't use use :(
13:41justin_smithheh
13:42justin_smithI only use emacs functions, because the macros are in terms of keybindings which is much more opaque than the functions the keybindings refer to
13:42justin_smith*than what the
13:42`cbpyou can always yasnippet
13:42justin_smithunless you really mean macros not keyboard-macros, and I never need those because I am not an elisp hacker
13:42lvhOkay; so [clj-time.core :refer '(local-time)] looks like a sane thing inside :require?
13:43justin_smithno need for the '
13:43justin_smithbut yeah, looks fine
13:43lvhjustin_smith: why won't it try to eval that?
13:43lvhoh, wait, it's a macro
13:44technomancyclojurebot: ns macro?
13:44clojurebotTitim gan éirí ort.
13:44technomancycome on clojurebot
13:45bitemyapptechnomancy: bot ain't playin' ball today
13:45technomancyclojurebot: the ns macro is more complicated than it needs to be, but this might help http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
13:45clojurebotYou don't have to tell me twice.
13:45technomancyclojurebot: if only that were true
13:45clojurebotexcusez-moi
13:46hiredman~ns
13:46technomancylvh: ^
13:46clojurebotns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful.
13:46hiredmanif only you asked for what you put in
13:47technomancyshouldn't it be doing fuzzy matches or something?
13:47technomancylabour-saving devices and what have you
13:48hiredmanit tries its best
13:49lvhthe-kenny: Thank you :)
13:50lvhsorry, I meant technomancy
13:50carkhum divide is a thing in refer-clojure ?
13:50lvhI'm getting this error: IllegalStateException second already refers to: #'clj-time.core/second in namespace: pairing.core-test clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)
13:50lvhI thought that meant "you are using :all too much"
13:50bitemyappah yes, the joys of clj-time nomenclature.
13:50bitemyappMy old nemesis, we meet again.
13:50bitemyapplvh: what version of clj-time are you using?
13:51lvh0.6.0 I think
13:51lvhbitemyapp: So, I'm a total newbie, but I thought that [clj-time.core :refer (local-time)]
13:51lvh would just get me local-time, and nothing else.
13:51lvhactually that should be local-date. Oops.
13:51carkwhen i try to define divide, i have to (:refer-clojure :exclude [divide]). but i can't find the definition of this divide in clojurescript
13:51hiredmannot if you use :use
13:52carkhiredman: if you're answering me, can you be more specific ? i don't get what you mean
13:52lvhhiredman: I'm not using use; test file: https://gist.github.com/lvh/df36d7b13b9277934c6c
13:52carkah =P
13:53bitemyappcark: http://dev.clojure.org/jira/browse/CLJS-594 https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1469
13:54hiredmanlvh: then some other namespace is
13:54carkahh got it ... i guess i shouldn't try to search from github =/
13:57bitemyappcark: I don't actually answer questions
13:57bitemyappcark: I take the nouns and verbs from peoples' queries in here, add some choice quotes around specific words sometimes, then Google.
13:57bitemyappcark: then I cherry-pick one or two relevant URLs and paste them back.
13:58technomancybitemyapp: you really need a bot for that
13:58carkwell thanks anyways
13:58lvhI'm also getting that exception in the second file in https://gist.github.com/lvh/df36d7b13b9277934c6c
13:58technomancylabour-saving devices and what have you
13:58lvhwhich I totally don't get
13:58bitemyapptechnomancy: I kno rite.
13:58bitemyapptechnomancy: for the record, this tactic doesn't work nearly as well in #haskell
13:58bitemyapptechnomancy: the questions there are actually hard.
13:58carkit's completely crazy that github will not find me that though
13:59bitemyapp"what's a bifunctor of this typeclass?" "ahh hum. uhm...."
13:59bitemyappcark: things at Github only get worked on to the degree that they interest somebody.
13:59bitemyappcark: perhaps they should hire a search engine nut?
13:59carkyes =)
14:01zerowidthif you have systems experience with large elasticsearch clusters, by all means apply
14:02bitemyappzerowidth: you're a GH employee?
14:03zerowidthaye
14:05kzarTo be fair the search works a lot better in GH than it does in Bitbucket, I have to use it for work now and I miss being able to find things easily without checking it out and greping myself
14:06octagonan interface to `git grep` would definitely be nice to have on github.com
14:06zerowidthindividual-repo search? yeah
14:06bitemyappkzar: that applies for a lot of verbs/nouns in that category.
14:07bitemyappkzar: my company uses bitbucket and mercurial and I'm practically crawling out of my own skin on a regular basis.
14:07kzarlol
14:08kzarto be fair it's a damn lot cheaper
14:09bitemyappkzar: penny-wise.
14:09kzarWell actually if your company has a lot of repos paying per repo instead of per employee is more than pennies
14:09lvhis there an emacs thing for extract-sexp-to-function
14:09bitemyappkzar: we have around 40.
14:10lvhRight now I'm munging it with manual editing + ESC C-f
14:10justin_smithlvh: not off the top of my head, but paredit makes deleting a sexp starting at point easy
14:10hiredmanhosted codeq
14:11technomancylvh: you'd need the analyzer to see which identifiers are locals vs vars
14:11justin_smithlvh: which brings down the cost of "manual editing" quite a bit
14:11hiredmantechnomancy: hosted codeq!
14:11technomancythough I guess you could just prompt for locals
14:11technomancyhiredman: no
14:12lvhjustin_smith: Oh, right, I forgot that C-k at start is even easier than C-SPC forward-sexp
14:12lvhso, clj has absolutely no haskelly desire to make functions pointfree, right?
14:12justin_smithlvh: c-m-k in case there are multiple sexp on one line
14:13justin_smithlvh: you can do it, I find it often obfuscates
14:13technomancyyou could try the slamhound approach too (attempt to compile and read compiler errors), but that would lead to some false positives when you shadow things
14:13technomancylvh: a few simple comp/partials here and there are nice
14:13justin_smiththere are things like comp and partial and juxt which are kinda-points-free-ish but no true points free I don't think
14:13technomancyit's easy to go overboard though
14:13lvhSo something like def instead of defn?
14:14technomancyexcept with juxt; it is impossible to use too much juxt
14:14justin_smithyeah, (def nothing (constantly nil)) is a function definition I will sometimes use
14:14lvhbasically I just think that (juxt :gender :start-date :end-date) is too much typing
14:14technomancylvh: def instead of defn is not so good because your stack traces will get even worse
14:14lvhI want that to be called "prefs"
14:14technomancythough if you're just applying keywords that's not an issue
14:15justin_smithhmm is there a usage of metadata that would make (def get-key (juxt ...)) look better in stack traces?
14:16jjl`_technomancy: i hear you on that one. my style is adapting to move a lot of defs with function factories into defns
14:17lvhso basically the one thing that really ruffles my jimmies is that the index of a thing inside braces mod two determines if it is a key or a value
14:17lvhmaybe that will go away once I learn how to indent things
14:18technomancyhttp://thereisnoneed.com/
14:18joegalloJimmies status [ ] unruffled [x] ruffled
14:18jjl`_er, you see this as a problem?
14:18justin_smith,(into {} [[:a 0] [:b 1]]) ; lvh
14:18clojurebot{:a 0, :b 1}
14:18justin_smithit's an option at least, if you hate the lack of grouping that much
14:18jjl`_also you can use the comma
14:18Wild_Catoh, hi lvh!
14:19jjl`_but is it really any different from let forms?
14:20technomancylet usually has newlines
14:20joegalloin theory, it's a problem. in practice, literal maps are usually broken over multiple lines, or :a "foo" (keys are keywords and values aren't), or you use commmas in them to make it obvious
14:20Wild_Catlvh: the good news is that at the very least, you get an error when you have an off number of things in your map literal.
14:20Wild_Catodd*
14:20jjl`_my map definitions usually have newlines
14:20lvhWild_Cat: hello
14:21lvhOkay, I didn't realize you could add commas. Would that make my clj code unidiomatic, or is it just taste?
14:21justin_smithcommas are whitespace, and idiomatic in maps and let statements
14:21Wild_Catcommas are fine for one-line map definitions.
14:21jjl`_i expect align-cljlet for emacs deals with maps as well
14:21Wild_Catwhen your map has one entry per line, the newline is enough of a separator.
14:21justin_smith,(+ 1, 1, 2) ; is not idiomatic
14:21clojurebot4
14:21technomancyjustin_smith: I don't know about idiomatic in maps
14:22technomancywhen I see commas in maps I think "new to clojure"
14:22technomancywhich is fine FWIW
14:22justin_smith{:a 0, :b 1} for a one liner?
14:22justin_smithif my keys and vals are textually short I totally do that
14:22Wild_Cat{:foo 1, :bar 2} is nicer than {:foo 1 :bar 2} IMO
14:22justin_smithexactly
14:22lvhis there a way to get better erro r messages out of clojure.test/is assertion failures
14:22Wild_Cathowever, {:foo 1,\n :bar 2} is redundant.
14:22lvhlike pretty printed data structures maybe
14:23lvhor even better, highlight differences!
14:23joegallotechnomancy: yeah, commas are "i'm new here"
14:23technomancylvh: check out difftest
14:23justin_smithlvh: (is false "I wanted this test to fail.")
14:23justin_smithtest/is of course
14:23technomancyWild_Cat: but deleting trailing whitespace will fix it =)
14:23lvhtechnomancy: oh man that is super great
14:24technomancythe implementation is janky, but the end result is nice
14:24Wild_Catoh yeah, difftest looks awesome!
14:24Wild_Cattotally stealing that.
14:25jjl`_i expect difftest and midje are incompatible :(
14:25justin_smithlvh: I find liberal use of the third arg to is, and wrapping groups of is calls in (test/testing "general category of things I am testing" ...) clarify things a lot
14:25justin_smiththe message from testing also gets printed with failures
14:26lvhjustin_smith: I only have one is per test; https://gist.github.com/lvh/2d762fd80e499ed50266
14:26lvhjustin_smith: I know *which* test fails, but I can't tell what's going on, because both the expected and the actual are basically just a giant wall of text
14:27lvhtechnomancy: I added {:user {:plugins [[lein-difftest "2.0.0"]]}} to ~/.lein/profiles.clj; (use 'difftest.core) can't find difftest
14:27jjl`_lvh: lein deps
14:27technomancylvh: the plugin is just for CLI use
14:27lvhjjl`_: Inside the project?
14:27technomancyfor repl use you need a :dependencies entry
14:28lvhtechnomancy: Oh. I was trying to use the REPL instructins
14:28lvhOh, okay.
14:29lvh(activate) looks like an incredibly scary thing.
14:29technomancyyeah... it's pretty nuts
14:29justin_smith(do (use 'autobots.core) (transform) (roll-out))
14:31KeithPMGood day. Can anyone decipher this tutorial example for me please? I am particularly curious about the (conj ret (fn [] i)) form as well as the (map #(%) fns) form. The full example is here https://gist.github.com/kpmaynard/8479693
14:32Wild_Catlvh: speaking of useful plugins, you'll probably want to take a look at lein-environ
14:32joegalloKeithPM: it's returning a list of thunks (that is, no-arg functions)
14:32justin_smith,(map #(%) [(constantly 1) (constantly 2) (fn [] 3)])
14:32clojurebot(1 2 3)
14:33joegallothen it's mapping "invoke thyself, function!" across them all.
14:33justin_smith(fn [] i) is just a weird way of saying (constantly i)
14:33KeithPMWow… I'm amazed :)
14:33lvhtechnomancy: Which dependencies entry? It's not difftest or lein-difftest, apparently; when I use lein-difftest, (use 'difftest.core) still fails FileNotFoundException Could not locate difftest/core__init.class or difftest/core.clj on classpath: clojure.lang.RT.load (RT.java:443)
14:34sritchieokay, here's my post on Liberator and Friend: http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
14:34technomancylvh: difftest alone should do it in :dependencies
14:34joegalloKeithPM: does that make more sense now, or are you still not really gettin' it?
14:34technomancythat's what the plugin is doing behind the scenes
14:36lvhtechnomancy: My bad; screwed up the version.
14:36KeithPMjoegallo: I 'get it' on a surface level, I am now trying to come to terms with the purpose …
14:36sritchiecemerick: would love if you'd take a look to see if I'm correct on my description of how friend does its thing
14:36lvhtechnomancy: is there a :latest keyword or something? I realize that would probably be an incredibly bad idea.
14:36joegalloi seriously wouldn't stress it -- it's not meant to be like "good" code or anything
14:36justin_smiththere is lein-ancient to check if you are up to date
14:36joegalloit's just pointing out this difference between what would happen in javascript versus what happens here -- it's not really meant to useful
14:37joegallobesides just "oh, hey, you know that thing you hate about js!? yeah, we don't have that here!!!!"
14:37KeithPMjustin_smith: Thanks Justin, I had never seen 'constantly', will look it up
14:37technomancylvh: you can use "RELEASE" for things like dev tools if you are OK with some breakage, but using it for anything required for the project itself is definitely a bad idea
14:37KeithPMjoegallo: Thanks joe, you know I was beginning to stress it :)
14:38justin_smithKeithPM: if you know what (fn [& ignored] x) would do, that is constantly is, pretty much
14:38lvhYESSSSSSS
14:39lvhtechnomancy: I just got a sane response from my REPL; thanks :)
14:39technomancyno problem
14:39technomancysounds like the readme could use some work
14:39Wild_Catlvh: how do you deal with reloading all the things before running your tests?
14:39Wild_Cat(reload, the bane of any programming language with a REPL :p )
14:39KeithPMjustin_smith: Oh yes… I'm familiar with the constant function in lambda…
14:41Wild_Cat...related: is there at all a function you can call from the REPL that reloads every NS?
14:41lvhWild_Cat: Have only two modules
14:41Wild_Catlvh: and do they have dependencies?
14:42KeithPMWhat would you call the #(%) function in the map expression? It looks like 'apply' (???)
14:42joegallo(apply f []) is what it is, basically
14:43lvhWild_Cat: oh, yeah; cider-restart
14:43gtrakcemerick: I can't seem to catch piggieback in a state where (get @session #'*cljs-repl-env) works, is that the right approach?
14:43KeithPMjoegallo: OK thanks.. Imagine running in to that example in an intro tutorial to clojurescript :)
14:43joegalloyikes
14:44KeithPM:)
14:44KeithPMIt was a little disconcerting to say the least :)
14:44gtrakcemerick: the keys are in there, but they're nil.
14:44joegallodefinitely i would say "this is not on the quiz"
14:44KeithPM:)
14:45gtrakcemerick: and I've added the wrap-cljs-repl (using resolve to avoid a compile-time dep) to the :requires
14:45gtrakwhich I thought would work
14:45cemerickgtrak: it's only going to be non-nil if the current session is a CLJS REPL
14:45cemericks/is/has
14:45gtrakwell, it is.
14:46gtrakI've got austin in there and I ran (cemerick.piggieback/cljs-repl)
14:47gtraki can push it if you want to take a look.
14:47cemerickgtrak: but the code you are using to touch piggieback is Clojure, which is in a different session
14:48cemericksritchie: that looks about right after a skim (though it should be :cemerick.friend/foo; the double-colons are only used to expand either *ns* or an :as-required alias)
14:48gtrakcemerick: not sure I understand what you mean there, the sequence is: I open up a repl in a terminal, I connect to it via emacs, autocomplete works there, I start the cljs repl in emacs and try autocomplete again, which switches on truthiness of those session keys, and I've got debug printlns on my terminal.
14:49cemerickoh, ok, I thought you were REPL-ing to check the status of the session map
14:50cemerickgtrak: how is this autocomplete being triggered? It has to use the same session as the CLJS REPL in order to access its CLJS env
14:50gtrakcemerick: I can check, hold on one sec.
14:51cemericksritchie: it sounds like liberator's assumption that a request can be statically evaluated as authorized or not is the biggest point of friction?
14:51gtrakcemerick: as far as I can tell, there's only one repl session, if I print id's I can verify that.
14:58cemerickgtrak: but you can evaluate CLJS expressions?
14:58gtrakyes
14:59cemerickgtrak: If the CLJS env weren't in the session, that wouldn't work
14:59gtrakcemerick: if I debug print it from where piggieback captures it, it's definitely in there.
15:00gtrakI haven't verified that autocomplete is using the same session, but I don't see any reason to doubt it.
15:00cemerickthis is cider?
15:00gtrakyes
15:00cemerickI'm 99% sure that it uses a different session for tooling-related stuff
15:00gtrakaww, godammit. :-)
15:00cemerickOtherwise, evaluating clojure-complete expressions would contaminate *1, etc
15:01cemerickThis is a wrinkle in the "just use the piggieback CLJS env" strategy :-)
15:01gtrakso, now what :-). This whole exercise relied on the fact that I could grab the value of the env from the session.
15:01gtrakif I can pass along the real session id in the tooling session, I can do it that way.
15:02cemerickdon't do that, you don't want tooling to hose the interactive session
15:02cemerickJust get at it a bit off to the side. https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/session.clj#L15
15:02gtrakwhy would it hose it?
15:03gtrakyea, that's what I'm thinking
15:03gtrakin a separate key.
15:03gtraknot masquerading as the first session, which is what I think you mean.
15:03cemerickright
15:03cemerickHrm, right, you're not eval-ing anything, so the risk of blocking a session is ~nil.
15:04coventryI've got an om/cljs codebase where changing (select-keys [:mykey] cursor) to {:mykey (:mykey cursor)} seems to speed the app's responsiveness by an order of magnitude. Is this a known issue?
15:04cemerickgtrak: Anyway, as long as you can get at the tooling session ID in cider somehow, you should be able to get at things without a problem.
15:05gtraktarget-session or something, that's complicated, but oh well.
15:05gtrakwould it make sense to restrict things to one session?
15:05gtrakor to generally have ops be able to work with other sessions?
15:06cemerickgtrak: it hasn't come up yet, honestly
15:06bitemyapp"Don't be too proud of this technological terror you've constructed. The ability to write servers in JavaScript is not an advantage."
15:06gtrakpfft, well, I'll do what I imagine has been done elsewhere, just get it working and talk about it later :-).
15:07cemerickgtrak: The "use a different session" advice became the overriding message when everyone decided they'd just ship expressions to be eval'd, and I didn't have enough gas in the tank to evangelize the op-based approach to tooling.
15:08gtrakif I can get cider to use the same session, that would definitely be cleaner.
15:09gtrakcemerick: not sure if you saw my last message, I'll try to get it working in cider in the same session first.
15:09cemerickgtrak: yeah, that may be best if you can manage it
15:09gtrakthat seems like a more coherent thing in the long run.
15:10gtraktpope: ^
15:10coventryDon't try to frighten us with your sorcerer's ways, Lord bitemyapp.
15:11lvhI have a lot of defns with like three words in it. Does that mean I'm doing it right, or wrong?
15:11arrdembitemyapp + Cthulu for channel dictators, why vote for the lesser evils?
15:11cemerickgtrak: ok, yeah, verified there's no way for an op to hose a session if it misbehaves. That's only relevant for eval, since only one eval can occur at a time per session.
15:12cemerickI should have called the eval op "this-is-for-the-user-dammit"
15:12gtrakhopefully that means the extra decoupling is always superfluous for not-eval.
15:12cemerickshould be, yeah
15:12bitemyapparrdem: that gem belongs to pelotom, but I liked it :)
15:18gtrakyak-shaving, I was trying really hard to avoid elisp up till now
15:18bitemyappgtrak: drink deep
15:18gtrakI did last night and this morning.
15:19arrdemgtrak: lifting & running usually go well with the above..
15:20bitemyapparrdem: HHH
15:21magnarsUsing Enlive, it ruins my HTML markup - this is valid HTML5 <a><div></div></a>, but Enlive (or Tagsoup, or what that is using), insists on moving the <div> out of the <a>, since <a> was an inline-only element in some old HTML-spec. ... Any ideas other than "don't use Enlive"?
15:21arrdembitemyapp: ???
15:22bitemyapparrdem: hash house harriers :)
15:22hiredmanwhat do you mean insists?
15:22bitemyappmagnars: I don't like Enlive, but it *is* bad HTML.
15:24lvhif I want my function to return a seq-of-seqs and another seq, the right thing to do is to return a 2-vector, right?
15:24gtrakcemerick: the op thing isn't so much about the ops, but the decoupling it provides, it would be nice if we could standardize on ops along the way, since that means we don't have to reinvent it M-IDEs x N-clojure-impls x O-ops times.
15:25magnarsbitemyapp: No, sorry, that's pretty outdated thinking. http://html5doctor.com/block-level-links-in-html-5/ Also, clicking entire block elements to navigate is a good thing.
15:25arrdemlvh: in general yes.
15:25kzarmagnars: I guess raise an issue if you think it's wrong
15:25bitemyappmagnars: the former example is a bit of a strawman, but as thou wilt.
15:25kzar/ pull request
15:26gtrakI'm hoping we can just bundle a bunch of middlewares at some point.
15:26magnarskzar: sure, it's open source, I am aware of how that works - I was just wondering if there was already some way around it before going down that path.
15:26hiredmanI still want to know what he means by insists, does he mean enlive moves it, or he has to move it to make enlive happy
15:27magnarshiredman: It moves it out for me.
15:27hiredmanhuh
15:27magnarshiredman: pretty much like a browser would do when encountering a <p> nested inside <p>. Closing it early, if you will.
15:29stuartsierramagnars: You can override the parser that Enlive uses.
15:29dnolenmagnars: I'm pretty sure that's tagsoup doing that
15:29magnarsThanks, I'll look into switching out the parser.
15:32paulswilliamsesqHi all, hopefully a simple question - trying to connect Lighttable 0.6.0 on Mavericks to a new Leiningen (2.3.3) project. No errors, but don't receive the connecting prompt and no evaluation occurs. Any pointers?
15:38jcromartiepaulswilliamsesq: open a file in your project and press Command+Enter
15:39jcromartieI don't know why it doesn't do anything when you connect but it threw me off
15:39lvhhm
15:39lvhis nil also the empty list in clojure?
15:39lvhI'm trying to figure out why (nil? (vals {}) )
15:40stuartsierralvh: No.
15:40teslanick.(vals {})
15:40lvhI was expecting [].
15:40stuartsierra(= () nil)
15:40lvh(or ())
15:40stuartsierra,(= () nil)
15:40clojurebotfalse
15:40lvh,(vals {})
15:40clojurebotnil
15:40Wild_Catlvh: only false and nil are falsy, btw.
15:40AimHere,(empty? nil)
15:40clojurebottrue
15:41stuartsierralvh: `vals` returns a sequence. An empty sequence can be nil.
15:41stuartsierra,(seq [])
15:41clojurebotnil
15:41Wild_Catstuartsierra: wait, you mean nil implements the seq interface?
15:41stuartsierraWild_Cat: No, nil is just null.
15:41stuartsierrabut `seq` on any empty thing is defined to return nil.
15:42Wild_Catstuartsierra: then I don't understand why nil can be considered an empty sequence.
15:42lvhso, vals returns a sequence, or maybe nil
15:42Wild_CatI'd expect (vals {}) to return [] or (), not nil.
15:42stuartsierraAny function which returns a sequence can legitimately return nil.
15:43Wild_Catyeah, but doesn't nil mean "special case, something went wrong" in that case?
15:43stuartsierraWild_Cat: Not necessarily. `nil` in those cases just means "nothing"
15:43hiredmanno
15:43lvhstuartsierra: okay, accruing fact
15:43Wild_Catwhereas "empty sequence" is not a special case. It's just something that, when iterated upon, returns no values.
15:43lvhI still don't get why it doesn't do [] instead
15:44hiredmanthere used to not be an empty seq
15:44hiredmanso you really either had nil, or a seq with stuff in it
15:44Wild_Catwell, if anything nil can be iterated upon, it seems.
15:44Wild_Cat,(map inc nil)
15:44clojurebot()
15:44paulswilliamsesqjcromartie: cheers - that worked. Yeah, not intuitive. Normally and vim-fireplace guy, but thought I'd give this lighttable a crack. After learning, it looks great.
15:44Wild_Catso there's that.
15:45lvhWild_Cat: maybe that just specialcases nil
15:45angusiguess,(cons 1 nil)
15:45clojurebot(1)
15:45`cbp,(iterate inc nil)
15:45clojurebot#<NullPointerException java.lang.NullPointerException>
15:45michaniskin,[(first nil) (rest nil) (seq nil)]
15:45clojurebot[nil () nil]
15:45Wild_Catlvh: figures. So that means nil can be used as a list/vector/map -- it's considered an empty one.
15:46michaniskin,(conj nil 1)
15:46clojurebot(1)
15:46riley526,(next nil)
15:46clojurebotnil
15:46Wild_Catit's bizarre, but okay,
15:47stuartsierraIt's not that `nil` can be used as a collection. Most of the sequence-oriented functions call `seq` on their argument. `seq` on nil or an empty collection returns nil.
15:47stuartsierra`rest` is a rare exception.
15:47Wild_Cat,(empty? nil)
15:47clojurebottrue
15:47stuartsierra`(empty? x)` is just `(not (seq x))`
15:48riley526hm
15:48Wild_Catstuartsierra: which actually means seq *has* to return nil on an empty container.
15:48stuartsierrayes
15:48Wild_Cat,(not [])
15:48clojurebotfalse
15:48Wild_CatI'm not sure how I feel about that but okay, I guess I'll just have to accept it and remember it :p
15:48stuartsierra[] is an Object, which is truthy.
15:48stuartsierra(seq []) => nil which is falsey.
15:49Wild_Catyeah.
15:52lvhin a loop/recur situation, where the body of the loop is an if determining the terminating condition; is there a preference for putting the terminal case first vs second?
15:53lvhSorry for my nomenclature. I'm new.
15:53gfrederickslvh: I don't think there's a preference
15:54carki prefer my tests to be positive like (if (seq instead of (if-not (seq .... so that's what decides of the order in my loops
15:54gfredericksthere _is_ a tendency for new people to overuse loop/recur though :)
15:54bmathlvh: I'm not sure there's a clear winner all the time. with recursion you sometimes see the base case first for tail-recursive optimizations… but I think that's an artefact of recursion and detecting tail-recursion may be starer than that by now
15:55stuartsierralvh: The docstring for `empty?` says `seq` should be preferred over `(not (empty? …)` but not everyone agrees.
15:56deadghostanyone happen to have compojure/enlive project code I can see?
15:56lvhstuartsierra: is that "seq?"? I don't understand how seq can replace empty?
15:56cark ,(seq [])
15:56clojurebotnil
15:56stuartsierralvh: Remember `(seq [])` => nil which is logical false.
15:57lvhstuartsierra: ohhh
15:57lvhstuartsierra: but why would I want to do that when I can do seq? instead?
15:57stuartsierra`seq?` is different
15:58stuartsierra`seq?` just tests if something is of a type implementing the ISeq interface.
15:58lvh(if (seq a-thing) ...) seems wasteful; I'm not using the seq, I just want to know if it's empty or not
15:58lvhoh
15:58bbloomlvh: but what is "emptiness" anyway?
15:58gtrakI prefer terminating case first.
15:58stuartsierraAnd since lots of built-in functions call `seq` automatically, this can lead to more concise code.
15:59gtrakI think because it makes it easier to ignore visually.
15:59lvhbbloom: there are no more things in this list
15:59bbloomgtrak: yeah, that annoys me a bit too. i tend to do (if (seq ...) TODO then start typing
16:00gtrakbbloom: I've wanted an if-not-let :-)
16:00bbloomlvh: but what if you don't know the list yet? if you have a lazy sequence, determining if it's empty means you need to realize/force it
16:00stuartsierraThere is an if-not
16:00bbloomlvh: in that case, it's not wasteful to call seq, it's inherit
16:00bbloomalso:
16:00edbondjust saw this in enliven #_#_#=(eval org.w3c.css.sac.Condition/SAC_PSEUDO_CLASS_CONDITION) what is this?
16:00bbloom(source empty?)
16:01edbondhttps://github.com/cgrand/enliven/blob/master/src/enliven/html.clj#L113
16:01gtrakstuartsierra: sure.. I mean I could build one if I really wanted, but I figured it was more unclear than useful.
16:01carkbbloom: so what the binding would work in the "else" part ?
16:01edbondsorry, it's commented out. I thought this some cool optimization macro :)
16:02lvhbbloom: oh, okay :)
16:02gtrak(if-not-let [[s & more] (seq my-seq)]] ... shudders.
16:02carki mean gtrak
16:02lvhWhat's conj, except add-all-of-these-things-in-this-seq-separately, not add-this-entire-seq
16:02gtrakcark: the second.
16:02gtrakis the truthy branch
16:03carkgtrak: man that sound horrible =)
16:03lvhI want (add [[]] [[] [] []]) --> [[] [] [] []]
16:03lvh(if anyone speaks python: I want list.extend, not list.append)
16:03gtrakcark: especially when you consider how easy it is to forget that what needs to be truthy is the seq, not the bindings.
16:03gfredericks,(into [[]] [[] [] []])
16:03clojurebot[[] [] [] []]
16:04mikerod,(concat [[]] [[] [] []])
16:04clojurebot([] [] [] [])
16:04mikerodlazy variety
16:04dee5hello, would anyone familiar with midje know how to stub a function for an arbitrary number of arguments?
16:05dee5I'm currently using (provided (f anything anything anything) => irrelevant :times 0
16:05lvh(inc gfredericks)
16:05lvh(inc mikerod)
16:05bbloomlvh: use into
16:05matt444is there an easy way to combine leiningen tasks together?
16:06technomancymatt444: there are lots of higher-order lein tasks, yeah
16:07lvhlast claims to do linear time; I presume that for vecs its faster
16:07lvhhow do I spell everything-besides-last? I have something that came out of partition-all; the last odd element out has to be treated specially
16:08technomancybutlast?
16:08lvhYay
16:08matt444technomancy: For example in Grunt (node) you can say registerTask('test' ['frontend', 'backend']) which combines the two separate tasks into one. Is there something like that for leiningen? Or is this what :hooks is about?
16:09technomancywhen you see a weird name like that, there's a good chance it came from CL
16:09technomancymatt444: so... depends on how you want to combine them. if it's just "run this, then that" you use the `do` task
16:09technomancythere are other valid combinators though
16:10technomancy:aliases {"stuff" ["do" "test," "deploy"]} or something
16:10matt444awesome, i'll research from here, thanks
16:10technomancyhttps://github.com/technomancy/lein-thrush
16:10lvhugh; apparently I am calling a vector somewhere actual: java.lang.IllegalArgumentException: Key must be integer
16:10lvhbut I can't see where :/
16:12lvhIt's complaining about this line, but I can't see what's wrong with it: (let [these-pairs (pairs (first subgroups))]
16:12lvh(pairs is just (parition-all 2 %))
16:14gfrederickslvh: is there some way pairs is accidentaly a vector?
16:14lvhoh.
16:14lvhgfredericks: nasty habit I picked up from CL, sorry
16:16AeroNotixwhat's the idiomatic why to check the types of stuff?
16:16lvhso, is "pairs" a bad function name, or is "pairs" a bad variable name, or both/neither?
16:17technomancynothing wrong with that name
16:18gfrederickspears is a tastier name
16:18lvhrightn ow I fixed it by putting the- in front of the variables (also what should I call it? it's not a variable; it's a thing in a let clause)
16:19arrdem(inc gfredericks)
16:19gfrederickslvh: a local
16:19arrdemlazybot where art thou
16:19gfredericksas in "the locals get really annoyed with the tourists swarming about during the festival"
16:20gfrederickss/tourists/vars/
16:20sritchiecemerick: the friction is more about who's handling the response
16:20sritchiecemerick: liberator's handler, or some friend workflow's handler
16:20sritchie(the unauthorized response, that is)
16:22lvhso, my code, as expected, doesn't work :-p
16:22gfredericksadd moar parens
16:23lvhhey, that worked
16:24lvhhttps://gist.github.com/lvh/8481597
16:24gfredericksparens are like pomegranates for compilers
16:25lvhoh, actually, I think I might want conj
16:25lvhnope, I don't
16:26gtrakgfredericks: gimme a fractal IDE anytime.
16:26ivanhttps://ludios.org/tmp/cljsbuild-smb.png I'm seeing this dialog in IDEA quite frequently; this file is being read by another host via a SMB share, and IDEA can't save it
16:26ivanstarting IDEA with -Didea.no.safe.write=true didn't help
16:26lvhivan: it's funny how I go to different channels and see all the same people
16:26ivanI wonder if there is some way to get lein-cljsbuild to not hold onto handles or something
16:27ivanor some secret SMB flags or some way to hack IDEA into behaving
16:28technomancyIDEA is enterprise software. you can't use it at a small-to-medium business.
16:29technomancysorry
16:29TEttingertechnomancy was that a pun on SMB?
16:29technomancyattempted pun
16:30lvhoh, wait, I found the bug
16:30lvhso, I want last and butlast, except when there's one element, then I want last to mean that element, and butlast to mean nothing.
16:31gfredericksnormalize data as early as possible
16:32lvhgfredericks: maybe partition-all is not what I want :)
16:32LBRapidReal beginner question: To get the metadata of an object, why do I need to run (meta #'+) versus just (meta +)?
16:32LBRapidfunction, not object
16:32technomancyLBRapid: it's just a historical quirk
16:33technomancyit used to be that functions could not have metadata attached to them
16:33technomancythese days you can attach metadata, but it doesn't happen by default for some reason
16:33technomancymemory usage, I guess
16:33LBRapidtechnomancy: Thanks for the explanation
16:33hcumberdaleHi :)
16:34hcumberdaleIs marmalade-repo offline?
16:34technomancyhcumberdale: yes =(
16:35lvhokay, so how can I get [(partition 2 it) (the-rest-that-didnt-make-it-in-the-first-term it)]
16:35hcumberdalewhat happened technomancy?
16:35hcumberdalehad a lot of problems. Already tought about mirroring it 4 free
16:35technomancyhcumberdale: node.js is screwing everything up
16:36technomancythere's an experimental port at http://marmalade-repo.ferrier.me.uk/ that seems to be working ok; could try falling back to that for now
16:36arrdemlvh: (rest)?
16:36hcumberdalearggggg this fancy new technology
16:36arrdem,(rest [1, 2, 3])
16:36clojurebot(2 3)
16:36technomancyhcumberdale: moving off node is the top priority, but it's all volunteer run
16:36mikerodbbloom: are you suggesting that concat is bad?
16:37gfredericksconcat is triksy if you don't have any use for laziness
16:37mikerodgfredericks: yes, I've been tricked by it with StackOverflow before indeed
16:37lvharrdem: sorry, my description was bad
16:37mikerodwhat about when you want to concat several seqs together though
16:38mikerod,(concat ['a] ['b] ['c])
16:38clojurebot(a b c)
16:38lvharrdem: (kinda-partition 2 [1 2 3 4 5]) -> [[[1 2] [3 4]], [5]]
16:38gfredericksI think it's fine; but I think people initially expect that it's a great solution for appending to the end of anything
16:38lvh(partition 2 [1 2 3 4 5]) gets me the first part; partition all gets me those two concatenated
16:39mikerodlazyness scares me at times. mostly when dealing with macros that perform lazy operations.
16:39hcumberdaletechnomancy: thx
16:39mikerodsince the env can be different by the time the lazy things are evaluated
16:39arrdemmikerod: as long as you write pure code it doesn't matter!
16:39mikerodwhat is a good pattern for non-lazy concatenation of an unknown # of coll's?
16:40mikerodarrdem: in theory...
16:40arrdem(doall (reduce concat seqs))
16:40eggheadmapcat identity :)
16:40mikerodI'm seeing lazy answers
16:40mikerodwell, not the doall
16:40eggheadmikerod: reduce isn't lazy
16:40hiredmanmikerod: reduce into
16:41mikerodarrdem: yeah, why doall outside of a reduce
16:41ztellmanmikerod: apply concat
16:41arrdemmikerod: I thought that reduce was lazy. apparently I'm wrong.
16:41bitemyappmapcat concat if you're a true believer.
16:41mikerodhiredman: reduce into - sounds reasonable
16:41eggheadlol
16:41hiredmanmikerod: if you are running into those issues in a macro that is a terrible macro
16:41mikerodhiredman: DSL drama
16:42jcromartieany Enlive wizards want to tell me if there's a better way to do this: https://gist.github.com/jcromartie/4deb16fd17c673cb50a3
16:42hiredmanthat is a terrible dsl
16:42mikerod:)
16:42hiredmandon't use it
16:42jcromartiei.e. I have a <li> with an <a> in it, and I want to clone the li but alter the a
16:42clojurebotCool story bro.
16:42bitemyappmikerod: laziness isn't scary
16:42eggheadbitemyapp: lol mapcat concat
16:43eggheadi like it
16:43arrdembitemyapp: given a compiler capble of reasoning about it, yes.
16:43jcromartiederp
16:43jcromartieclone-for has an implicit at?
16:44jcromartieyay
16:44mikerodbitemyapp: well, stack overflow from a nested concat can be scary; I'm just finding that lazy things tend to sneak up on me later; I'm just too much of a n00b most likely
16:45hiredmandon't use libraries/macros/functions/etc by people who don't know what they are doing and are clearly just blasting out whatever while intoxicated on the heady rush of using the jvm without java
16:45bitemyappegghead: the choice of programmers of distinction and honor.
16:46jcromartiehiredman: while that's good advice, it's also a bit elitist no? they need feedback
16:47mikerodhaha
16:50benkayhey all - I'm running a ring server from my repl in emacs, but haven't figured out how to capture stdout and also run the ring server with :join :false - suggestions?
16:51mikerodhiredman: I actually retract my thoughts on lazy things happening in macros causing issues. I can't think of an example of that. I guess the only thing that has really caused me problems before was unknown nesting depths with concat.
16:52gfredericksI've had issues with surprising head-holding due to closures
16:52mikerodbut yes, I have experienced macro abuse
16:52mikerodI've had trouble with macros returning anonymous fn's with closures
16:52mikerodsince that doesn't really work
16:52mikerodbut there are a few posts out there about that
16:53maravillasbenkay: have you looked in your *nrepl-server ...* buffer for output?
16:53ProfpatschIs it normal that with (defmacro foo [x y & args]) args is passed as a LIST? Like in (foo :x :y :z :baz) args is (:z :baz).
16:53benkaythanks maravillas!
16:53maravillasyw!
16:54ProfpatschWhich screws stuff up when used in a macro.
16:54amalloyProfpatsch: that's really like...exactly what & does
16:54arrdemProfpatsch: when used how?
16:54amalloywhat else would it do?
16:55TEttingerProfpatsch, & is a seq yeah
16:56ProfpatschSo, I’ve got (defmacro baz [& args] args) and (baz :z {:z 42}) returns 42.
16:56mikerodhaha
16:56mikerodmacroexpand-1 that
16:57mikerod(macroexpand-1 '(baz :z {:z 42}))
16:57ProfpatschBut I want to return (:z {:z 42}). The best I’ve come up with so far is (defmacro baz [& args] `~'args).
16:57ProfpatschWhich is kind of creepy.
16:58mikerod(defmacro baz [& args] `'~args) you mean?
16:58ProfpatschYeah.
16:58mikerodseems legit
16:58jcromartiewhy do you want a macro that returns its args?
16:59stuartsierraMaybe something like (defmacro baz [& args] `[~@args]) is what you want.
16:59ProfpatschI thought &args would return somethign sensible, like, a list.
16:59mikerodit does
16:59jcromartieProfpatsch: it is *calling* that list
16:59mikerodthen it is evaluated
16:59amalloystuartsierra: that's just (def baz vector)
16:59jcromartieevaluating
16:59stuartsierraamalloy: I know
16:59jcromartiewhich is (:z {:z 42})
16:59ProfpatschNah, you know, whatever [] is called. ;)
16:59ProfpatschSo it isn’t evaled by default in macros.
17:00mikerodhmmm
17:00ProfpatschRight, vector.
17:00mikerodI guess that is an interesting thought
17:00jcromartieProfpatsch: what is the purpose of this macro?
17:00edbondcljs/async/alts! doesn't consume channels - https://www.refheap.com/24570 Am I miss something there?
17:00jcromartieseems kind of like do?
17:00jcromartieor not?
17:00mikerodWhy was the variadic args, via & a seq instead of a vector
17:00jcromartienot at all actually… hm sorry
17:01amalloymikerod: (apply (fn [& args] (take 3 args)) (range))
17:01Profpatschmikerod: Making it a vector would probably destroy things no one except Hickey thought about. ;)
17:01stuartsierraIt's a sequence because it can be lazy.
17:01jcromartieI don't think it's possible to make a form that expands into more than one form
17:01jcromartiethat's the fundamental issue
17:02stuartsierra,(apply take 3 (range))
17:02clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
17:02jcromartiemacros are 1 form in 1 form out
17:02Profpatschjcromartie: I actually want to do something more sensible, but I tried the basic things first so I don’t have to spend hours searching for a mistake.
17:02jcromartiei.e. the macro form is replaced
17:02`cbpthat didnt seem to work
17:02jcromartieProfpatsch: well maybe there's a better solution than whatever this is :)
17:03mikerodstuartsierra: that makes sense, supporting laziness
17:03stuartsierraArg. That's not what I meant.
17:03tim_,(apply + (range 44))
17:03clojurebot946
17:03mikerodwell, amalloy answered as well :)
17:03tim_something like that?
17:03stuartsierra,(apply (fn [x & args] x) (range))
17:03clojurebot0
17:03jcromartieProfpatsch: and a macro like "(foo :x :y)" that evaluates to ":x :y" is equivalent to ":x :y" in the first place so I don't see the need
17:03jcromartieit's algebra
17:04jcromartieit's simply unnecessary
17:04tbaldridgestuartsierra: there we go. tjat
17:04benkaymaravillas: is it not idiomatic to want to see that kind of messaging in the repl buffer?
17:04tbaldridgestuartsierra: that's a good example, I'll have to remember that one.
17:04hlshipI'm starting to look at Om right now
17:04hlshipand this (week) is my first use of ClojureScript
17:04stuartsierratbaldridge: I remember trying to implement `apply` in ClojureScript way back when and getting stuck on that very case.
17:04Profpatschjcromartie: That’s what I meant. I want to do something more complicated but I first had to experiment around with the basic cases.
17:04maravillasiirc, there's some technical challenge that's keeping it separate at the moment. i'm not clear on the details
17:05jcromartieProfpatsch: I don't think you can do it.
17:05hlshipIn the ToDo example, there's a #js reader macro
17:05jcromartieProfpatsch: you need to redefine your problem :)
17:05maravillascemerick briefly mentioned it somewhat recently
17:05hlshipCan't find documentation for it, looks like it might do the same thing as clj->js
17:05bbloomhlship: it is different than clj->js
17:05stuartsierrahlship: #js is a recent addition that creates literal JavaScript arrays & objects.
17:05bbloomhlship: it is shallow
17:06hlshipcool
17:06Profpatschjcromartie: Wat. My problem is a different one. I’m just trying to grok macros. ;)
17:06hlshipvery hard to search the web for "#js"
17:06jcromartieOK
17:07jcromartieProfpatsch: so the lesson is that a macro form is always expanded to a single form :)
17:07Profpatschhlship: http://symbolhound.com
17:07Profpatschjcromartie: Actually, my lesson kind of was that &args is a seq, which is called when used in a macro. :)
17:08lvhHow do I remove one layer of parens in '((5))?
17:09OscarZi have a lazy seq x and when i use (println x) on it, it prints out nicely.. how can i get the same output as a string? I tried (str x) but it doesnt quite do the trick :)
17:09lvhI guess I want itertools.chain.from_iterable in python
17:09amalloy,(apply concat '((5)))
17:09clojurebot(5)
17:09lvhoh, right, apply is how you do that.
17:09stuartsierraor `first`
17:09hlship#js
17:09lvhstuartsierra: well, for now that'll work, because it can only ever be one element
17:09hlship(still waiting for a system that tracks focus based on what window I'm looking at)
17:10hlship(I type into the wrong window ALL the fucking time)
17:10ivando you look at your keyboard while you type?
17:10arrdemhlship: xmonad, Awesome and a host of tiling window managers to that with the mouse...
17:11arrdemhlship: I want to build eye tracking for mouse control sometime to get exactly what you just described.
17:11bitemyapphlship: use XMonad! It's wonderful. You can set GTK/Gnome to focus-follows-mouse too!
17:12hlshipNot ready to give up the Mac
17:12technomancyfocus follows head
17:12technomancyneed a kind of digital compass thing
17:12arrdemyeah I'm concerned that any static gaze tracker will break down on 2+ screens...
17:13hlshippart of it is retraining me to use a trackpad after decades with a mouse
17:13technomancyI actually do want to build that into xmonad fwiw
17:13arrdemI find myself turning to glance at my 2nd and 3rd all the time.
17:13hlshipYou could imagine a invisible-to-the-eye flicker in every window that would identify, to a head mounted sensor, exactly which window was being looked at
17:13technomancyarrdem: seems like the main problem would be glancing without turning your head
17:13hlshipkind of like the way the old nintendo light gun worked
17:14ivanI frequently type into something while looking at something else
17:15arrdemtechnomancy: computer vision isn't my specialty. I played with detecting which screen I was facing for a while, but never got anywhere with it.
17:15technomancyarrdem: I was thinking of something you'd wear on your head
17:15technomancybecause I work out of a shed in my back yard where no one can actually see me
17:15technomancyso looking ridiculous is not off the table
17:15angusiguessI wonder how feasible tracking pupils would be.
17:15arrdemhaha.
17:17stuartsierraThere are IR head-trackers that use a reflector on a hat.
17:17stuartsierraFlight Sims can use them.
17:17arrdemstuartsierra: that's what I'm digging for atm...
17:18ProfpatschSo now my real macro problem: https://bigmac.caelum.uberspace.de/paste/macro.html
17:18stuartsierraI recall some mention of pupil-tracking using nothing but a laptop's built-in camera.
17:18arrdemhttp://www.naturalpoint.com/trackir/
17:18lvhIs it polite to ask for code review? I'm new and want to cleanse my clj from dumb things.
17:18lvh(If so, https://gist.github.com/8482701 ; please and thank you :))
17:18arrdemlvh: totally.
17:18ProfpatschWhat to do about props being a list now?
17:19lvhI guess group-by-prefs is a really stupid function
17:19lvhbut when I first wrote it, prefs wasn't a thing.
17:19ProfpatschI have no idea how to quote/splice/unqote/stuff props no.
17:19arrdemthrow the Vim Clutch peddal in with this and we could have a full developer rig! :P
17:21arrdemtechnomancy: https://www.linux.com/learn/tutorials/550880-weekend-project-take-a-tour-of-open-source-eye-tracking-software
17:21arrdemtechnomancy: looks like webcam only is viable...
17:21arrdemI may have to play with this at some point...
17:21Profpatschjcromartie: What would you do about prefs here: https://bigmac.caelum.uberspace.de/paste/macro.html
17:22technomancyprobably hard to do if the lighting changes dramatically though
17:22arrdemlvh: not that it matters, but lists (parens not braces) are used in the ns form...
17:22`cbplvh: this seems redundant (split-with #(= (count %) 2) (partition-all 2 subgroup))
17:22angusiguessGuess that means I can't work in da club anymore :(
17:23arrdemlvh: prefs could just be a def not a defn... def can have a docstring.
17:24`cbpoh i guess not nevermind me
17:24`cbpthe -all part didnt click heh
17:24arrdemlvh: pair-with-matching-perfs could probably be (reduce) rather than (loop) because there is no case in which you are really backing up...
17:24arrdemlvh: but nothing I find personally offensive in there...
17:27lvh`cbp: why is that redundant?
17:27lvh`cbp: I want the "tail" separately.
17:27`cbplvh: i was mistaken
17:28lvh`cbp: oh, okay, no problem; that is definitely the one that makes me go "uhh wa"
17:29lvharrdem: so (def prefs
17:29lvharrdem: remove the [x], remove the call, remove outer braces?
17:29arrdemlvh: yeah but that's totally a style thing.
17:29lvhthe problem with using a repl is that I'm always afraid I'm using old code
17:29lvhso I don't know anything about reduce, I will google that
17:29lvharrdem: thanks for the review
17:31lvharrdem: I don't understand. Which one is the binary callable?
17:32arrdemlvh: so (juxt) returns a function. If you write (defn foo [x] ((juxt a b c) x)), this is really (def foo (juxt a b c))
17:32arrdemlvh: not sure what you mean by binary callable
17:32justin_smitharrdem: the difference is the defn shows prettier in stack traces
17:33arrdemjustin_smith: ah yes. this is true.
17:33lvharrdem: no, I got that
17:33arrdemjustin_smith: also you do get the single arity in gen'd documents.
17:33lvharrdem: I meant the reduce comment
17:34arrdemlvh: so essentially what you are doing here is building a pair of sequences [all-pairs, all-leftovers]
17:34arrdemlvh: this is defined by joining the previous pair [pairs, leftovers] to a new call to (pairs-and-leftovers).
17:35lvharrdem: yep. That's, to my mind, what the loop/recur spells
17:36arrdemlvh: you could also write this as (reduce (fn [[pairs, leftovers] subg] (let [[np nl] (pairs-and-leftovers subg)] [(into pairs np) (into leftovers nl)])) [[][]] subgroups)
17:36arrdem,(doc reduce)
17:36clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
17:37justin_smitharrdem: lvh ahh yeah, I was the one who initially sketched it out as a loop/recur but it is better as a reduce (taking each item in turn, and attempting to match it with leftovers, putting it in pairs if so, leftovers if not
17:37justin_smith)
17:37arrdemjustin_smith: the reason I say it's a reduce is that there is no such conditional... the only condition is the termination case which you get for free with reduce.
17:39justin_smithwhen I initially suggested the loop, it was a flat list
17:39justin_smithso it was a partitioning, in a way, with the potential of taking something out of leftovers and into pairs at each step
17:46lvharrdem: is subg just a different way of spelling subgroups or is it actually a differnt variable? I can't tell where it's defined
17:47arrdemlvh: it's just a different spelling of subgroups since I'm live coding in channel :P
17:48arrdemwell. no it isn't.
17:48arrdemso... did you understand what (reduce) does with its fn argument?
17:48arrdemsubg as I use it above is singular. it is _the_ subgroup which is being operated on in the current reduce iteration.
17:49arrdemso what reduce will do, is it will take the pair [[], []] and bind it to [pairs, leftovers].
17:50arrdemI then compute the new pairs-and-leftovers of the current subgroup, just as you do with (first subgroups) except that here I don't need the first because reduce has pulled off the head of the sequence for me.
17:50arrdemthen the into is just your same update, in that I build a new [pairs, leftovers] vector to feed into the next iteration or return.
17:50lvharrdem: it calls it on val, and the next thing in seq, right
17:51lvhI didn't get that it binds anything. I thought it was a function
17:51arrdemlvh: <cptnjacksparrow> savvy? </cptnjacksparrow>
17:51arrdemlvh: correct. I'm making a leap here to what the fn will do when invoked by reduce.
17:51lvhoh. okay.
17:52arrdem*inductive leap
17:53lvharrdem: okay, I get why I didn't grok it
17:53lvharrdem: I was parsing the [[a b] c] as destructuring let
17:54lvhit's a destructuring function arg spec :)
17:54arrdemlvh: in the function arguments?
17:54lvhit worked a lot better when I wrote it down :)
17:54arrdemlvh: bingo! argument destructuring is so great :D
17:55arrdemalso note, if you want to horrify yourself with what you could do, that destructuring is supported to arbitrary depth. So nested map destructurings are totally legit 0.o
17:56lvhthis channel is great; I keep seeing all the same people
17:56lvh(hi Luyt )
18:06bitemyapparrdem: general pattern matching that takes it a step further is even better :)
18:14shafirewow
18:14shafirehow many people are here?
18:14arrdemabout 850
18:15shafire:O
18:22amalloyin this irc channel? 733
18:23amalloywhich, i mean, i guess is about 850
18:24amalloyhey yogthos, i was curious why you posted http://www.reddit.com/r/Clojure/comments/1vc0at/clojurescript_gc_and_memory_leaks/ - that's not your blog, right?
18:24akurilinQuick question: if I want to serialize operations on a separate thread, is an agent the right construct to use? In my case, I don't have a chunk of state I want to maintain, just want to serialize a side-effecting operation.
18:27amalloyagents are fine. really a java.util.concurrent.Executor is "right", but nothing terrible will happen if you use an agent, and they're easier
18:28akurilinamalloy: not a big Java person myself, do you mind just giving me the gist of why the former is right?
18:29amalloybecause agents are just a wrapper around some j.u.c stuff with a chunk of state added. if you don't want the state, they don't bring anything to the table
18:31bbloomi find that having the state there is useful sooner rather than later for stats or debugging or something
18:31bbloomi'm guilty of using an agent w/o state out of laziness, but quickly find a need to keep a count or the most recent whatever
18:31akurilinamalloy: I see, good point.
19:02bitemyappamalloy: he posts all kinds of things on the subreddit.
19:02akurilinSo everybody on this side of the country is going to clojurewest I imagine?
19:02akurilinTrying to figure out if I should get the tix.
19:03bitemyappakurilin: I'm iffy on it.
19:03akurilinI just never really met in person a lot of the fine gents on this channel who have been gracious with me for the past year :)
19:04Bronsawtf. so (.get ^:foo [0] 0) reports a reflection warning while (.get [0] 0) no
19:05akurilinbitemyapp: can you have your gig comp it?
19:05bitemyappakurilin: def could.
19:05bitemyappakurilin: it's all about time, not money.
19:05mikeyg6754Hello everyone, I've been looking at options for production clojure web app deployment. I will be running on Amazon AWS. Any suggestions? Jetty? Apache? Nginx?
19:05`cbphttp-kit
19:06technomancymikeyg6754: jetty is the simplest way to go
19:06bitemyappmikeyg6754: http-kit is simple and you should use it.
19:06bitemyappmikeyg6754: [org.httpkit.server :refer [run-server]] -- (run-server handler {:port 3000})
19:06bitemyappmikeyg6754: bada bing, bada boom.
19:07bitemyappmikeyg6754: hold onto the function it returns if you want to be able to kill the server instance off.
19:07carkbitemyapp: you need a reverse proxy for http-kit don't you ?
19:08carkbitemyapp: to do SSL i mean
19:08bitemyappcark: a reverse proxy is a good idea regardless of whether you're using http-kit or jetty.
19:08mikeyg6754bitemyapp: http-kit looks pretty interesting
19:08bitemyappcark: you should let things like nginx handle SSL, yes.
19:08carkbitemyapp: i'm not doing thousands of connections a second, jetty is good enough for me =)
19:09mikeyg6754my company likes Apache, I'd prefer Nginx, but both have "Reverse Proxy" functionality
19:09bitemyappmikeyg6754: whatevs.
19:09justin_smithmikeyg6754: putting nginx in front of apache is perfectly cromulent
19:09technomancyjustin_smith: really?
19:09`cbpwat
19:10bitemyappI've done it before.
19:10bitemyappI don't remember why, but I've done it before.
19:10justin_smithI've seen it done many times
19:11technomancyfor a single server that has to be responsible for apps written in mod_php alongside something reasonable?
19:11bitemyappcark: part of the reason I use http-kit is because it's small enough to be understood.
19:11bitemyapptechnomancy: I think it was something like that where apache was handling a proglang runtime and I didn't really trust it to "front" the server and handle static assets, so I handed that off to nginx.
19:11bitemyapphaproxy on the outer layer.
19:11mikeyg6754Thanks for your input everyone, http-kit looks like it would be worth using
19:11bitemyapp(inc http-kit)
19:11bitemyapp...
19:12justin_smithbitemyapp: I think lazybot is on vacation
19:12`cbphes dead gim
19:12`cbpjim
19:12justin_smithand yes, http-kit is awesome
19:12justin_smith`cbp: maybe lazybot is being really lazy about logging in
19:13`cbpneed TimMc's mystical powers to summon it
19:13`cbpback from the dead
19:14bitemyappTim the Necromancer
19:22yogthosamalloy: no it's not mine, figured somebody would know what was going on :)
19:22yogthosamalloy: I didn't look too hard myself, but good catch with the laziness
19:23hlshipI wish http-kit supported https, in which case I would be using it.
19:25gtrakcljs autocomplete: http://i.imgur.com/GmBJ6Fj.png :-)
19:26gtrakdnolen: ^ release within a couple days.
19:27gtrakusing piggieback
19:28hlshipbitemyapp: What's that about?
19:28bitemyapphlship: it's friday, friday, friday
19:29hlshipbitemyapp: well, then, I'm sorry I exist in the same time stream as you
19:30bitemyapphlship: oh pah. I was teasing over the SSL thing. I don't think application runtimes should concern themselves with things like SSL.
19:31bitemyapphlship: that sort of thing should get implemented once in something like nginx with a reverse proxy to your app.
19:31charewho here likes pizza
19:34bitemyappchare: most constructive thing you've ever said in this channel.
19:36charebitemyapp you gonna buy pizza?
19:37bitemyappchare: I don't eat pizza.
19:37hlshipbitemyapp: Yes, not my call. And writing a banking application (credit card switch) means you have to jump through some silly hoops with regards to security (real or imagined)
19:38justin_smithhttp-kit supports client side ssl
19:38justin_smithwhich is in some situations better than server-side
19:39tpopegtrak: hooray!
19:39gtrak:-D
19:40tpopeliterally just got piggieback working in vim
19:40tpopeso I'm close to being able to try it
19:40gtrakexcellent
19:40gtrakI just used austin in the project.clj
19:40justin_smithit's so pretty watching all the CPUs peg in htop when I am running a criterium benchmark
19:40gtraknot sure how to write tests for these things.
19:40gtrakgotta run though!
19:41arrdemjustin_smith: gotta love all dem worker threads :D
19:42justin_smithfor shure
19:42bitemyappjustin_smith: just wish it generated the nice reports criterion dumps.
19:42charejustin_smith you need to change your name, I always think of justin bieber when I see your name
19:42justin_smiththat's your problem
19:43bitemyappchare: all white people names look the same?
19:43SparkySparkyBoomdoes anyone know of something like the following, but for lein 2?
19:43SparkySparkyBoomhttps://github.com/paraseba/lein-reload
19:43bitemyappSparkySparkyBoom: (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]]) (require '[clojure.data :refer [diff]]) (require '[clojure.repl :refer :all])
19:43SparkySparkyBoomlein repl is pretty slow to load
19:44arrdemtechnomancy: so if I were to put together a proposal for a channel history based votekick bot along with proof of resistance to various invasion attacks, where could I direct it? clj-dev?
19:44bitemyapparrdem: what constitutes quorum?
19:45arrdembitemyapp: that is open to debate, I just have a member evaluation algorithm in mind that's pretty sturdy.
19:45arrdembitemyapp: I'm actually gonna go prototype it now I think...
19:45arrdems/member/voter/g
19:46bitemyapparrdem: too complicated.
19:46bitemyapparrdem: you should simplify the model.
19:46gregorstocksoh boy, only an hour and 15 minutes until I can ask about haskell
19:46arrdemgregorstocks: 20. don't get ahead of yourself.
19:46SparkySparkyBoomhuh
19:46SparkySparkyBoomthat just gave me a bunch of exceptions
19:46bitemyappgregorstocks: sorry about that.
19:47gregorstocksarrdem: well I type very slowly
19:47bitemyappSparkySparkyBoom: look the namespaces.
19:47bitemyappSparkySparkyBoom: make certain the appropriate libraries are loaded via profiles.clj
19:47bitemyappSparkySparkyBoom: don't just blindly copy-pasta.
19:47SparkySparkyBoomgah
19:47SparkySparkyBoomscrew it
19:48arrdembitemyapp: not really... basically I'm resurrecting the work gdev and I did for cloutjure to have some concept of an individual's clout which is really really hard to game. Then the votekick is just can you get enough clout together to kick someone.
19:48SparkySparkyBoomctrl-d, lein repl, ctrl-d isnt that inconvenient
19:48chareso why isn't clojure beating python
19:48arrdembitemyapp: kick threshold is probably the clout of the victim more some constant roughly equivalent to technomancy.
19:49arrdembitemyapp: the idea being that a significant voting fraction of active users is required to achieve quorum.
19:51bitemyapparrdem: so what would keep a single individual with established clout from booting a new user?
19:52arrdembitemyapp: in the model which I'm considering, an old user with exceedingly high karma would effectively have ops. While you are correct that this would allow for an effectively rogue "ancient" I claim that such an occurance is exceedingly unlikely given the character of this channel. The attack set which I'm designing against are new troll users and new troll floods.
19:54bitemyapp$karma bitemyapp
19:54arrdemlazybot is MIA
19:54bitemyapp...right. bot. vacation. right.
19:54bitemyappyes yes
19:54justin_smithlazybot is pining for the fjords
19:55arrdemdon't worry, it isn't directly karma based although karma will, I suspect, correlate strongly with the ranking I have in mind.
19:55justin_smitharrdem: port page-rank over to nick-rank
19:55justin_smithso inc from someone with a high inc-count has a heigher weight
19:55SparkySparkyBoomi didnt even know #clojure had trolls
19:55arrdemjustin_smith: conceptually page-rank is pretty close to what I had in mind
19:56bitemyappI wouldn't say that I'm worried, just that I know where I stand karma-wise relative to the dnolen/bloom oligarchy.
19:56arrdemSparkySparkyBoom: we haven't until chord/chare shoed up.
19:56arrdem*showed
19:56arrdemand we had one last night which was especially foul mouthed..
19:56SparkySparkyBoomoh
19:56bitemyapparrdem: oh, who's the other bad egg?
19:57arrdembitemyapp: lemme see if that crud is still in my or rayne's logs...
19:57SparkySparkyBoomit's weird how much clojure has grown on me
19:58arrdembitemyapp: http://clojure-log.n01se.net/date/2014-01-16.html#09:54d
19:58arrdembitemyapp: wasn't all it said, but that's the line I remember it for.
20:02technomancyaw crap not again
20:03technomancyarrdem: I think it's up to Rich; I didn't get ops till he had OK'd it
20:03technomancyhad to have chouser bug him about it
20:03arrdemtechnomancy: okay. that's the answer I was expecting. I didn't know that chouser would be the PoC.
20:05bitemyappyogthos: I love you.
20:05technomancywe should have some ops in europe and asia though
20:05yogthosI try :P
20:05technomancymaybe eastern US too
20:07hlshipHere's an Om idea; I kind of which that there was a remove! function that accepted a cursor and did the work to remove that cursor from its immediate container (dissoc the key, or remove the element from a vector, etc.)
20:08hlshipNot quite seeing how to do that cleanly yet, without introducing a bunch of infrastructure (that will be useful, but getting ahead of myself).
20:09arrdemgah I forgot what a mess the entire cloutjure project is...
20:11Bronsagah. reflection warning for (.get {} 0) and (fn [x] (.get {0 x} 0) but not for (.get {0 1} 0)
20:12noto2(class {})
20:12TEttingerI think maybe {} has Object keys
20:13BronsaTEttingerno, it's a compiler bug
20:14TEttingerah, that explains the .get rather than get
20:14Bronsayeah. so for EmptyExpr and MapExpr getJavaClass returns the interface, for ConstantExpr it returns the class.
20:17tpopegtrak: I can't get anything out of it but special forms. anything obvious I might be doing wrong?
20:50quizdris there anyway to quickly and easily comment-out several lines of code in clojure? I find myself wanting to do this all the time, but putting semicolons in front of each line is a bit tedious
20:50danneuquizdr: #_(form)
20:51danneu#_ reader ignores following form
20:51amalloyquizdr: M-;
20:51amalloyis another option
20:52danneuGiven the code (eval user-input), is there anything you can do to ensure that user-input is always treated as a literal string?
20:52quizdrtyping an M followed by a dash, is that right? amalloy or is that an emacs Meta keystroke
20:53danneuMeta dash
20:53danneuer
20:53danneumeta semicolon
20:53amalloydanneu: always treated as a literal string? i don't understand the question at all
20:54quizdrwow that's pretty nify, much better than adding semicolons by hand! thanks!!
20:54kzardanneu: Something like (eval (str (quote user-input))) ?
20:54danneuamalloy: i don't really know my own question either. this error popped up in my site's error log "java.lang.ClassFormatError: Unknown constant tag 40 in class file clojure/core$eval675575" and it traces back to an eval i stupidly have.
20:55danneuI'm not sure what that error actually means
20:57hiredman,#40
20:57clojurebot#<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>
20:57hiredmanclassformat error anyway
20:59danneui had no luck reproducing it in the textbox
20:59danneuat least it's clojure
21:00danneua real monkeywrench in the life of the user-input exploiter
21:00danneuhey probably don't even use emacs
21:07muhoowow, i just got an email TODAY about early registration for cljwest, and went to the link, and it's sold out already
21:08muhoothat's pretty quick
21:10muhooare there any promotional codes floating around anywhere? a couple years back there was a friend-referral discount or some such thing.
21:10arubinThe entire conference or just the early bird tickets?
21:11muhoothe early bird tickets
21:11muhoousually there's a deadline of a week or at least a few days to get the early discount. in this case it looks like it was less than a few hours.
21:11arubinWell, registration is starting pretty late.
21:12arubinThere are also a large number of tech people in SF who will not have to travel.
21:12muhooindeed, i am one
21:23andrew_fmy
21:31locksdestructuring still confuses me a bit
21:31lockswhat’s a good resource to help me out with that?
21:34andrew_fmbraveclojure.com has some good tutorials, including basic destructuring
21:36locksI was doing the koans, but I ended but just wanting to go through it, instead of actually understanding what I was doing
21:36locksthanks
21:38andrew_fmthere is also 4clojure.com i'm sure you'e heard about. i like that one a lot, lets you see how other users solved the same problems. very educational
21:46danneulocks: http://blog.jayfields.com/2010/07/clojure-destructuring.html
22:14andrew_fmIf I get this back from a function, what am I looking at? (p2__2002# p2__2002#)
22:14andrew_fmwhat do those symbols represent?
22:16amalloyandrew_fm: those are gensyms of the sort used by #(foo %)
22:16amalloy,'#(% %), for example
22:16clojurebot(fn* [p1__100#] (p1__100# p1__100#))
22:17andrew_fmwhy would a function return the gensym directly if the % is used in a reduce function operating on a sequence?
22:18amalloyyou probably have something quoted where it shouldn't be
22:18Bronsaandrew_fm: there might be some good use case for that but I don't see one. It is more probable that there's a '% somewhere that should be %
22:19andrew_fmah, i have a '(%2), that would probably do it, I guess right? I was trying to return a list with the %2 value inside it
22:19Bronsa,'(%2)
22:19clojurebot(%2)
22:19Bronsa,#(do '(%2))
22:19clojurebot#<sandbox$eval151$fn__152 sandbox$eval151$fn__152@6cf8ff>
22:20Bronsa,(#(do '(%2)))
22:20clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval179/fn--180>
22:20Bronsa,(#(do '(%2)) 1 1)
22:20clojurebot(p2__205#)
22:20Bronsaandrew_fm: you can't have symbols starting with % inside a #() without having them gensym'd
22:21amalloyBronsa: he meant (list %2)
22:21amalloyavoiding gensyms was not the goal
22:21Bronsaoh, my bad
22:22andrew_fmok
22:25domino14i want to iterate through a map with doseq and generate an array that contains some numbers that might pass a truth test
22:25andrew_fmI'm trying to use concat which requires two collections, so I want to turn one a %2 in a function into a collection, hence why I tried '(%2)
22:25domino14i can't figure out how to do it with doseq since doseq returns nil always
22:26amalloy,(doc filter) ;; domino14
22:26clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
22:26andrew_fmin other words, i have the numeral 2 for example, and i want to join it to the end of a list, therefore cannot use conj or cons
22:28andrew_fm,(concat [1 2 3] '(4))
22:28clojurebot(1 2 3 4)
22:28domino14i have no idea what that bot just said
22:28andrew_fm,(concat '(1 2 3) '(4))
22:28clojurebot(1 2 3 4)
22:28andrew_fmsuppose 4 was a %2?
22:29Bronsaandrew_fm: as amalloy told you, you want to use (list %2) instead of '(%2)
22:29andrew_fmoh, i misunderstood that exchange
22:29andrew_fmmy bad, thanks
22:29amalloybut, also, it's unlikely that you want to concat onto the end of a list as your reduce function - generating a lazy seq is generally easier and better
22:29domino14oh
22:29domino14filter
22:30andrew_fmamalloy i'm solving one of the 4clojure problems so it worked, now I can see how others did likely better!
22:30sztamasHi, I have a multimethod question. Is it common that the dispatch function uses other arguments then the methods? Probably easier if you see the code https://github.com/sztamas/yabi-copy/blob/master/src/yabi_copy/core.clj
22:31sztamasthe usage of & _ in the methods is it alright?
22:32andrew_fmamalloy ah the reason i used concat is because I was solving #30 and was thining it would be nice if it worked on a list input, but none of those require list functionality, just vectors and strings, so the solutions are mostly using conj or cons
22:32domino14how do i use filter with do_seq
22:33Bronsa,(filter even? (range 10))
22:33clojurebot(0 2 4 6 8)
22:34domino14my thing is a map, does it work the same way?
22:34Bronsadomino14: if you want to use a doseq look-alike approach, you can use for with :when ##(for [x (range 10) :when (even? x)] x)
22:34domino14,(filter even? {2 3 4 5})
22:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: [2 3]>
22:34Bronsa,(for [x (range 10) :when (even? x)] x)
22:34clojurebot(0 2 4 6 8)
22:35arrdemdomino14: {} is a map literal. Not what you wanted there.
22:35Bronsa,(seq {2 3 4 5})
22:35clojurebot([2 3] [4 5])
22:35domino14i am parsing through the keys and values of a map
22:35Bronsadomino14: [2 3] and [4 5] will be the args of the function given to filter in that case
22:36domino14ok
22:36dyreshark,(for [x {2 12 3 13 4 14} :when (even? (first x))] (second x))
22:36clojurebot(12 14)
22:37dyresharkcan also destructure x for more clarity
22:44dyresharkalso, has anyone here tried LightTable? if so, how did you like it/what are your thoughts [primarily for clj/cljs dev]?
22:45dnolendyreshark: work in progress but promising for clj/cljs dev
22:46dsrxI know this has probably been bandied around a lot over the past ~40 years, but it feels like it could be a real successor to emacs
22:47kristofdsrx: What, Lighttable?
22:47dsrxyes
22:47kristofIs it as programmable as Emacs?
22:47dsrxyep
22:47kristofWell, there you go
22:47kristofGood replacement
22:48arrdemeh... don't be so hastey. the plugin community needs time to grow and kick the tires before I'm willing to hand out the "next emacs" tag.
22:49arrdemalso: irc client :P
22:49kristofPeople actually use Emacs as an IRC client? I thought that was a hearty joke by some humorous fellow.
22:49arrdemkristof: ... I'm using it to talk to you now.
22:50arrdemkristof: totally part of my normal dev workflow at this point...
22:50kristofarrdem: you don't just alt-tab to a term? :P
22:51arrdemkristof: no I don't. the setup is rather complicated and the short version is that I've done a lot of mucking about with tiling window managers and the minimum of keystrokes and convenience was to use ERC rather than tmuxing into a remote irssi or something.
22:52arrdemkristof: I have an irssi instance running ssl'd connections to the the servers and providing a secured proxy, and then I connect from ERC (my desktop or laptop) to the proxy. works a treat.,
22:52kristofWell, alright. It sounds like you know what works for you :)
22:52bitemyapparrdem: chare thinks it was me that got him muted.
22:52bitemyapplol.
22:52kristofOh, remote session, that's why
22:53kristofbitemyapp: It must have been, there's no way he could have been muted for being a combative troll on his own...
22:53arrdembitemyapp: haha. yep. he's bugging me about it. or trying to. god bless the fools list.
22:53bitemyappkristof: <3
22:53xuseris there something like curses for clojure?
22:53bitemyapp03:50 <chare> I KNOW IT WAS YOU
22:53bitemyapp03:50 <chare> DON'T LIE
22:53xuser:)
22:53bitemyapptoo great.
22:53arrdemkristof: one so young and yet so wise... he will do well here.
22:53bitemyappI didn't know I was going to get dinner and a show tonight.
22:53bitemyapp03:51 <chare> GOD DAMN IT WHY DID YOU MUTE ME I THOUGHT WE WERE FRIENDS
22:54arrdembitemyapp: hang on I need another beer before you post more of this gold.
22:54bitemyappapparently he doesn't know how to read IRC logs, because it's pretty clear it's not me :)
22:55arrdemwell it clearly isn't a bot... at least most of the time it isn't.
22:55bitemyapparrdem: it's not a bot, just somebody with absurd amounts of free time.
22:55arrdemthe one who was spamming curses could be a bot.
22:56bitemyapp03:53 <chare> who muted me
22:56kristofxuser: Why don't you look for java bindings to curses?
22:56clojurebotGabh mo leithscéal?
22:57bitemyappxuser: 03:53 <chare> who muted me
22:57bitemyappsigh.
22:57arrdemxuser: yeah I'm sure that there's a jcurses kicking around somewhere.
22:57bitemyappnot what I wanted copy-pasta.
22:57technomancybitemyapp: http://p.hagelb.org/mystery.gif
22:57bitemyappxuser: hold on, I have a library for you.
22:57domino14i need to pass three arguments to my filter function
22:57bitemyappxuser: https://github.com/sjl/clojure-lanterna
22:57domino14(filter my_fn map) would call my_fn with [key val] -- i need to call my_fn with [map key val]
22:58bitemyapp03:54 <chare> LINK TO IRC LOG
22:58arrdemdomino14: use (filter (partial my_fn map) map)
22:58arrdembitemyapp: 03:54? how long has he been bugging you, or are you set to some strange timezone...
22:59bitemyapparrdem: it's UTC you freakin' pagan.
22:59bitemyapphe's PRIVMSG'ing me right now.
22:59Cr8better you than me
23:00arrdembitemyapp: ... the only timezone deltas I have memorized are US/EAST US/WEST and US/CENTRAL. (+1, -2, 0).
23:00Cr8I only remember the difference between central and pacific
23:02arrdemokay.. time to ddos log4noise again
23:02arrdemoh pfffft.
23:02arrdem<chare> unmute me or I use proxy
23:02arrdemchare: just crawl off to whatever hellhole spawned you and die
23:03bitemyapparrdem: http://www.timeanddate.com/library/abbreviations/timezones/na/pdt.html http://www.timeanddate.com/library/abbreviations/timezones/na/pst.html
23:03eaglefloWhat happened to #clojure?
23:03bitemyappeagleflo: muggles took notice
23:03arrdem^ this
23:04arrdemgoddamn visigoths sacking our capital...
23:04eaglefloWell, trolls happen, what's this vitriolic reaction to them? Why paste their attention-seeking to the channel?
23:04kristofeagleflo: Humor.
23:05arrdembitemyapp: well today's adventure is gonna be rethinkdb...
23:05bitemyappeagleflo: chare is a veteran #clojure troll and he was amusing me.
23:05arrdembitemyapp: we'll see how well this ends.
23:05bitemyapparrdem: in Clojure?
23:05domino14ok, i'm almost there. i have this: (filter (partial amicables? num_map) num_map) -- my function is receiving a vector that looks like [key value], i need it to receive key, value as separate args
23:05zerokarmaleftif only trolling #clojure ended as well as https://gist.github.com/quchen/5280339
23:05arrdembitemyapp: I wouldn't write a Haskell bot to lurk here...
23:05bitemyapparrdem: complain to me and `cbp about Revise :)
23:06kristof20:03 <chare> did you mute me?
23:06kristof20:04 <kristof> It was I, the holy op of #clojure
23:06arrdembitemyapp: I was gonna bitch at you whether you wrote the library or not
23:06arrdem(inc kristof)
23:06kristoflol
23:07domino14is there a way to make filter call the function with the parameters split up as separate args?
23:07arrdemkristof: sadly lazybot is skiving off today, so no karma for you :/
23:07domino14i know i can change the function, but i don't want to
23:07technomancyzerokarmaleft: that's pretty amazing
23:07kristofarrdem: sounds pretty... lazy! *nudge nudge*
23:07arrdem(dec kristof)
23:08arrdem(reset! zerokarmaleft 0)
23:08bitemyappzerokarmaleft: very proud of them :)
23:09kristofdomino14: You mean filtering a list with a multi-arg'd function instead of a single arg'd one?
23:10kristofdomino14: And so multiple elements of the list would serve as the arguments for the predicate
23:10kristofdomino14: Maybe what you should look for is a mix of filtering over an a-list and using "apply"
23:11domino14kristof: yes
23:11domino14what is an a-list
23:11arrdembitemyapp: rethinkdb up and running... that didn't hurt too much...
23:12kristofdomino14: ((association value) (other-association value) (etc. etc.) . . . )
23:12bitemyapparrdem: it's a pretty low-pain database.
23:12kristofdomino14: A list consisting of lists which all contain two elements.
23:12kristofSomeone correct me if I am wrong
23:12arrdembitemyapp: this instance just named itself omniknight. I win.
23:12kristofand then your "predicate function" in filter would simply have apply in it
23:13bitemyapparrdem: that's actually pretty funny
23:13arrdembitemyapp: I'm gonna see if I can fix that to Warlock...
23:13kristofdomino14: I apologize, you don't want an association list. You just want a list with lists in it, each containing however many elements you need. ((arg1 arg2 arg3) (arg1 arg2 arg3) . . .)
23:13bitemyapparrdem: your rethinkdb'ing has inspired me to reboot and start hacking the old H.
23:14arrdembitemyapp: okay. mongodb can go suck eggs. rethinkdb wins already.
23:14arrdembitemyapp: if you're in windows fuck that I'm comming over to play dotaz
23:14bitemyapparrdem: wait really?
23:15arrdembitemyapp: dude. friday night. I'm ahead on homework. totally.
23:15bitemyapparrdem: also, I tell people to use RethinkDB > MongoDB all the time. there is literally not a single reason in the universe to use MongoDB.
23:15kristofdomino14: I suppose a problem with that would be that your resulting list would still contain lists of args, but then again that's probably what you want? plz rspnd
23:15arrdemhang on... lemme see if I can automagically cluster my gaming box and my main server with Rethink...
23:16kristofDo you two know each other?
23:16bitemyapparrdem: if they can ping via IP, you should be able to join them against each other.
23:16kristofIn person.
23:16bitemyappkristof: never met in person.
23:16arrdemkristof: not yet
23:16bitemyappkristof: probably will when I visit Austin this late winter/spring
23:17kristofAh. A happy couple, I see :')
23:17domino14kristof: i have a map im pasing to the function looks like {num num}, {num num}, etc
23:17domino14so then the filter function makes it take in [num num] instead num num
23:17arrdemkristof: http://i.imgur.com/r4aVfMr.gif
23:18kristofarrdem: Ugh, am I the only one who despised that movie?
23:18domino14kritofs pls
23:18arrdemkristof: I actually haven't seen it yet... the gif just sprang to mind.
23:19kristofdomino14: methinks a map doth not consist of {num num}
23:20domino14my map is a bunch of num num pairs
23:21bitemyappkristof: an optimized intmap implementation like Haskell's in Clojure would be kinda nice.
23:22arrdembitemyapp: holy shit. that "just worked".
23:23arrdembitemyapp: this is glorious. I literally spent three days trying to figure out Mongo sharding prior to clojurecup.
23:23kristofbitemyapp: ...mapping integers to items is, uh, just a vector, isn't it?
23:23bitemyapparrdem: the clustering in RethinkDB is similar to ElasticSearch. If you leave multicast on, ES will let you even skip the manual "join" part.
23:23arrdembitemyapp: rm -rfing mongo then rebooting.
23:24bitemyappkristof: sparse, no append.
23:24kristof"Big Endian Patricia Trees". Sounds like a cranky aunt from Louisiana.
23:25domino14lol
23:25arrdembitemyapp: you saw that we now have a core.red-black-tree, right?
23:25arrdemoh. no. it's data.avl.
23:26arrdemhttps://github.com/clojure/data.avl/
23:26arrdemin case you really don't trust a standard map...
23:26kristofbitemyapp: Neat stuff. I'm sure someone could write this for Clojure.
23:27bitemyapp04:21 <chare> see you assholes are not helpful but kristof is
23:27bitemyapp04:21 <chare> he told me about "do"
23:28kristofCaught red-handed
23:29kristofbitemyapp: Is this a homogeneous data structure? Or can the pairs be anything?
23:29kristofWell, these are tuples...
23:29bitemyappkristof: http://hackage.haskell.org/package/containers-0.5.4.0/docs/Data-IntMap.html
23:29kristofbitemyapp: I'm reading it
23:29kristofOh, they have to support fold
23:30kristofI guess that implies homogeneous
23:30bitemyappkristof: you'd be surprised how little homogeneity matters in a type system that isn't terrible.
23:32kristofbitemyapp: I thought it was Haskell's type system which prevented many cases of heterogeneous, arbitrary length data types? :)
23:32kristofyou can pry named/keyword arguments from my cold, dead hands!
23:32bitemyappkristof: no?
23:32bitemyappkristof: not at all.
23:33kristofbitemyapp: Haskell '98 did, according to someone in #haskell
23:33bitemyappoh that doesn't matter anyway, but it's still not strictly true.
23:33bitemyappnobody actually uses Haskell '98
23:33bitemyappit's a baseline for experimentation with compilers.
23:33bitemyappfor one thing, the current standard is Haskell 2010, and even *that* doesn't matter, only GHC does.
23:33kristofdefacto standard I see
23:34bitemyappyeah but there's still a sensible spec to work with.
23:34kristofbitemyapp: I don't know if you're familiar with it, but I was reading about Haxl and that stuff is very cool.
23:34bitemyappand standardized tooling for parsing and all that.
23:34bitemyappkristof: one of the first things you learn is that you don't need what you think you need.
23:34bitemyappkristof: Haxl is interesting to me, partly because I like Erlang-esque code-reloading and the like.
23:35bitemyappwe'll see how far they take it.
23:35kristofYes, hotloading is cool!
23:35bitemyappI know they use Haskell a fair bit.
23:35bitemyapptype-checked hotloading sounds kewl :)
23:35zerokarmaleftbitemyapp: oh man, more clojure db client libraries need to be like revise
23:35kristofThere's a fundamental trade-off though between code-efficiency and hotloaded code :(
23:35bitemyappzerokarmaleft: async pipelined connection management is me, query DSL is cbp.
23:35bitemyappkristof: yeah well, that's why Haskell defaults to AOT and all that.
23:36kristofbitemyapp: On this note, I've been thinking lately and aside from the context of macro-writing, I can't see much use for variadic functions.
23:36bitemyappzerokarmaleft: 80% of the work was cbp.
23:36bitemyappkristof: yeah you don't need them and they're unprincipled anyway.
23:37kristofthat you can't accomplish with, say, fold, passing an actual list, or simply restructuring what you wanted to write
23:37bitemyappkristof: right.
23:37bitemyappkristof: apply/reduce
23:38bitemyappkristof: there's no reason the "carry" of the fold can't be a tuple or record.
23:38bitemyapphaving two different ways to do the same thing isn't valuable in this case.
23:38kristofbitemyapp: for a second, I thought you meant that there was an apply in Haskell :P
23:38bitemyappI don't like kwargs either.
23:38bitemyappkristof: no, I was speaking to their relative equivalence.
23:38kristofright, right
23:39bitemyappkwargs are a fucking terror in python for large codebases.
23:39kristofkwargs?
23:39bitemyappkristof: there is no reduce in Haskell, you get your pick of various fold functions.
23:39bitemyappkristof: keyword args.
23:39bitemyappI hate kwargs in Clojure too.
23:39kristofah, I see
23:39domino14ok so how do i make filter call its args separately
23:39bitemyappkwargs are part of what ruined Elastisch for us.
23:39kristofClojure does not have keyword arguments.
23:39bitemyappkristof: some people fake them with destructuring pairs.
23:39kristofGross.
23:39bitemyappkristof: right? see?
23:40bitemyappkristof: people learn the pattern from Ruby or Python and then bring it over and it makes me fucking gag.
23:40kristofbitemyapp: I meant gross when you compare to keyword arguments in DARPA ^H^H^H^H^H Common Lisp
23:40xuserbitemyapp: thanks for the link
23:40bitemyappxuser: np
23:41xuserbitemyapp: ruby has keywords args since 2.0
23:41xusernot to long ago ;)
23:42bbloomxuser: they already had defacto keyword args, they added explicit keyword args, complicating their already complex calling conventions
23:42bitemyappxuser: they'd fake it with HashMaps
23:42bitemyappkristof: I used to use CL.
23:42kristofbitemyapp: I still use it.
23:43kristofIt is a complicated relationship.
23:43kristofbitemyapp: You rekindled my interest in Haskell, though, so thank you.
23:43bitemyappkristof: <3
23:43kristofI still cannot abide "do" syntax
23:43bitemyappkristof: I didn't really like static type systems in practice until Haskell.
23:44bitemyappkristof: even OCaml was bleghkh
23:44bitemyapppartly because of typeclasses. Sexy, sexy typeclasses.
23:44john2xis it possible to list all aliases defined in the current repl session?
23:45bitemyappkristof: I liked *type theory*, I just didn't like how people were putting it into practice which is why I stayed in CL/Python/Clojure
23:46xuserbitemyapp: no javascript?
23:47kristofha
23:47kristofjavascript
23:48kristofbitemyapp: I didn't appreciate types until I learned to appreciate polymorphism.
23:48bbloomjohn2x: use (find-doc "ns-")
23:48xuserkristof: polymorphism like overriding methods Java?
23:49xuser+in
23:50kristofxuser: :) cheeky. I just mean the (only good) idea from OO that "there are different kinds of thingy-things in this world, and when I want to do different actions depending on that thingy-thing."
23:50kristof*sometimes I want to
23:54bitemyappxuser: by necessity, not because I liked it.
23:54ddellacostakristof: I would argue that that is not OO's redeeming good quality...in fact I would say that is one thing that OO does rather poorly, at least in most implementations in common use (C++, Java, etc.)
23:54bitemyappxuser: I write mostly Fay lately when I need JS
23:55kristofddellacosta: Really?
23:56xuserbitemyapp: nice, is the integration with 3rd party libs better thatn cljs?
23:56bbloomkristof: really
23:56kristofWell I can't think of anything else that could be offered by single-dispatch kingdom-of-nouns yada yada . . .
23:56bbloomkristof: IMO, the gift OOP/SmallTalk gave to the world was noun.verb syntax
23:57bbloomhurray -> syntax :-)
23:57kristofbbloom: Boo! Someone switched the order of verb arg syntax, that's all that is.
23:57kristofbbloom: Smalltalk did not start with noun.verb syntax anyway
23:57ddellacostaI struggle to understand what OO is good for, honestly. I find that, the more I spend time with languages like Clojure and Haskell the less I can find anything redeeming in OO, as it is practiced.
23:57bbloomkristof: well then whoever deserves the credit :-P
23:57xuseris better to invest in learning the closure library for cljs than jquery?
23:58kristofI think those two things are not related.
23:59ddellacostaxuser: if you haven't read my article on the CLJS libs I suggest taking a look, it could help you answer that question: http://davedellacosta.com/cljs-dom-survey