#clojure logs

2013-08-06

00:03diphtherialhey, can i have leiningen installed for both windows and cygwin at the same time? it seems they both use the profile's .lein directory, and i'm concerned that they'll conflict
00:10diphtherialapparently not, thankfully; i ran lein in the ~/bin directory after adding it to the path and it seems like things worked out ok...
00:11diphtherialverified, lein is now usable both from cygwin and the standard windows command prompt
00:56Foxboronusing vim-fireplace, trying to eval code but the only thing i get is "ClassCastException java.lang.Character cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:214)"
00:57Foxboroni can't seem to find any reasonable explenation why as it works in lein repl, but not inside vim
01:00zeroemoffending code?
01:01Foxboronimpossible, evaling (def test "hello world")
01:01zeroemoh
01:01zeroemerm
01:02zeroemone sec, installing fireplace
01:05zeroemhrm
01:05zeroemworked fine for me
01:05zeroemeverything up to date?
01:06zeroemI'm using Lein 2.2, clojure 1.5.1
01:06zeroemand I just grabbed fireplace from git
01:07Foxboronjust pulled the latest changes, but no luck
01:07Foxboroni did however test with another project, and it works
01:08Foxboronso obviously something i have fucked up now
01:08clj_newb_2345 fireplace is awesome
01:08clj_newb_2345I like fireplace
01:09RaynesIt's warm and cozy, ain't it?
01:11Foxboronzeroem: rmed the dir and made a new project.
01:11Foxboronsuddenly it works
01:11zeroemwhen all else fails, start over, right?
01:12Foxboronor force push.
01:12Foxboronsolved every problem possible
01:49futilecrap
01:49futileive gone insane.
01:49futiledangit
01:50futileand on a day like this!
04:13clgvI have a problem with using data_readers.clj, the function specified for a tagged literal is initialized as Unbound but it remains Unbound even after requiring the implementation namespace
04:26ro_stis it possible to stop clojure's pr-str / println / pprint from including commas?
04:26clgvhow is data_readers.clj supposed to work if it interns all specified functions as clojure.lang.Var$Unbound and requiring the implementation namespace does not replace Unbound with the actual implementation???
04:26lazybotclgv: How could that be wrong?
04:31tomjackclgv: /shrug works for me
04:31clgvtomjack: you got a minimal example?
04:31clgvI tried with plain leiningen
04:32tomjackgist is down :(
04:32clgvrefheap?
04:32clojurebotrefheap is gist
04:32clgv~gist
04:32clojurebotgist is http://gist.github.com/
04:32clgvlol
04:32clgvrefheap.com
04:33tomjackhttps://www.refheap.com/0695892d84b594cbea1e04ccd
04:34tomjackyou're not trying to use a tagged literal inside ns, are you? :>
04:35clgvno.
04:41clgv tomjack: well if I do not require the implementation namespace in the file it does not work when requiring it manually in repl
04:42clgvtomjack: before requiring the function symbol is set to Var$Unbound and after that as well
04:44tomjackyou need to require it before starting the repl
04:44tomjackif you want to test it in the repl you will have to read-string
04:44clgvwhy?
04:44clojurebotWhy is why
04:44tomjackhmm
04:45tomjackI'm full of shit
04:45clgvif that is really a requirement, it is even more impractical that the implementation namespaces are not loaded
04:45tomjackmaybe that is true, maybe it isn't, I don't know
04:46clgvI should be able to redefine the function as any other function in the repl. but it seems not like it
04:47tomjackhmm
04:47tomjackI just tested at the repl, seemed to work
04:47clgvI tested in a fresh project...
04:48tomjackI happened to have a data reader sitting around in this project that I forgot about
04:49tomjackhttps://www.refheap.com/aa4c65ba3d60c7595dd09f9cb
04:50tomjackI'm in swank /blush, no clue if that matters
04:51clgvdamn I had a typo in the fresh project, so it did not work there but now works. so bug search in the real project... :(
04:53clgvoh found the typo in the real project... :/
05:02cemericksquidz: Thanks, glad it's working out for you. :-)
05:06noidicemerick, thanks for doing the austin screencast. austin looks very promising, I can't wait to try it out!
05:06cemerickI hope it lives up to expectations :-)
05:13shdwprinceoh, debuging macroses is completely horrible
05:14shdwprincemaybe there is some useful tools, not only macroexpand?
05:14ro_stmacroexpand-1 ? :-)
05:14ro_stalso, do as much of the work in normal functions as you can
05:15shdwprincero_st: I'll bet there is solution for indenting macroexpand output :)
05:15supersymhow do I remove the outside parens of a form? e.g ([a b c][d e f]) so I remain with the inner part?
05:15ro_stvery often macros can be tiny wrappers around otherwise normal functional code
05:15ro_stsupersym: with code or in emacs?
05:15supersymnewb question, can't for the love of god figure it out, must still be half sleeping
05:15supersymwith code
05:15supersymflatten is for inner
05:15ro_stwhat do you want it to look like afterwards?
05:16ro_st[a b c d e f] ?
05:16supersym(syntax-quote ...) from backtick only takes a single form so I have to wrap it
05:16supersymofc I can do first, rest map over it
05:16ro_st~@ unwraps seqs
05:16clojurebotseqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html
05:16shdwprince~@ in macroses should expand (a b c) into a b c
05:16ro_stin macros
05:16supersymwas just wondering if there is a function for it
05:16supersymah
05:16supersymits a defn atm still
05:16supersymexplains
05:16shdwprincesypersym, that function should return 3 results, or,.. syntax?
05:17ro_stwhat data structure do you want to end up with?
05:17ro_st,(apply concat [[1 2] [3 4] [5 6]])
05:17clojurebot(1 2 3 4 5 ...)
05:18supersymah
05:18supersymthnx
05:42schmirI need to import two classes with the same name from two different namespaces. can I somehow use :import with :as or something like that..?
05:43clgvschmir: that's a missing feature I guess
05:50schmirlooks like I can use the fully qualified name for that...
06:02muhooweird, why would friend/authenticate only work BEFORE compojure.handler/site, and not after it?
06:03muhoowhen using context in compojure, that is.
06:03muhooif i don't use context, i can stick wrap-authenticate way at the end of the chain, and wrap-authorize anywhere before it
06:04muhoobut if i've got context up in the mix, then it has to be (-> app wrap-~authorize wrap-authenticate handler/site)
06:07muhoosorry (-> app handler/site (friend/wrap-authorize #{::stuff}) friend/authenticate) works, but if i've got context in there, handler/site must come after friend/authenticate
06:09Raynesmuhoo: You be workin' the late shift homeboy.
06:09muhooyeah, deadlines and committments
06:09RaynesWell, 'fraid my ability to help you ended as soon as you said 'friend'
06:09ro_stcemerick is around, muhoo
06:10RaynesI forgot that cemerick was a morning person.
06:10muhooi'll try him in the am east coast time
06:10RaynesThis is the AM east coast time, muhoo.
06:10muhoomeans, like, in a few hours
06:10cemerickis this not AM?
06:10Raynesmuhoo: It's 6AM. cemerick gets up this early.
06:10muhooah, there he is
06:10RaynesI know it's wild, but it happens.
06:10cemerickRaynes: dude, been cranking for 2 hours.
06:11RaynesI haven't even slept yet, man.
06:11RaynesAlbeit it's only 3AM here, but still.
06:11muhooanyways, i'm baffled by something that maybe if i had sleep would make more sense
06:11cemerickmuhoo: friend requires various ring middlewares; the order of application matters
06:12cemerickRaynes: Sounds like I'm a solid 12 hours ahead of you, then ;-)
06:12muhooi've noticed that. and it appears authenticate does not like being at the end of the chain, if context is uses at the beginnign of it.
06:13cemerickmuhoo: authenticate establishes the scope of friend's control; if you put stuff outside of that scope, then friend can't do much about that :-)
06:13muhoothat's why i'm having heartburn over this
06:13muhooi want to put authenticate at the end, to secure the WHOLE app
06:13muhoobut it hates that. it insists on being before handler/site.
06:13muhooONLY if i have some context routes though. if i pull out context, then i can stick authenticate at the end.
06:13cemerickmuhoo: handler/site isn't any part of your app
06:14muhoohandler/site is compojures stock wrappers
06:14cemerickyeah, I'm aware
06:14muhooand i have other stuff like wrap-file-info, wrap-resource, etc, after handler/site
06:14muhoohmmm, maybe i can stick those before handler/site.
06:15muhooi dunno, what bothers me is the voodoo nature of this; just moving stuff around without understanding why it works or doesn't makes me.... uncomfortable
06:15cemerickmuhoo: well, don't do that, then :-P Determine what each middleware requires, or not, and place them appropriately.
06:15cemerickThey're not meant to be shuffled willy-nilly.
06:16muhooindeed. i vaguely remember someone working on some kind of dependency management for ring middlewares
06:16cemerickyeah, nREPL has a similar system for its middlewares that automates all this
06:16muhooah, that's right, it was nrepl not ring.
06:17cemerickmuhoo: short rule of thumb: handler/site or handler/api is *always* last/outer, followed by friend, then contexts, then your actual bare ring handler/routes
06:18muhoook, it's coming back to me now. because handler/site has things like wrap-query-params that friend will need, i.e. for reading user/password info out of posts, etc
06:18cemerickIf you have other middlewares that are strictly transformative (most are), then putting them between handler/site and friend generally makes sense
06:18muhoothanks, i think i'm back in reality now.
06:19muhoobtw that austin thing looks very cool, will play with it as time permits
06:20cemericksounds good :-)
06:40muhoook, everything cool now with friend and compojure. next, i will have to integrate friend with https://github.com/cmiles74/bishop . after some sleep first though :-)
06:42noidiambrosebs, is the new HMap syntax documented somewhere? (:mandatory, :optional, :complete?)
06:42ambrosebsnoidi: maybe... :) I'll have a look.
06:44ambrosebsnoidi: doesn't look like it. I'll update the types wiki.
06:46noidiambrosebs, thanks
06:47ambrosebsnoidi: I was thinking of making a clojure.core.typed/HMap var with some doc metadata.
06:49noidithat's a good idea
06:50noidiambrosebs, is there a way to tell core.typed that the map should not contain extra keys beyond the ones listed in the type definition?
06:51ambrosebsyes HMap takes a set of keywords with the :absent-keys option.
06:51ambrosebsoh
06:51ambrosebs:absent-keys is saying these particular keys don't occur, but :complete? true says "there are no more entries".
06:53noidi(t/cf {:foo 123, :bar 456} (HMap :mandatory {:foo Long}, :complete? true))
06:53noidi;= (HMap :mandatory {:foo Long} :complete? true)
06:54ambrosebsthat's a bug
06:54noidiok
06:54ambrosebsI'll write up the docs then I'll fix that :)
06:54noidigreat, thanks!
07:00clgvambrosebs: how much of clojure.core can you cover with core.typed now (approximately)?
07:02ambrosebsclgv: do you mean unchecked types?
07:03harjaIn Fireplace's documents it says that it should autoconnect to nREPL when Leiningen is in use. In practice this never happens, I have to type in :Connect nrepl://localhost:<port> if I want to connect
07:03harjaWhat am I doing wrong?
07:03clgvambrosebs: rephrased: what are the critical open problems atm?
07:04ambrosebsclgv: I don't think there are any gaping holes left.
07:04clgvambrosebs: oh. interesting.
07:05ambrosebsclgv: perhaps metadata. There's half assed support there currently.
07:06ambrosebsclgv: nothing crazy though.
07:06clgvambrosebs: ok. so I probably should try it out on one of my projects...
07:07ambrosebsclgv: I'm sure there's many little issues waiting to be found, but no showstoppers. It's a good time to start using core.typed.
07:07harjanever mind, I guess reinstalling leiningen did something to fix it. now it works.
07:08andrewmcveigh|woharja: I'm no expert with fireplace, but I had the same issue. Ensure that the file $project-dir/target/repl-port is being created, and that it has the port number in it.
07:08andrewmcveigh|wo... oops, too late.
07:08ambrosebsclgv: what kind of project are you thinking of checking?
07:08clgvambrosebs: just private ones. I have a small website scraper which might be a good start
07:09ambrosebsclgv: cool
07:09clgvbut interesting for the features around checking maps
07:09clgvambrosebs: is there any (blog) article you'd suggest for starting?
07:11ambrosebsclgv: I don't think there's much out there. My fault.
07:12ambrosebsThere's the official docs, that gives a start
07:12ambrosebshttps://github.com/clojure/core.typed/wiki/User-Guide
07:12clgvok. I just thought I ask since for other libs there are often several blog posts introducing them^^
07:13noidiambrosebs, a feature request: when typechecking fails for a map's value, I'd like the error to be reported for the value (mentioning the value type's alias) and not the outermost map
07:13noidi(that might not make much sense so I'll give an example)
07:14noidisuppose I have an object like {:foo {:bar {:baz 123}}}, and corresponding type aliases Foo, Bar and Baz
07:14noidiand a type alias M for the whole map
07:14noidiif baz's value has an incorrect type, currently core.typed reports that {:foo {:bar {:baz 123}}} is not of type M
07:15noidiwhile I'd want it to tell me that 123 is not of type Baz
07:16ambrosebsnoidi: hmm. I'll have to think about (how to do) that.
07:20ambrosebsnoidi: I don't think that would make sense if you had an expected type like (U M N O P). You'd have to just pick a random union member, and there might be multiple errors per member..
07:21ambrosebsMy suggested solution if you ever get stuck like this is to use ann-form to do some static debugging.
07:21ambrosebsKeep annotating inner maps until something blows up that you recognise.
07:22noidimakes sense, thanks
07:22ambrosebsnp
07:23ambrosebsclgv: I'm very actively on the mailing list and developing core.typed, so don't hesitate to query.
07:24clgvambrosebs: ok thanks. :)
09:00Anderkentheh, the error when you get docstring order wrong is very useful :P
09:00Anderkent,(ns "docstring?" foobar)
09:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
09:00Anderkentno line information obvsly
09:00clgvthey usually are^^
09:11harjaargh "goog.require could not find: clojure.browser.repl"
09:12harjadoes someone have ideas on how to fix that?
09:14ro_stnothing on the google?
09:14chrisrossispeaking of error output, is there an easy way to produce stack traces that leave out the java frames?
09:14chrisrossiit can be kind of a pain searching the strack trace for the few clojure frames.
09:15ro_stchrisrossi: you might want to look at the source of https://github.com/jaycfields/expectations
09:15ro_stit culls java and clojure lines from straces when presenting output
09:15kmicuhttps://github.com/mmcgrana/clj-stacktrace
09:15ro_stor that :-)
09:16ro_stthat still prints all the lines though
09:17chrisrossithe former functionality would be great if it were packaged independently from a unittest framework.
09:18chrisrossii suppose if i get ambitious i can steal that code and package it separately.
09:18harjaro_st: nope :(
09:19kmicuDo not use that word here.
09:19kmicuharja: How you get it?
09:21kmicuRefheap your project.clj
09:27harjakmicu: https://www.refheap.com/c1221b89bb65ec1b773e01524
09:27wakeuphi all
09:27supersymhello :)
09:28wakeupWhats clojures pendant to REMOVE-DUPLICATES?
09:28clgvwakeup: distinct
09:28ro_stor set
09:28wakeupbut I cant pass it a test function?
09:28clgv,(distinct [1 1 2 1 3 3 1 5])
09:28clojurebot(1 2 3 5)
09:29clgvno. it is based on sets not on comparison functions
09:31hyPiRionhm
09:31hyPiRion,(distinct [1.0 1 1.0 1])
09:31clojurebot(1.0 1)
09:31harjaI solved that error by just requiring clojure.browser.repl in my cljs-script
09:31harjahowever, now the error is "Cannot call method 'appendChild' of null "
09:31harjain goog.net.xpc.CrossPageChannel
09:38harjaah, that code needed to be at the body, it did not have a parent element when I included the script in head...
09:51tbaldridgewakeup: perhaps group-by?
09:51tbaldridge,(group-by pos? [0 1 2 3 4 5 6])
09:51clojurebot{false [0], true [1 2 3 4 5 ...]}
09:52tbaldridge,(group-by even? [0 1 2 3 4 5 6])
09:52clojurebot{true [0 2 4 6], false [1 3 5]}
09:52tbaldridgethat's better
09:53tbaldridge,(group-by (partial / 4) (range 10))
09:53clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
09:53tbaldridge,(group-by (partial / 4) (range 1 10))
09:53clojurebot{1 [4], 4/5 [5], 2/3 [6], 2 [2], 4/7 [7], ...}
09:53tbaldridgeokay, nevermind, I was trying to show more than one group
09:56hyPiRion,(group-by #(mod % 3) (range 10))
09:56clojurebot{0 [0 3 6 9], 1 [1 4 7], 2 [2 5 8]}
09:59gavrihow do I reduce a map to get the map entry with the smallest number as its value?
10:01tbaldridge, (reduce #(min %1 (second %2)) {:a 1 :b 2 :c 3})
10:01clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Number>
10:02tbaldridgeack, scratch that
10:02tbaldridge, (reduce min (vals {:a 1 :b 2 :c 3}))
10:02clojurebot1
10:02hyPiRion^
10:02gavrithat just gives me the value, doesn't it?
10:02gavriI'd like the corresponding map entry
10:02gavrispecifically, I'd like the key
10:03hyPiRion,(reduce (partial min-key val) {:a 1 :b 2 :c 3})
10:03clojurebot[:a 1]
10:03gavrithanks, hyPiRion and tbaldridge
10:04noncomhi, is there any (time) function that returns simply a double of ms, without printing anything to the console?
10:04kmicu,(reduce (partial min-key val) {:a 1 :b 2 :c 3 :d 1})
10:04clojurebot[:d 1]
10:16stuartsierranoncom: not built-in, but easy to write with System/currentTimeMillis
10:17noncomyeah, no problem
10:33wakeupwhat are the requirements for IS (clojure.test) to be not ignored?
10:33gfredericksignored by what?
10:34wakeupI don't know
10:34kmicu;]
10:34wakeupI have a function which loops over randomly generated test values and checks them with IS
10:34wakeupso far so good, only they don't show up when I run lein test
10:34tbaldridgewakeup: code?
10:35gfrederickswakeup: are you using deftest?
10:35wakeupunless I wrap the function call with (is (= (distinct (test-func))
10:35wakeup...
10:36wakeupThe test is defined using deftes, but the test itself calls the function which uses IS repeatedly
10:36tbaldridgewakeup: that should be fine
10:36wakeupI can see how the architect of the test suite fucked this up, what I don't understand is why it works when I wrap the call with said code
10:36tbaldridgewakeup: are you sure you aren't returning a lazy seq that isn't getting relized?
10:36wakeupbut for iunstance not if I just wrap it with an IS
10:37tbaldridgedistinct would realize the lazy seq...
10:37wakeupah
10:37wakeupof course
10:37wakeupok
10:37wakeupis there some idiom for ensuring stuff is evaluated?
10:37tbaldridgewhat you can do is wrap it in dorun or doall
10:38wakeupah ok
10:38tbaldridgeyeah, it's odd at first, but after a time, using lazy seqs in this way will start to give you a
10:38wakeupwhats the difference between dorun and doall?
10:38gfrederickswakeup: doall returns the seq
10:39tbaldridgedorun returns nil
10:39gfrederickswakeup: my preferred method is to use doseq instead of map
10:39tbaldridgeso doall keeps the entire seq in memory, dorun will throw parts of the seq away as it goes.
10:39gfredericksI don't like combining map with side effects, and clojure.test/is is a side effect
10:40wakeupI am mapping over (keys ...) now it complains its result isn't a vector and thus can't be used with doseq
10:40gfredericksdoseq has different syntax
10:41gfredericks(doseq [k (keys ...)] ... do something with k)
10:41tbaldridgedoseq is like a foreach
10:41wakeupah
10:41wakeuplike CL's DOLIST
10:42wakeupthanks for the help
10:42TimMctbaldridge: I don't think doseq holds the head.
10:42TimMcSorry, misread.
10:42tbaldridgeno
10:42tbaldridge*np
11:29ambrosebsnoidi: just pushed 0.1.22, with lots of fixes for HMap. Docs: https://github.com/clojure/core.typed/wiki/Types
11:32ambrosebsnoidi: 0.1.21 rather
11:40wakeupis there an easy way to use org.apache.commons.codec.binary.Base32 with leinigen?
11:41llasramwakeup: In what sense?
11:41wakeupI'd like to :import it and add it to :dependencies?
11:42wakeuphave leinigen figure out where to fetch the source?
11:42gfredericksif you can find its maven coordinates
11:43TimMcFind the Maven coordinates of the Apache Commons project on http://search.maven.org/
11:44TimMcthen put the [group/artifact "version"] in your project.clj's :dependencies vector.
11:45gdevI always try lein search first because then you can let that run while you get a cup of coffee and come back and there it is
11:47noidiambrosebs, looks good!
11:47ambrosebsnoidi: cool!
11:47llasramgdev: I think the most-recent (or next?) release of Leiningen includes significant improvements for `lein search`
11:47noidiambrosebs, you're missing a question mark at the end of the keyword here: "Finally, :complete says that there are no further entries in this map."
11:47ambrosebsthx
11:48gdevllasram, aww so it's going to break my workflow?
11:49llasramgdev: Yep! You can always write your own `lein frobnicate` plugin which just spins the CPU for a bit though
11:57gdevlein goldbrick, prints random quotes from bladerunner in a format that looks like a dependency (i.e Downloading tell-me-about-your-mother "1.0.1 RC1" from feux-maven-central...)
11:59gdevllasram, seriously though that sounds exciting
12:00gdevwith lein search and lein-try together you can ramp up an experimental repl in no time
12:02zerokarmaleftgdev: or just delete lein's index every time you want a cup of joe
12:03zerokarmaleftbut a plugin specifically for being lazy seems to be the more elegant solution
12:04dnolentbaldridge: any chance of fixing the core.async set! bug, I think that's the last locals related thing that's really busted.
12:07tbaldridgednolen: yeah, I have a fix in mind, I'm traveling later today, so I'll see if I can't whip it out while waiting on the plane
12:07dnolentbaldridge: sweet!
12:28ddellacostahow do you reference instance properties of a Java object within a proxy call?
12:28ddellacostaoh, seems like you can't maybe: "Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied."
12:28ddellacostahmm
12:54mikerod,(list? (cons 'a '(1 2)))
12:54clojurebotfalse
12:54mikerodThis came somewhat a surprise to me.
12:55mikerod,(list? (list* 'a '(1 2)))
12:55clojurebotfalse
12:56TimMcYeah. :-(
12:57dnolenmikerod: IPersistentLists have guarantees that Cons does not.
12:58TimMcdnolen: TRWTF is that list* does not return a list?.
12:59dnolenTimMc: who uses list*?
12:59TimMc*shrug*
12:59TimMcIt's a public fn in core.
13:00mikeroddnolen: I can accept that. I still can't say I expected that. However, list* not being a list?, that's a bit of a stretch. I know that list* isn't necessarily popular.
13:00gfredericksdnolen: I use it a lot
13:00gfredericksespecially in any macro where I'm avoiding backtick for some reason
13:02technomancylist? is bad =(
13:02dnolengfredericks: right, but then you'd probably use seq? anyway
13:02technomancy#(and (counted? %) (seq? %)) is much clearer
13:03gfredericksdnolen: sure, I'm not complaining about list? I'm just saying that I use list*, since you asked :)
13:04gfredericksI should add this to my nonexistent list of gotchas though
13:05dnolentechnomancy: you would also need to check ISequential, IPersistentStack, ICollection etc
13:07mikerodYes, I am going to avoid using list? anymore.
13:08mikerod,(list? (concat '(1 2) '(3 4)))
13:08clojurebotfalse
13:10shdwprince&(type (concat (list 1)))
13:10lazybot⇒ clojure.lang.LazySeq
13:11shdwprince&(type (list 1))
13:11lazybot⇒ clojure.lang.PersistentList
13:11shdwprince(seq? (concat (list 1)))
13:11shdwprince&(seq? (concat (list 1)))
13:11lazybot⇒ true
13:13shdwprinceSomeone knew tools for debuging macroses? Something like indenting macroexpand output?
13:14shdwprince*knows
13:14dnolenshdwprince: some dev envrionments do this for you.
13:14shdwprincednolen: currenly my dev environment is REPL
13:15dnolenshdwprince: you can use clojure.pprint
13:19shdwprincednolen: thanks, forgot about it
13:20ro_stdnolen: how do you cope with raw javascript in your day job?
13:21ro_stif i was you i'd be itching to use Cljs instead :-)
13:22dnolenro_st: I don't mind raw JS for simple stuff, which is what I usually to write. Less fun as the problem scope grows.
13:24ro_stdo you see Cljs making its way into your day job at some point?
13:40callenro_st: that's like asking a grad student how their thesis is going. Kinda rude.
13:40callenunless you're intentionally trying to produce a Hnnnnggggg reaction.
13:41dnolenro_st: just depends on the project. I introduced CoffeeScript here 2 1/2 years ago, so it's not outside the realm of possibility.
13:44dnolenro_st: one things that's missing for me is a sensible CLJS templating solution. I'd like to see something innovative in this area - like something adaptive, string building for initial render, individual element update otherwise.
13:48ro_stcallen: i'm merely curious. dnolen is doing phenomenally awesome things with cljs and i think it'd be a pity if he didn't get to use it on his day job, is all :-)
13:50callendnolen: we're considering making Selmer CLJS compatible.
13:50callendnolen: http://github.com/yogthos/Selmer/
13:50callenre: templating
13:51dnolencallen: I'm not interesting in a traditional templating system - I want a tunable rendering pipeline
13:51dnolentemplate should produce some that leads toward that goal
13:51callenSelmer was designed around server-side rendering at scale, so you'll have that I suppose.
13:51dnolens/some/something
13:52dnolencallen: yeah not interested in that, client side rendering is what I'm talking about
13:52callenanything along the lines of an incremental templating system for the frontend that I've considered has led me to say "just use AngularJS"
13:52callenor, two-way binding in the abstract.
13:52dnolencallen: AngularJS is busted in too many ways
13:52callendnolen: such as?
13:53ddellacostadnolen: super interested in a new CLJS templating solution. Have been talking with my boss about something that does partial evaluation of functions, ending up with simple str concat functions
13:53dnolencallen: no real notion of modularity or time
13:53callenddellacosta: dommy is the vanilla choice.
13:53tbaldridgednolen: have you taken a look at the custom template engine in Pedestal? It seems like it would be a bit closer to what you are looking for
13:53callendnolen: that doesn't really prevent you implementing things with it. It's a philosophical objection not an engineering one with concrete implications.
13:53dnolentbaldridge: but is it all client side?
13:53callenddellacosta: dommy is nearly isomorphic with Hiccup AFAIK
13:53tbaldridgednolen: yes
13:53dnolencallen: there's also nothing else I like about AngularJS
13:53bhaumani really like the solution proposed by webfui and pedsetal
13:53cemerickmy tinkerings with react have been surprisingly pleasant; have gotten much further than I ever did with angular, FWIW
13:53ddellacostacallen: yeah, we're not even at the point where we are *using* CLJS templates, so not sure what we'll move to. We have to really think about optimization first, since we are supporting older browsers
13:54callenddellacosta: gad help you.
13:54ddellacostacallen: yeah, when we get to that point I'll ping ya. ;-)
13:54dnolentbaldridge: interesting I should take a look at, but I'm really interested in something highly tunable
13:54dnolentbaldridge: i.e. different render strategies should be simple to insert
13:55dnolentbaldridge: if there's a global render strategy then I'm not interested
13:55callenddellacosta: you can ping me besides anyway. but sounds good.
13:55ddellacostacallen: haha, thanks.
13:55bhaumandnolen: there is no global render strategy only a global difference strategy
13:55tbaldridgednolen: when I last worked with it there wasn't a strategy, it's more based on the idea of a kv store, when you render things they are given ids, you can the replace those items using templates and those same ids
13:56tbaldridgednolen: that being said, you're talking to the guy who hates UI design, and works on compilers for fun, so I could be making most of this up :-P
13:57dnolentbaldridge: does it let you identify initial render vs. incremental updates? note I'm also not convinced about the diff stuff, for some applications you'll want need to work with faster data structures.
13:58ro_stdnolen: it dovetails with the app model's deltas, such as :node-create (initial) and :value/:attr (incremental)
13:58tbaldridgednolen: the render engine of Pedestal is completely detached from the dataflow stuff. So it's possible to use one without the other.
13:59dnolenro_st: ok I should look at it, I'm also turned off because I only care about client side - looking a Pedestal docs there a lot of other stuff to consider.
14:00bhaumandnolen: I played around with it for three weeks and never touched the backend
14:00dnolenbhauman: ok cool
14:00bhaumandnolen: didn't need a backend at all
14:01ro_styeah. it's also very easy to simulate a backend if you'll need one later
14:01bhaumandnolen: even so I'm not sure I am advocating it
14:01tbaldridgednolen: the thing I thought was cool, was that it allows you to mark up your html with extra attributes. That html then gets cut up into CLJS functions where the custom attributes are the arguments to the function
14:02ro_styes. and those attribs are used both when rendering from template and when updating the live dom
14:02tbaldridgeI don't know if it's the best way either, but I like it better than any of the other clojure template libs I've worked with.
14:02tbaldridgeAnyone here ever worked with XAML in .NET, now that's what I want. It had warts (tons of them), but it blows the clojure stuff out of the water.
14:03bhaumantbaldridge: i think the rendering part of pedestal is straight from clojurescript one
14:03tbaldridgebhauman: yeah, could be
14:13`fogusI think it re-purposes the CLJSOne rendering, but it's not tied to it right?
14:13ro_stcorrect. rendering is isolated to a place where you respond to 6 kinds of delta across whatever topics you define
14:14ro_st:node-create :node-destroy :value :attr :transform-enable :transform-disable. last two govern when event handling is enabled/disabled, and what those events do
14:14ro_styou could render ascii, swing, html, whatever you please
14:15bhauman`fogus: that's correct
14:16dnolenbhauman: would it be simple to coalesce render updates a la my 100,000 updates example?
14:16dnolenthat's the other bit I'm interested in which a a lot of JS MVC eff up
14:17justin_smithis there a straightforward way to plug an environment property into project.clj without using environ?
14:17justin_smithI mean java property, not shell environment var (though I guess I could use either)
14:17bhaumandnolen: I am assuming that you are thinking about different processes rendering into a render pipeline
14:18bhaumandnolen; pedestal really doesn't do that
14:18llasramjustin_smith: You can specify properties via the appropriate command-line arguments in :jvm-opts
14:19justin_smithyes, but lein-beanstalk wants properties to be in either .lein/init.clj or project.clj
14:19justin_smithwe don't want passwords in the repo, so in project.clj is out
14:19justin_smiththe same tool builds many projects, so init.clj is out
14:20justin_smithI want the var in the command line to end up in project.clj where lein-beanstalk wants it
14:21justin_smithor maybe I can make lein-beanstalk look at a jvm property instead of the project.clj / init.clj?
14:21bhaumandnolen: you could coordinate at an abstract application state level though quite easily {:button1 :disabled}
14:21technomancyjustin_smith: you can have a profiles.clj file that you don't check in, or you can unquote.
14:21justin_smithunquote? as in start project.clj with `(defproject ...)
14:22technomancyjustin_smith: defproject has an implicit ` already
14:22justin_smithor is there an implicit syntax quote and I qould just put ~
14:22technomancyor you can use read-eval
14:22justin_smithahh
14:22justin_smithcool!
14:22justin_smiththanks
14:22technomancy#=(System/getenv "YEAH_WHATEVER")
14:24callentechnomancy: the proper way to do app configuration :P
14:24`fogusdnolen: I don't think anything in Pedestal would prevent the kind of scenario that you want.
14:25technomancycallen: yeah, this plugin sounds a bit suspect
14:27callentechnomancy: anything involving AWS is questionable.
14:29technomancyAWShucks
14:29hiredmansoftware: the goal is not actively preventing people from doing what they want
14:30justin_smithis there a way to have a init-<app>.clj in ~/.lein that can be set up in project.clj?
14:31technomancyjustin_smith: the goal of lein is to get out of the way during project execution
14:31cemerickjustin_smith: use a profile?
14:31futiletechnomancy: thoughts on chicken scheme vs racket?
14:31justin_smithyeah, I probably want a profile
14:31callenfutile: this is #clojure
14:32futilecallen: and technomancy was talking about racket in here before, so why dont you direct your "shut up that's off topic" to him?
14:32technomancyfutile: probably racket, unless you need to use a lot of C libs?
14:32futiletechnomancy: hmm good point
14:32cemerickjustin_smith: just like the README says ;-)
14:32futilecallen: /ignore'd, bye
14:32technomancyfutile: it's pronounced "plonk"
14:33futileo, thx. never did /ignore before, dunno the ettiquette
14:33futile*didnt know
14:33squidzcemerick: did you use react together with clojurescript?
14:33justin_smithcemerick: read a README? well I never! (in all seriousness, thanks)
14:33dnolen`fogus: yes, I was just trying to understand what pedestal contributes as far as tunable client side rendering pipeline - sounds like not too much :)
14:33zenoliIt's been ages since I've seen a good, old-fashioned plonking.
14:33nDuffzenoli: you clearly don't spend much time in #bash
14:34futileanyone try out Nightcode seriously?
14:34callenhttp://en.wikipedia.org/wiki/Plonk_(Usenet)
14:34technomancyfutile: I did finally write up an overview on my adventures with other lisps: http://technomancy.us/169
14:34technomancybut the answer, as always, is "it depends"
14:34futiletechnomancy: I saw that a few days after you asked someone about racket in here, was a good read
14:34zenolinDuff: I'll just keep hiding in #zsh.
14:35futiletechnomancy: although I think you were too gentle and forgiving to elisp
14:35nDuffzenoli: ...learning habits that get you in trouble as soon as you try writing POSIX-compliant scripts? Fair 'nuff, as long as you don't ever leave that corner of the world. :)
14:35cemericksquidz: Yeah, though I don't think that's notable. I wasn't using their wacky HTML-in-javascript preprocessor, if that's what you're after.
14:35technomancyfutile: it's an interesting composition of the really terrible and unsurpassingly wonderful
14:36squidzyeah i was wondering what parts you used
14:36futile:D
14:36technomancyjuxtaposition, I should say
14:36zenolinDuff: My rule-of-thumb: if you think you've written a portable shell script, you haven't. I'll take my interactive improvements and suffer the consequences happily.
14:36squidzcemerick: why did it work better for you in the end in comparison to angularjs?
14:37technomancyzenoli: rule 7 of shell scripts: solaris users will yell at you.
14:37technomancythere are no exceptions
14:37futileheh, comp and juxt used in English
14:37nDuffzenoli: Eh. There's "portable", and then there's "full of subtle bugs, as opposed to fail-fast ones".
14:37cemericksquidz: I dislike special semantics hiding in HTML's clothing. Just give me a data model, etc.
14:37nDuffzenoli: ...string-splitting during unquoted expansion will get you the former type.
14:38cemericksquidz: really, it's just the framework vs. library argument for the thousandth time. :-)
14:38cemerickI've heard nothing but good things about angular from people that have embraced it. *shrug*
14:39squidzokay I see. I haven't seen it before until you mentioned it but was trying some stuff out with angularjs and was wondering what would be a better match with clojurescript. Maybe ill give it a try and see
14:40ro_stsquidz: http://keminglabs.com/blog/angular-cljs-weather-app/
14:40cemericksquidz: lynaghk had a good post about angular + cljs a little while ago http://keminglabs.com/blog/angular-cljs-mobile-weather-app/
14:40cemerickheh
14:42muhoothe single most annoying thing about hiccup, is that it seems un-possible to build up a vector and pass it to hiccup/html. i.e. (h/html [:p "foo] [:p "bar"]) works, but (h/html [[:p "foo"] [:p "bar"]]) does not, afaict
14:42gdevIMHO you should use whatever technology the business users are comfortable having their app written in
14:42zenolitechnomancy: From my experience, I think they do that even if you haven't written a shell script.
14:43ro_stmuhoo: what about (apply h/html [[] …])?
14:43squidzgdev: and if you are the only one in the project?
14:43cemerickI feel the phrase "business logic" coming on any second. ;-)
14:43muhooro_st: can you apply a macro?
14:43technomancyzenoli: hehe
14:43ro_stmuhoo: oh. no.
14:43gdevsquidz, i never have that problem
14:43ToxicFrogYou can't? Ick
14:44squidzgdev: I wouldn't neccesarily call it a problem
14:44muhoo"business logic" reminds me of "military intelligence", etc
14:44cemerick"business logic" reminds me of PL/SQL and Oracle Reports.
14:44muhooi think the word is "oxymoron"
14:45hiredmangdev: that is of ridiculous, right? letting problem space domain experts dictate choices to solution space domain experts?
14:45zenoliOK, at some point my emacs autocomplete started completing on Enter...it's horrible. I've unset C-m and \r in ac-completing-map and ac-menu-map. Where else do I need to stomp it?
14:45hiredmanyou don't tell your plubber what kind of pipes he should use
14:45zenoliParticularly annoying in nrepl.
14:45hiredmanplumber
14:45hiredmanplubber
14:47hiredmanyou are an expert on how much of a pain that leaky faucet is, so you should be able to tell your plumber what kind of gasket to use, right?
14:47gdevhiredman, well when your pipes are part of the porcelain you have to
14:47cemerick,(apply #'dotimes nil nil '[[x 5] (println x)])
14:47clojurebot(clojure.core/let [n__4340__auto__ (clojure.core/long 5)] (clojure.core/loop [x 0] (clojure.core/when (clojure.core/< x n__4340__auto__) (println x) (recur (clojure.core/unchecked-inc x)))))
14:47cemerickToxicFrog: ^^
14:48gdeventerprise politics, wish there was a library for dealing with that
14:48FoxboronSo, i got a macro, and i want to assoc a value in the vector containing the args, what would be the propper way?
14:49llasramFoxboron: with `assoc`?
14:49gfredericksFoxboron: that's a little vague
14:50Foxboronllasram: i am unsure how to write it really. Example code would be awsome.
14:50Foxborongfredericks: i know
14:50gfredericksFoxboron: I don't think it's obvious what you mean; could you provide an example macro call and expansion?
14:50llasramFoxboron: Well... how about you provide a gist showing the structure of what you want?
14:50llasramYeah, what gfredericks said
14:53hiredmangdev: I am all for understanding the problem domain, but letting бизнес guys choose which technology they want is a horrible idea, and it is how you end up in a situation where someone can say "software is a fashion driven industry"
14:53FoxboronThis isnt really that great of an explenation. I am just unsure how to really write the macro when i want to assoc anything into the vector before i return the list. http://hastebin.com/gakivohoqe.clj
14:53Foxboroni know how i want to write the bodt of the code, but it the args vector that bothers me
14:54hiredmanthe choice of software stack becomes not about solving problems but signalling in the market
14:54Raynesyogthos: I got a bone to pick with you.
14:54hiredman"we use rails, so we are cool"
14:55llasramFoxboron: ##(let [args '[some args]] `(defn any [~@(cons 'map args)] ))
14:55lazybot⇒ (clojure.core/defn clojure.core/any [map some args])
14:55llasramFoxboron: Like that?
14:55Foxboronllasram: awsome, yes.
14:55yogthosRaynes: what's up :)
14:56yogthosRaynes: what'd I do this time ;P
14:56llasramOr really: ##(let [args '[some args]] `(defn any [map ~@args] ))
14:56lazybot⇒ (clojure.core/defn clojure.core/any [clojure.core/map some args])
14:56llasramOh, right
14:56llasramhah
14:56gdevhiredman, agreed.
14:56diphtherialum, quick question about the clojure koans; do they assume that you're following some other reference, or are you just supposed to know/experiment enough to determine the syntax?
14:57llasramFoxboron: So that first symbol in that context should be gensym'd, unless you really want ti to be the literal name "map" (although that is unadvisable)
14:57nDuffdiphtherial: they expect you to be using other references.
14:57diphtherialnDuff: ah, heh, great :) i got as far as sequence comprehensions and realized i didn't know enough about 'for' to proceed
14:57diphtherialthought i was being daft, thanks
14:57fgha
14:57Raynesyogthos: Global atoms in selmer.
14:58Raynesyogthos: I ought to pop you one, boy.
14:58yogthosRaynes: hehe oh that :)
14:58muhoo (map #(hiccup/html %)) ;; miserable hack
14:58Foxboronllasram: yes, i know. Was just unsure how to actually do the cons part :)
14:58yogthosmostly for configuration :)
14:58justin_smithtechnomancy: cemerick: yeah, creating a profile in my ~/.lein/profiles.clj did it cleanly, I had never really grokked profile usage before, thanks for the help
14:58cemericknp :-)
14:58llasramFoxboron: Cool beans
14:58yogthosI didn't really like it either, the other option would be to use a closure to initialize the renderer
14:59Raynesyogthos: In general though, you should really never have global atoms like this in a library. It can get bad real fast. Why not just pass in a configuration to the library? Let users give you the atoms. At that point your'e letting users have control of the state at least.
14:59RaynesThat's what I've always done with libraries that needed atoms/state/etc.
14:59callena closure would be ugly and it'd still have to be a global.
14:59yogthosRaynes: that's actually not a bad idea
14:59yogthosbut I do like letting the user manage it
15:00justin_smithhow do I programmatically access the value of a key in a profile? right now I am passing the credentials as a jvm system property while creating the uberwar, so that the uberwar can store the credentials for usage, and then providing the credentials via profiles.clj for deployment of that uberwar
15:00diphtherialah, sorry for the excessive joins/parts...do people use lighttable as a main editor around here, or is it not quite there yet?
15:00Raynesyogthos: Perhaps you could store the atoms in metadata on something or something or something. Just some ideas.
15:00diphtherialif not, is there a preferred IDE?
15:00callendiphtherial: the most popular editor is Emacs
15:01yogthosRaynes: yeah for sure, I do agree it's kinda icky ;)
15:01diphtherialok, makes some sense...closely followed by vim, i'm sure
15:01callendiphtherial: Eclipse + CounterClockWise is another popular choice as well as Vim + Fireplace.
15:01justin_smithit would be nice if project.clj could grab the value from the profiles.clj so that it could pass them to the aws environment config
15:01nDuffdiphtherial: not that closely, no.
15:01RaynesSome people use Vim. I bounce around between Vim and Emacs when I get bored.
15:01RaynesnDuff: Pretty closely.
15:01callendiphtherial: most people use Emacs, if you don't have any strong opinions, you should as well.
15:01nDuffdiphtherial: I'm a vim user for every other language except Java, but emacs has a big enough advantage for Clojure that it's what I use here.
15:01diphtherialwell, i don't mean to start a debate about it, heh
15:01diphtherialthanks for the information
15:01nDuffdiphtherial: http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
15:02diphtherialah, that's helpful
15:02llasramOh, time for cemerick to do another one :-)
15:02RaynesnDuff: That survey says that Vim is the second most used editor.
15:03cemerickllasram: that's what people keep saying :-|
15:03nDuffRaynes: ...with less than 1/3 the marketshare.
15:03cemerickI have no reason to believe that any of the results will be any different
15:03Raynes*shrug*
15:03RaynesVim has gotten a lot better for Clojure in recent memory thanks to tpope.
15:03RaynesFWIW.
15:03callenbut it's still a terrible editor.
15:03Raynescallen: Don't you use Vim?
15:04callenRaynes: occasionally.
15:04nDuffIf it's getting close on nrepl and paredit support, it might be worth looking into again.
15:04callenRaynes: I use it for quick strikes against config files.
15:04RaynesnDuff: vim-fireplace uses nrepl and paredit has been there for a while now.
15:04callenRaynes: I check into the ecosystem occasionally and update my .vimrc as well.
15:04nDuff...but I'm picky there -- couldn't tolerate the CCW or IntelliJ nrepl/paredit implementations either
15:04callenRaynes: that doesn't mean I think it's remotely close to Emacs in terms of usability or usefulness though.
15:04nDuffso not sure I want to try another not-all-there one.
15:04RaynesI mean, I like Emacs just as much as the next guy.
15:05muhoosubtle.
15:05callenmuhoo: ?
15:05ystaelI have a vague memory of people saying that extending protocols to interfaces is a bad idea. Can someone point me to an explanation?
15:05technomancycemerick: the last State of Clojure survey still had huge slime numbers
15:06callenI'm still mad about losing slime/swank.
15:06callenjust because you landlubbers didn't get your Emacs legs.
15:06technomancyit's still there
15:06callentechnomancy: sorta.
15:06technomancyuse it
15:06tbaldridge* gets of callen's lawn *
15:07callenI'd rather improve nRepl even if I'm resentful about it.
15:07clojurebotGabh mo leithscéal?
15:07cemericktechnomancy: True. Maybe we can put the nail in the coffin.
15:07nDuffdiphtherial: if you're looking for a curated editor configuration that has everything you need out-of-the-box, you might poke at Emacs Live. https://github.com/overtone/emacs-live
15:08technomancycemerick: would be cool to measure the growth even if little else has changed =)
15:08muhoopersonally, my life is massively pleasant with nrepl and i'm very glad it exists.
15:08futileSo anyone tried Nightcode yet?
15:08gdevfutile, yes, i like it a lot
15:08futilegdev: you don't miss paredit?
15:09futileI thought I saw some mailing list post about a paredit plugin that fits in any editor.
15:09futileIt'd be cool if that integrates with Nightcode
15:10technomancyI heard nightcode is pretty modern
15:11muhoofwiw, the brutal hack to make hiccup work was (->> [[:p "foo"] [:p "bar"]] (map #(hiccup/html %)) (apply str))
15:11RaynesGod help you muhoo.
15:11gdevfutile, yeah paredit and rainbow parens would be nice
15:11RaynesThe problem with nightcode is that it's named nightcode.
15:11gdevfutile, I'm sure that's something that could easily be added
15:11futileRaynes: while I don't usually care about names, I have found Nightcode difficult to type every single time I've had to.
15:11futileNo idea why.
15:12futilegdev: :)
15:12gdevRaynes, yeah, pretty soon it'll be LightTable vs NightCode
15:12RaynesI highly doubt that. :)
15:12futileIs there something line lein-exec for clojurescript?
15:12gdevLight vs Night the great debate
15:12futilegdev: ha
15:12mischovRaynes: I just sing "Nightcoding nightcoding" to the tune of "Nighttiming"
15:12technomancyoss vs kickstarter monies
15:13futilemaybe a better name would be "ClojureTextEditor"
15:13gdevtechnomancy, good point =o
15:13muhooi stay as far away from IDE's as possible.
15:13futilehttps://github.com/sdegutis/ClojureTextEditor
15:13technomancyfutile: that's stuartsierra's secret project, shhh
15:13futileha
15:13futilenow i need to rename that repo
15:13futilemaybe "TextEditor4Clojure"
15:14RaynesWolfhack.
15:14stuartsierraeh? wha?
15:14callenThere are 143 text editors. There are no perfect text editors. I'll write a new one! There are now 144 text editors.
15:14RaynesBecause everything cool has wolf at the beginning of it.
15:14gdevwell my nieces are visiting next week to test out my "clojure4kidz" repl. will be interesting
15:14futileOwltext.
15:14yazirianclj-editjure
15:14callenstuartsierra: you were writing a text editor in Clojure.
15:14Raynesstuartsierra: Carry on. Nothing to see here.
15:14stuartsierraNo I wasn't.
15:15Raynesyogthos: So, about that selmer. It looks pretty nice good work on it. Please don't put global atoms in lib-noir though. :P
15:15technomancybut if you were, that's what you'd call it, right?
15:15callenstuartsierra: you are now.
15:15callenstuartsierra: YOU DUN BEEN VOLUNTEERED
15:16stuartsierraclojurebot: stuartsierra
15:16clojurebotstuartsierra is volunteering
15:16stuartsierraclojurebot: forget stuartsierra is volunteering
15:16clojurebotOk.
15:17bosiewhy doesn't Reduce take more than one collection?
15:17futileclojurebot: futile
15:17clojurebotPardon?
15:17futileclojurebot: futile is resistance is futile
15:17clojurebotYou don't have to tell me twice.
15:17futileclojurebot: futile
15:17clojurebotfutile is resistance is futile
15:17futileuhh
15:18gdevfutile, circular reference
15:18RaynesHead explodes.
15:18futile:D
15:19stuartsierrabosie: Probably because reduce has different implementations for different collection types; it doesn't necessarily create a sequence.
15:19bosiestuartsierra: hm, wouldn't that still allow me to pass more than one of the same collection type?
15:20stuartsierrabosie: Theoretically, if it had been implemented that way. :)
15:20bosiestuartsierra: k thanks
15:30hyPiRionclojurebot: futile is <reply>resistance is futile
15:30clojurebotRoger.
15:30hyPiRion~futile
15:30clojurebotresistance is futile
15:31TimMcclojurebot: forget futile |is| resistance is futile
15:31clojurebotI forgot that futile is resistance is futile
15:31TimMc~futile
15:31clojurebotI don't understand.
15:31TimMc!
15:31TimMcOh, did hyPiRion's factoid overwrite futile's?
15:31mattmossResistance is a vegetable? Fruitless...
15:34hyPiRionTimMc: you made it forgot everything
15:35hyPiRion~futile
15:35clojurebotHuh?
15:35futileheh
15:35mattmoss~derp
15:35clojurebotGabh mo leithscéal?
15:35hyPiRion~juxt
15:35clojurebotjuxt is a little hard to grok but it's the best thing ever
15:36gdevshould be able to give it a time instance so it will respond the way it knew to in that point in time
15:37arcatan6
15:37gdev~futile #inst "2013-08-06T13:00:00.666"
15:37clojurebotexcusez-moi
15:40konrWhat cool clj/functional/programming podcasts are there besides the relevance one?
15:40shdwprince~test
15:40clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))
15:41shdwprince~clojurebot
15:41clojurebotclojurebot is pretty cool
15:41gdevlol an square
15:41shdwprince~shdwprince
15:41clojurebotI don't understand.
15:41futilewut
15:41shdwprince~badass
15:41clojurebotexcusez-moi
15:43TimMcclojurebot: futile is <reply>resistance is futile
15:43clojurebot'Sea, mhuise.
15:43TimMc~futile
15:43clojurebotresistance is futile
15:43futilehi
15:43futilei see im mentioned quite a bit lately
15:43TimMcDon't mind me!
15:43futileam i suddenly popular?
15:43TimMc~resistence
15:43futileits the hair, isnt it
15:43clojurebotHuh?
15:45shdwprinceclojurebot: shdwprince is <reply>russky paren
15:45clojurebotIk begrijp
15:45shdwprince~shdwprince
15:45clojurebotrussky paren
15:46shdwprinceI use lazybot often, but now I'll change my mind
15:46justin_smithclojurebot: justin_smith is <reply>☃
15:46clojurebot'Sea, mhuise.
15:47justin_smith~justin_smith
15:47clojurebot
15:47justin_smithcool tricks
15:47kmicu-> /query BOT in private buffer
15:47yogthosRaynes: thanks, and yeah I actually want to pull out some globals from lib-noir :)
15:47Raynesyogthos: There are globals in lib-noir?
15:47Rayneso.o
15:47yogthosRaynes: yeah sessions and cookies :)
15:47RaynesOh, that's different.
15:48RaynesThey aren't global atoms. They get bound to atoms within a scope.
15:48RaynesI'm okay with that for these purposes.
15:48RaynesBut by all means, if you can get rid of them then...
15:48yogthosRaynes: I haven't thought of a good way around that yet :)
15:53gdevhow many template libraries are there now?
15:54srrubyHow do I turn [:key1 "val1" :key2 "val2"] into a hash map ?
15:54nDuff,(into {} (partition 2 [:key1 "val1" :key2 "val2"])
15:54clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:54nDuff,(into {} (partition 2 [:key1 "val1" :key2 "val2"]))
15:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
15:55srrubyThanks!!
15:55akhudek,(apply hash-map [:key1 "val1" :key2 "val2"])
15:55clojurebot{:key2 "val2", :key1 "val1"}
15:56arohner,(into {} (map vec (partition 2 [:key1 "val1" :key2 "val2"])))
15:56clojurebot{:key1 "val1", :key2 "val2"}
15:56arohnerI'd use apply hash-map
15:57srrubyarohner: Thanks
16:21weihow would you write this fn summarize: (summarize [{:from "A" :to "B" :amount 3} {:from "B" :to "A" :amount 1}]) => {:from "A" :to "B" :amount 2}
16:21weii came up with an ugly solution but #clojure is always full of elegant ones
16:25RaynesI can't really tell what that function is doing.
16:26RaynesMy preliminary example is (fn [& _] {:from "A" :to "B" :amount 2}) given my current information.
16:26noprompt:)
16:26Raynesnoprompt: Hi!
16:26Raynesnoprompt: Wanna go to a concert in Santa Barbara on the 18th?
16:26nopromptit looks like he's trying to do something with a graph afaict
16:26yogthosso something like this?
16:27hyPiRionwei: how do you end up with 2
16:27yogthos(let [[[from x] [to y]]
16:27yogthos (->> [{:from "A" :to "B" :amount 3} {:from "B" :to "A" :amount 1}]
16:27yogthos (group-by :from)
16:27yogthos (map (fn [[k v]] [k (reduce + (map :amount v))])))]
16:27yogthos {:from from :to to :amount (- x y)})
16:27mischovrefffheap
16:27nopromptRaynes: a concert?
16:27Raynesnoprompt: http://www.stubhub.com/panic-at-the-disco-tickets/panic--at-the-disco-santa-barbara-velvet-jones-8-20-2013-4323247/
16:27RaynesHuh, the 20th.
16:27yogthoshehe yeah should've :P
16:27RaynesOkay, the 20th noprompt, not the 18th.
16:28shdwprinceI thought santa barbara was a tv series from 90x
16:28nopromptRaynes: i'm moving in to my new house on the 19th :(
16:28RaynesWhere at?
16:28shdwprinceoh, in
16:28shdwprincelol
16:28nopromptRaynes: still here in sunny fresno.
16:28Raynesnoprompt: Well you suck etc etc.
16:28hyPiRionnoprompt: that's great, isn't it? Then you can celebrate with Raynes the 20th :D
16:29nopromptRaynes: i got me a orange and a lime tree on a 1/3 of acre lot.
16:29chrisrossiwhere does leiningen download jars to?
16:29Raynes~/.m2
16:29hyPiRionchrisrossi: ~/.m2
16:29clojurebotI don't understand.
16:29Raynesnoprompt: Live a little man.
16:29RaynesIt's only a holy shit that's a long drive.
16:29chrisrossithat explains why i couldn't find it. ;) never woulda guessed. thanks!
16:29RaynesStill shorter than visiting me in LA.
16:29nopromptRaynes: i know dude. this summer did not go the way i planned. buying a home is such a pita.
16:30Rayneschrisrossi: Leiningen doesn't put them there though, the underlying maven stuff does.
16:30chrisrossiah, gotcha.
16:30Raynesnoprompt: That's why you shouldn't have bought a house.
16:30chrisrossionion.
16:30RaynesSilly.
16:30Rayneschrisrossi: Bell pepper.
16:30weihiPiRion: A pays B 3, B pays A 1, so the equivalent transaction is A pays B 2
16:30nopromptRaynes: lol, i know!
16:31chrisrossiI was referring to layers. (lein -> maven -> turtles ...) ;)
16:31Raynesnoprompt: Well, I forgive you.
16:31nopromptRaynes: i'm planning to take some time off soon though, i still wanna come down and visit.
16:31hyPiRionclojurebot: /.m2 is <reply>~/.m2 is where Leiningen puts its local repository.
16:31clojurebotAck. Ack.
16:31weibonus points if you can keep the amount positive in the summary
16:31hyPiRionAnd yes Raynes, it's technically wrong as it is maven which does that
16:32technomancyahem... aether
16:32RayneshyPiRion: It's okay.
16:32Raynestechnomancy: Gtfo hipster.
16:33xeqieh, theres a flag to override it in pomegranate, so its lein's fault
16:33aaelonywhat do people recommend when you need a function that takes variadic arguments but needs a let statement that is almost identical regardless of whether it is invoked with 2 args or 3 args… example: (defn foo ([a b c] (let […] …)) ([a b] (let […] …)) ) ?
16:33nopromptRaynes: just fyi, the reason i haven't been here the past couple months is that i was working with an intern everyday during that time.
16:33wei(inc yogthos)
16:33lazybot⇒ 1
16:33Raynesnoprompt: Nice.
16:33noprompti had #clojure withdrawals for a while.
16:33yogthosw00t
16:33hyPiRionaaelony: I just do (foo a b default-value-for-c) ?
16:34hyPiRionbut it depends on the work done within the function I guess.
16:34aaelonyhyPiRion: I could do that. The let statement is a couple lines long, but not too unwieldy...
16:34Raynesnoprompt: http://www.youtube.com/watch?v=LUc_jXBD9DU What you're missing by not going to this concert though.
16:35nopromptRaynes: the most living i've done this summer is watching battlestar galactica from start to finish lol.
16:35aaelonyhyPiRion: actually, I like that approach.. thanks :)
16:36hyPiRionaaelony: np
16:38nopromptRaynes: if you and callen can't decide who drives up/down you guys could always meet in the middle at my house now haha.
16:38Raynesnoprompt: callen already visited me.
16:39RaynesYou're the odd man out now.
16:39Raynes:p
16:39nopromptRaynes: i was thinking i might've been able to come down this week since my family is visiting my sister in the OC, but i can't find a dog sitter.
16:40RaynesAwww doggie.
16:40RaynesNow I want to drive to Fresno and pet the dog.
16:40Raynes:(
16:40nopromptyeah. here name is ruby lol.
16:40noprompt*her
16:40JasoncofHello, is there a function that will rename keys of a map by the return value of a function that accepts the key as an argument?
16:41nopromptfunny thing is i didn't name her that.
16:41RaynesJasoncof: clojure.set/rename-keys
16:41RaynesKind of.
16:41dnolenJasoncof: you can combine Raynes' suggestion with reify
16:42JasoncofRaynes: does that accept a function? It seems like it only accepts another map.
16:42hyPiRionJasoncof: Closest would be (into {} (for [[k v] the-map] [(f k) v])) where f is the function
16:42Raynesdnolen: Whoa, you be talking magic.
16:42nopromptRaynes: oh what? i didn't know that was there.
16:42Raynesnoprompt: I'm an encyclopedia of shit you didn't know Clojure had, bro.
16:42noprompti actually wrote that function by hand :(
16:42dnolen(defn foo [f] (reify ILookup ...))
16:42noprompttime for some ------ action
16:42JasoncofhyPiRion: thank you, I will give that a shot
16:43Raynesdnolen: I'd have never thought of that.
16:43RaynesThat's pretty darn cool.
16:43yogthosyeah that's slick
16:44hyPiRionHmm, it would be interesting to see if you could make a function which takes a function and returns an ILookup.
16:44gfredericksclojurebot: Raynes is an encyclopedia of shit you didn't know Clojure had, bro
16:44clojurebotAck. Ack.
16:44ztellmanunfortunately that doesn't implement the whole host of other things that a map needs to be a map
16:45ztellmanthat would have a different hash, probably not equal an equivalent map, etc. etc.
16:45ztellmanyou'd need to make sure you don't pass that into code where people are actually expecting a map
16:45hyPiRionztellman: And iterating over/seqing it is not going to work.
16:45ztellmanand invoking it as a function won't work
16:45ztellmanyou need to use get
16:46ztellmanbare minimum you need to create a map-like object: https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L21-L164
16:46dnolenztellman: implement IFn, ILookup is usually good enough in IME for many use cases no need to bother with all the other crap
16:47ztellmandnolen: not disagreeing, but that's only true if only your code touches it
16:47ztellmanwho knows what other people are expecting
16:47ztellmannon-equal hash codes, for instance, could cause insanely hard to debug situations
16:47supersymstrap on yer armor
16:47supersymdefensive programming ftw :P
16:48dnolenztellman: no argument, this is a bit of code golf :)
16:48ztellmandnolen: understood, and it's an undeniably nice round of golf :)
16:48tbaldridgemore correctly, people should just stop calling things maps that aren't IPersistentHashMaps, we should be using "will return a fn that implements ILookup" or something of that nature
16:49nopromptcode horse.
16:49noprompt:P
16:49dnolenfn->ILookup
16:50ztellmantbaldridge: that would have been a great standard to have instituted years ago, I think most people conflate being able to call 'get' with all other IPersistentCollection stuff
16:50ztellmanor IPersistentMap/Set, at least
16:50ztellmanI certainly do, anwyay
16:51tbaldridgeyeah, I did as well, until I implemented my first ILookup then I changed :-P
16:51ztellmanhaha, I just wrote this: https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L214
16:52ztellmanand all the other borderline awful stuff in that namespace
16:52Raynesztellman is the encyclopedia of doing horrible things with map interfaces. :p
16:52tbaldridgeTo be honest though, we can't rail against the gigantic Java interfaces, and then go and say "a map must implement these 20 things...." </rant>
16:52nDuffztellman: nitpick: "be have" -> "behave"
16:52RaynesNot that it's his fault it's so convoluted to map something that looks and tastes like a map, but is more like a GPS device.
16:52ztellmannDuff: ha, thanks, I'll fix that
16:53ztellmantbaldrige: I dunno, it's pretty easy to distill maps down to get/assoc/dissoc/keys
16:53ztellmantbaldridge, rather
16:53futileWho has interesting Clojure blogs these days?
16:53stompyjplanetclojure
16:53ztellmanit would also be way easier if we could use APersistentMap
16:53ztellmanrather than having to reimplement it each time
16:53stompyjsorry http://planet.clojure.in/
16:54stompyjsuper solid aggregation
16:58dnolenztellman: yeah I think the Java interfaces muddy the waters - in CLJS it's much clearer that protocols like ILookup are meant to be a la carte.
16:59hiredmanztellman: apm should be broken up in to static methods (functions) as a library for concrete implementations to use
17:00ztellmanhiredman: then you still need to implement the umpteen different functions yourself
17:00hiredmanztellman: fortunately we have macros that make that sort of thing easy
17:00ztellmanin the code I linked I use macroexpansion to handle the 21 different arities of IFn and the case statement in applyTo
17:00hiredmansure
17:00ztellmanhiredman: agreed, but some sort of abstract type would be nice all the same
17:01dnolenztellman: IFn is the definitely the place where it feels like an abomination, I've contemplating monkey patching JS Function native more than once
17:01ztellmanI mean, I wrote my own, so that scratches my itch, but something that has the official imprimatur would be way better
17:02hiredmanreusing implementation doesn't and shouldn't require inheritance
17:03ztellmanhiredman: under the covers it's just merging maps of functions
17:03hiredmansure
17:03ztellmanso there's no diamond anything to worry about
17:04hiredmanbut in the java code base you end up using abstract classes like apm for that
17:17solussddoes clojurescript not have defstruct?
17:18dnolensolussd: it does not
17:18shdwprincesolussd: humm.. clojure on jvm have not too
17:18dnolensolussd: but defstruct has been deprecated for some time now
17:18solussddnolen: i wasnt aware that it was actually deprecated. thanks
17:19solussdhrm.. if it's deprecated, shouldnt that be in the metadata or docstring?
17:20solussdsometimes I want something that really is a persistentmap and has its keys declared somewhere
17:20hyPiRionsolussd: records??
17:20lazybothyPiRion: Uh, no. Why would you even ask?
17:20hyPiRionugh, double question marks
17:21solussdhyPiRion: records arent persistentmaps and don't play well with walk
17:22stuartsierrasolussd: I have a fix for walk, see github.com/stuartsierra/clojure.walk2 and tickets on JIRA.
17:22futileI bet Clojure is great for static analysis.
17:22solussdstuartsierra: I've been watching that ticket for awhile now, thanks
17:23shdwprinceHow to handle cyclic dependency in clojure? require or in-ns && declare seems to work properly only in repl
17:23nDufffutile: played with Typed Clojure?
17:23futileNever.
17:23futileis it great?
17:23futilenDuff: hey weren't you in #python?
17:23solussdI 'patched up' the cond in walk, but still, i liked having create-struct/defstruct because of what it is
17:23nDufffutile: Were and am.
17:23futileoh
17:23hyPiRionI've done some static analysis, but I'm tempted to jump that stuff over to OCaml actually.
17:24futileocaml? i heard something was written in that.. maybe E
17:24futileyeah E lang
17:24hyPiRionBut it's heavily dependent on the problem domain, to be fair.
17:25hyPiRionFFTW uses it for analysis and code generation as well
17:25stuartsierrashdwprince: You can't have cyclic dependencies between 2 namespaces in Clojure.
17:25onrfutile: haxe
17:26onrand probably much more
17:27shdwprincestuartsierra: not with ns's, but in function
17:27shdwprince(resolve) do the job
17:28shdwprincebut i'll think about project architecture
17:28hyPiRionshdwprince: (declare func-2) (defn func-1 (something with func-2)) (defn func-2 (something with func-1))
17:29shdwprincehyPiRion: dont work with vars in another namespace
17:29stuartsierrashdwprince: That implies a cyclic dependency between namespaces.
17:30hiredman,(doc intern)
17:30clojurebot"([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."
17:30hiredman,(doc create-ns)
17:30clojurebot"([sym]); Create a new namespace named by the symbol if one doesn't already exist, returns it or the already-existing namespace of the same name."
17:31shdwprincehiredman: thanks, but i'll stay with (resolve)
17:31hiredmanhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6884-6917 go nuts
17:33hiredmanresolve (the name is a big hint) involves the cost of var resultion everytime, if you are going to do something kind of gross, at least do it in a performant way
17:40futileWhat do you do when your trusted colleague mentions that he finds it frustrating that the Mac OS X menu bar (and OS X in general) has so many processes running all the time, and that he thinks a good solution would be to have a background job start and stop them every few seconds instead?
17:40eckseyou can't get much 'simpler' than a mac
17:40technomancyfutile: recommend gentoo
17:41eckseperhaps he should write his own os?
17:41eckse*mac user
17:41eckse:3
17:42ecksesadbox: :|
17:42futileI think I said it wrong. He says he's bothered that he has so many processes running (citing all the ones with a task bar icon, presumably like Dropbox and Gmail) and wants them spun up 'on demand'. Is this a reasonable thing to be bothered by?
17:43ecksebut then they're not collecting your data
17:44eckseisn't that the true purpose of processes?
17:44eckse:|
17:44bts-is it still generally advised not to use core.async in production yet? or is it just that the interface is going to change a bit
17:44solussdfutile: well, if the app isn't doing anything it'll get 'swapped out' and is effectively not using any memory or cpu resources. starting and stopping an app every few seconds just to see if it needs to do anything is ridiculous.
17:45solussdbts-: just do it. :D
17:45futilesolussd: okay that's what I thought too
17:45futileThanks for the sanity check.
17:45bts-solussd: that's what I'm leaning towards :)
17:45solussdit's too much fun not to
18:03ziltiWhat are the currently available clojurescript testing frameworks? I tried specljs (seems to be uncompleted and broken) and cemerick/clojurescript.test (outdated?).
18:05dnolenzilti: that's it really I think, I don't think cemerick's lib is outdated
18:18timvisheranyone know if it's possible to control the canvas size of a chart in incanter?
18:19timvisher(view :width … :height …) isn't quite what I want as it seems to scale things almost exactly like it would if I had started with as smaller chart and simply expanded the window
18:19timvisherI'm trying to actually make the chart larger
18:21ziltiArgh, that whole cljs testing stuff is totally broken...
18:21xicubedzilti: kerodon?
18:22ziltikerodon?
18:22xicubedhttps://github.com/xequ/kerodon
18:22ziltiThat does not even exist
18:22xicubedwhoops https://github.com/xeqi/kerodon
18:23ziltiNo, I mean clojurescript testing, not ring testing
18:24ziltiI now spent almost 2 hours trying to set up either clojurescript.test or specljs together with cljsbuild test, and all I get are error messages
18:25atyzI'm trying to do an integration test of some routes in pedestal using: (response-for service :post "/accounts" :json-params {"account" {"name" "sonata00"}}), it is not allowing me to post this. any ideas?
18:27ziltiI mean, aren't people testing their clojurescript code?
18:41dnolenzilti: I think people probably were testing the same way the CLJS tests were done, just a function w/ many asserts
18:50clojure-newbhi if I wanted to ping 30 something ips in parallel so that I know the results of all the pings in roughly the timeout time (5 secs). How would I do it in clojure? Do I need to use an atom?
18:51justin_smithclojure-newb: https://github.com/neotyk/http.async.client
18:51justin_smithI think - maybe not for pings come to think of it
18:52justin_smithyou could create an agent or future for each ping, and test all the status after the timeout passes
18:52noonianyou could do something that returns a sequence of futures, and then deref the futures for the individual values
18:53justin_smithyeah, futures
18:53lgs32ais there a certain guideline when i should use reducers? most of my performance test (especially with collections where i don't need order) favor the clasical map or pmap
18:53noonianhmm, could return a single future that derefs all the other futures :P
18:54clojure-newbCould i have an agent or something that kept the status of all the ips and modify it in parallel?
18:55justin_smithclojure-newb: with futures, it would execute them in parallel, giving you a handle, when you deref the handle it hands you the result (if the future is ready - there is a function that tests if a future is realized)
18:56nooniancould have an atom like (atom {"ip1" "status1", "ip2" "status2" ...}) and have each future update the atom associng the returned status
18:56clojure-newbI will try that thank you both
18:57gtrakor a map of futures..
18:57justin_smithor (map #(future (ping %)) (ip-list))
18:57gtrakwhy make it more complicated with an atom?
18:58cemerickzilti: outdated?
18:58noonianderefing the atom will never block, so its easier to query the current statuses without worrying about blocking, idk it probably depends on your use case
18:58justin_smithnoonian: (map deref (filter realized? futures))
18:59zilticemerick: I noticed that there were some new commits. Well, I won't touch any clojurescript testing frameworks for the next weeks, I wasted too much time on it already.
18:59clojure-newbcould i have futures that conj to an atom then add a watch to the atom that checks for the count or is mapping deref better?
18:59noonianjustin_smith: thanks, I haven't used futures much
19:00clojure-newbmapping realized?*
19:00gtrakyou could.. but why not just treat futures as values instead of side-effects?
19:00cemerickzilti: is it that the last release was 3 months ago that's throwing you off?
19:00clojure-newbok ty all
19:00zilticemerick: I had that issue that it used an older clojurescript version, but I solved that using :exclusions
19:01cemerickoh my
19:01zilti3 months isn't unusual at all, I'm using libs here which are much "older"
19:01justin_smithclojure-newb: mapping deref - deref gets the value from the future, realized? checks if the process is done calculating
19:02clojure-newbkk
19:02justin_smithyou often don't want to deref a future that is not done yet
19:02noonianclojure-newb: yeah if you forced evaluation on mapping deref it would block on the values that hadn't been realized yet
19:02gtrakyou could loop the seq in passes, separating realized futures from unrealized ones
19:02justin_smithalso, there is future-cancel "cancels the future if possible" which is a beautiful concept if you forget the context
19:04clojure-newbcould i have a (while (not (every? realized? futures)).. ?
19:04justin_smithsure
19:05justin_smithbut if you just want to wait for all of them, just (map deref futures)
19:05justin_smiththat will block on each unrealized one until it is realized
19:05clojure-newbok
19:05ztellmanor use http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorCompletionService.html
19:06clojure-newb:-o
19:06noonian(map deref futures) should return a lazy seq so it shouldn't actually block until you look at it
19:06justin_smithnoonian: good point
19:06ztellmanunless you really, really care about doing it in order of completion, though, use (doall (map deref futures))
19:08clojure-newbI don't care about order
19:20technomancyanarchist?
19:21Raynestechnomancy: An antisocial anarchist that sounds like so and so. They say I'm just a stupid kid. Another crazy radical. Rock n roll is dead, I probably should have stayed in school. Another generation x who somehow fell in through the cracks. They'd love to see me fall but I'm already on my back.
19:21technomancyRaynes: what, so you don't care about order either?
19:22technomancyI have proof that could ruin your street cred: https://github.com/flatland/ordered/graphs/contributors
19:22RaynesBahahaha
19:23technomancythere you have it. Raynes is "pretty okay" with the establishment.
19:25hyPiRionRaynes: The school/college/university system over in the US of A sounds expensive
19:25RayneshyPiRion: I wouldn't know.
19:26FoxboronSo, i wrote a clojure version of the hackernews hated VerbalExpressions lib: https://github.com/Foxboron/ClojureVerbalExpressions writing tests atm and comments on the code would be awsome.
19:28justin_smithFoxboron: first example, where is the www coming from in the source of the tester? is that a typo?
19:28Foxboronjustin_smith: that is actually a typo.
19:29Foxboronwell, yes and no. I copied the example from the python version and i somehow left out 2 functions
19:29hyPiRionRaynes: I just felt like responding to "I probably should have stayed in school" by hinting to the fact that it's expensive in the US. Don't mind me.
19:29RayneshyPiRion: You know that those are song lyrics, right?
19:29RaynesI've got song lyrics for everything.
19:30hyPiRionRaynes: No, I thought you were awesome and made it up on the fly.
19:30hyPiRionThanks for crushing my dreams.
19:30hyPiRion:(
19:30RayneshyPiRion: http://www.youtube.com/watch?v=DPgWNuUkuA8
19:30Foxboronjustin_smith: fixed.
19:31hyPiRionRaynes: "This video is unavailable." ahah, region blocks
19:31RaynesEvil.
19:31hyPiRionI'll look it up on Spotify instead
19:38RayneshyPiRion: I was gonna mirror it for you, but they've changed bloody encryption signatures 6 bazillion times in the last two months.
19:38RaynesSo yeah, spotify may be your best bet.
19:42hyPiRionRaynes: I just found another vid, so no worries anyway
20:00hyPiRionUgh, so I need to reify a class with a single method: meta. To make matters worse, that method takes one argument. How would I handle that?
20:01hyPiRion(http://docs.oracle.com/javase/7/docs/api/javax/sound/midi/MetaEventListener.html for reference)
20:01hiredmanuse deftype
20:02hiredmanI think, I'm not sure what deftype implements "for you", but I think it may be nothing
20:02hyPiRionhiredman: I'll have a stab at it anyway
20:03Bronsadeftype doesn't implement IObj, only reify/defrecord do
20:04justin_smithhyPiRion: helpful flow chart I saw on this channel from cemerick about deciding on interop style http://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png
20:04gfredericksafaik the main restrictions are some munged reserved field names?
20:09hyPiRionWell, it seems like I just forgot to add in `this` in the call.
20:31futileIs it insane to say my next project will be "my perfect text editor"?
20:31futileOkay scratch that, perfect is a moving target.
20:32futileIs it insane to say my next project will be "a usable text editor"?
20:36robinkI have a hashmap (generated from JSON) that is still using strings as keys. The keys are static and the string contents are keyword-compatible. Is there a single-call way to turn all string keys into keywords w/o having to reassociate the values as well?
20:37hiredmanmost clojure json libraries will do that for you
20:37robinkI'm happy even to feed in a {"stringkey" :stringkey "stringotherkey" :stringotherkey} map as a hint.
20:37robinkhiredman: Ah, OK, I'm probably just misusing data.json.
20:38hiredmanconsider cheshire https://github.com/dakrone/cheshire
20:40robinkhiredman: It looks like you pass clojure.data.json/read-str a function that gets mapped over all of the keys, so you can transform them to keywords via clojure.core/keyword.
20:40robinkhiredman: but yeah, I'll look at Cheshire.
20:45robinkHeh, you just pass 'true' to Cheshire (it accepts a key transform function too, but true is synonymous for 'keyword', apparently).
20:54muhooanother friend question: default-unauthentcated-handler, which is supposed to redirect to unauthorized-url, isn't.
20:54muhooit always goes back to /
20:54muhooafaict it's never getting added to the :session
20:54muhoo(this with login form workflow)
20:59robinkIs there a Clojure HTTP client that will negotiate for a certificate with the same CN as the HTTP Host: when connecting via https?
21:00robinkclj-http just asks for whatever the default certificate is, and since I'm serving multiple certs, it ends up being given the wrong one and throws a certificate mismatch error.
21:00muhoorobink: i'm pretty sure you can customize clj-http to do that
21:00muhooit's apache under the hood IIRC
21:01robinkmuhoo: and I started in on the Apache HTTP client docs and still couldn't find an easy way of having it try to request a cert with the same CN as the host you're connecting to, or at least override it manually.
21:08patchworkUsing pantomime to get a content type given a file extension… how do I go in reverse?
21:08patchworkGet a file extension given a content type
21:13noto2patchwork: you mean jpg/jpeg for a photo, for example?
21:14TEttingerthere isn't always the same nice mapping of file extensions to mime types, I would think
21:15muhoorobink: i've done it, in java, on android. it sucked, but it was possible
21:15robinkmuhoo: Hm :(
21:16muhooclj-http uses the same underlying apache lib, again, memory is hazy
21:16justin_smithTEttinger this is the reverse mapping
21:16justin_smithso given image/jpeg he wants .jpg
21:16TEttingeror .jpeg I mean
21:17TEttingerthere is a range of possibilities for each mime type
21:17justin_smithyeah
21:17muhoorobink: it was some stupid FactoryHelperSingleton thing
21:17justin_smithbut one of them should suffice
21:17robinkmuhoo: Aha
21:18muhooand you pass it in, and you have your custom logic in there to do client side verificafion
21:19futiletechnomancy: partly inspired by your lispology post, I wrote this: https://gist.github.com/sdegutis/6168999
21:22robinkmuhoo: Seems like it also might be possible to fix in :client-params.
21:35robinkHeck, I can't figure out how to make Java's SSL support request a particular CN for a SSL/TLS connection.
21:46callen"aphyr: @ztellman @cemerick @planetclojure DECOMPLECT YOUR CODE, DECOMPLECT YOUR LIFE. http://t.co/DEWDVx63nC&quot;
21:54cemerickrobink: if you're doing HTTP, you're almost surely better off using clj-http (a.k.a. apache http clients)
21:55kristofHi! Quick question: in typed clojure, there is no type inference, right? What's to stop someone from doing type inference on only a single block of code or a function?
22:20muhoonb, fixed friend. one may not put wrap-anti-forgery after friend/authenticate, otherwise Bad Things Happen
22:21muhooso (-> routes wrap-resource wrap-file-info wrap-anti-forgery handler/site) appears to be the win
22:22muhoosorry (-> routes wrap-resource wrap-file-info wrap-anti-forgery authenticate handler/site)
22:22muhooone goat sacrificed.
22:22muhoopoor goat.
22:25justin_smithI wonder if deploys to production will ever stop feeling like I am walking on the edge of a very steep drop
22:37hlprmnkyjustin_smith: In my experience, no. There's always that chance, no matter how slim, that it will end up all on fire. :|
22:43hlprmnkyso here's a question: I'm trying to teach myself Luminus, and I got to the default test/project/test/handler.clj which tests the routes. Is it really the case that the best practice for testing a route's content is (is (= (:body response) [a ginormous blob of hand-coded HTML]))?
22:44hlprmnkyI mean, I can see how I might go about building an object that had the desired response content for a given route input and then asking (is (= (:body response) (:expected response)) but I'm surprised that isn't always already the way to do it, and so I dimly suspect that I might have Missed Something™
22:45justin_smithhlprmnky: I usually check the status is of the response, the headers, and maybe a regex on the body
22:45pandeiroi am trying to realize a lazyseq for spitting purposes and having no luck with the obvious doall solution... what else can i do?
22:45justin_smithwhich is enough to catch 500 / 404 / random controller problems mostly
22:45hlprmnkyright
22:46pandeiroi want to do (spit file (clojure.string/join "\n" lazy-lines-seq))
22:46hlprmnkyhm - I wonder if what I really want to be doing is something more like build a DOM object from the response and then ask it if it has all the parts I expect the response to have
22:47hlprmnkyI just see that pile of HTML and think "hey, there's a test failure I will not see until 3am some Wednesday, just waiting for me"
22:47justin_smithyou could destructure the html into a datastructure and check for some of the basic shape / features you want
22:48justin_smithbetter yet, make the controller take a "render" argument, which is the rendering function, and then pass in identity when testing
22:49justin_smithpandeiro: how are you using doall to force it?
22:49TEttingerpandeiro: (spit file (clojure.string/join "\n" (vec lazy-lines-seq)))
22:50justin_smithyeah, that is what I would try if doall was being used properly and did not make it fully realize
22:50pandeiroTEttinger: i'm sure i tried that but i think somewhere my lazyseq is getting cast to string before
22:51justin_smithstring/join does not expect a string, it expects a collection
22:51TEttingerstrings are kinda collections
22:51TEttingerbut not how you'd prefer
22:53pandeirooh damn. ok nvm.
22:53pandeirothanks
22:53TEttingerpandeiro, there's a way to do it though
22:54TEttingerwhat kind of string is it becoming?
22:54pandeiroTEttinger: my code was fine, i was calling the processing fn twice
22:54pandeiro:-/
22:54pandeiroit's late
22:54TEttingeroh heh
22:54pandeiroyyyeah
22:54TEttingeryeah, I'm actually having a similar issue myself
22:55TEttingerexcept in reverse :|
22:55pandeiroi think i really need to learn awk for this stuff
22:55TEttingerI have a function that operates on arrays, and repeated applications don't do anything
22:55TEttingerclojure's great for string processing
22:56TEttingerjava has potent regexes
22:56pandeiroyeah, it is... but it's not great for one-off scripts imo
22:56pandeiroi end up writing this stuff over and over again
22:56TEttingerhm, that's my main usage for clojure tbh
22:56TEttingerone-off large scripts
22:57TEttingerlike this fake greek generator https://www.refheap.com/15489
22:57TEttinger(fits in a small enough space to be run by lazybot over IRC)
22:58pandeiroTEttinger: cool
22:59TEttingersince then I've written fake english generators that slurp a wordlist and find the most common consonant combinations
22:59pandeiroyeah there is a ton you can do with so many function combinations, you are right
23:02justin_smithso markov chains on the letter rather than word level
23:05TEttingerjustin_smith, I used the function frequencies a fair bit in that one
23:06TEttingernot sure if it's a markov chain
23:13justin_smitha markov chain uses the statistical likelihood of x followed by y within some set of tokens to construct a sequence superfically resembling the input set
23:24justin_smithhttps://github.com/prismofeverything/gort irc bot, in clojure, that does markov chain restructuring of channel activity
23:54Raynescallen: You should write rap lyrics with me.