#clojure logs

2016-04-01

08:57j-pbHey does anybody know why transit-clj has the api choice of creating a writer object from a output stream? After browsing though the code it seems that it resets everything (caches) with every write anyways. So why not simply have a write method take an object and a stream? :/
09:39sdegutisHmm, I did not anticipate this.
09:40sdegutisGood morning, you /people/.
09:42prohobodont "you people" me
09:42prohoboyou racist
09:43sdegutisWell if you weren't sitting there, acting all human and everything...
09:43sdegutisSo this is the thing.
09:44sdegutisI came up with (defprotocol WebFeature (routes[this]) (css[this]) (schema[this])) which is cool cuz that's all my app is made of.
09:44sdegutisBut I didn't anticipate that the Cart web-feature's (css) method is like 91 lines long.
09:44sdegutisAnd the (routes) is around like 350 lines long.
09:45sdegutisSo that got pretty ugly pretty quick.
09:45sdegutisMost of it is the single Hiccup-returning function though, which is like 200 lines by itself.
09:49prohoboare you asking for help restructuring your code?
09:50sdegutisI'm just pondering out loud.
09:51sdegutisI guess, all in all, having a fully-featured website Cart in only 550 lines of code is pretty reasonable.
09:51sdegutisIt just gives me pause that it's all in one giant-seeming file.
09:51sdegutisAnd most of it is inside a single defrecord.
09:52ToxicFrogYank the hiccup into its own file? That's what I've been doing -- one-liners end up routes, then they turn into five-liners and end up as separate functions, then they get longer than that and get their own modules.
09:53sdegutisToxicFrog: Oh, you just reminded me of Modules! Such a better name than Feature. Thanks, I'll use that.
09:53sdegutisI never liked the name of (defprotocol Feature (routes[this]) (css[this]) (schema[this])) in the web namespace.
09:54sdegutisFeature always seemed too, um, weird.
09:54sdegutisModule makes much more sense here.
09:55sdegutisToxicFrog: But more to your point, we've had view functions in their own file, e.g. (ns myapp.web.view.cart), for the past 3 years.
09:55ToxicFrogWhat's the 200 lines of hiccup doing in the routes, then?
09:55sdegutisToxicFrog: I felt that this separation was a bit excessive and cumbersome, and too often inconvenient.
09:56sdegutisToxicFrog: So I've been "inlining" the view functions lately. In most cases, the views are much smaller, and are made up of Hiccup components created via function calls, so it's not so bad.
09:56sdegutisToxicFrog: But in this case, the Cart really has almost no reusable pieces, so it's this giant lump of Hiccup, kind of an outlier in this codebase.
09:57ToxicFrogsdegutis: yeah, at least in my case I'd definitely pull that into a separate function and almost certainly into its own file even if that's not the norm.
09:57ToxicFrogSomething that large in the middle of routes is going to require a context switch to read it anyways.
09:57sdegutisAlthough, I could probably make the Cart and Order model data structures match, and then combine their view-component functions.
09:58mgaareschema is, what, db schema?
09:58sdegutisToxicFrog: there's very little context switch in Clojure, that's the beauty
09:58sdegutismgaare: a custom data-based layer describing Datomic install-attribute transactions
09:58ToxicFrogsdegutis: regardless of the syntax used to present it, for me that's a context switch from "reading routing information" to "reading HTML"
09:58sdegutismgaare: e.g. [[:one :instant :user/last-login-date], [:many :ref :cart/items]]
09:59mgaareok
09:59sdegutis(that's fake data of course)
09:59sdegutisToxicFrog: then yeah I agree somewhat
10:00sdegutisToxicFrog: but in places where the Hiccup is like 5 lines, it makes sense to keep them in the route function itself, because they're so closely related -- when they were separate functions in the past, it just felt unnecessarily decoupled, kind of like separating the yolk from the eggwhite
10:00ToxicFrogsdegutis: yeah, that's fair
10:00sdegutisMeaning, sure, they're different things, but they go together so perfectly
10:00sdegutisBut yeah, 200 lines is a bit much.
10:01sdegutisI'm more likely though to just extract the things that make up the cart Hiccup into their own functions, and have it be smaller that way.
10:01sdegutisIt's much nicer to have a single line saying (item-list) than a [:table ...] that's 100 lines in itself.
10:05sdegutisamalloy_, justin_smith: are your intermediate namespace names singular or plural when given the choice?
10:06sdegutisLike, in "src/myapp/x/cart.clj", would x be 'modules' or 'module'?
10:19justin_smithsdegutis: only rarely plural, exceptions being things like my.lib.protocols (it defines all the protocols)
10:19sdegutisAh, hmm.
10:19justin_smithor my.app.routers (defines all the routing data)
10:20justin_smithbut if it is named after what it does and not the things it defines, then I avoid plurals
10:23sdegutisjustin_smith: hmm, weird
10:23sdegutisjustin_smith: not your comment, just, this whole situation
10:37sdegutisHi.
10:39visofhi guys
10:39visofi have some image with some specific color region, can i filter the image which has this region?
10:39visofis there a good way to do this in clojure?
10:42ridcullyisn't opencv the goto lib for stuff like this?
10:44visofridcully, maybe i can do something simpler imagez can help in this?
10:44visofi'm going to not do complex image processing
10:44justin_smithvisof: depends is "color of pixel" good enough, or does it have to have any corellation to what a real human would say is a color?
10:45justin_smithbecause color perception (the real kind) is complex and hard
10:45justin_smithvisof: for example humans always infer shading, refraction, color of light source, and still know the "real" color of the thing
10:48sdegutisIs there a way to tell Cider not to ever eval a certain namespace on cider-refresh?
10:49justin_smithsdegutis: if it uses tools.namespace/refresh, that has whitelist/blacklist options iirc
10:55sdegutisNice. I'll do that then.
11:02sdegutisjustin_smith: actually some-> solved it instead
11:02sdegutis(some-> conn d/db)
11:02sdegutisyay
11:02justin_smithinteresting
11:21sdegutis,(. (java.util.Date.) after (java.util.Date.))
11:21clojurebotfalse
11:21sdegutisI like this syntax a lot for Java comparison methods.
11:21sdegutisIt's much more natural than this:
11:21sdegutis,(.after (java.util.Date.) (java.util.Date.))
11:21clojurebotfalse
11:21sdegutisI wish > and < had a similar thing.
11:22sdegutisjustin_smith: for .after it makes way more logical sense
11:22justin_smithSDEGUTIS: YOU KNOW THIS WILL JUST LEAD TO PRECEDENCE RULES THE PAIN WILL NEVER END
11:23sdegutisjustin_smith: your lack of faith is disturbing
11:23sdegutisjustin_smith: you underestimate the power of the infix-side
11:34hamiddo NOT underestimate the power of the dark side of the force!
11:36hamidanyway :D assuming i have a (def myset (set (range 1000000))) ... does a (set myset) have performance bottleneck since "myset" is already a set?
11:36justin_smithsdegutis: rule of least power, prefix is therefore suprior to infix because it is less powerful https://www.w3.org/2001/tag/doc/leastPower.html
11:36justin_smithhamid: no, it's basically a no-op
11:37hamidjustin_smith, awesomeness there it is!
11:37hamidthank you
11:37justin_smithhamid: you can run (source set) in the repl and see for yourself
11:37justin_smith(assuming clojure.repl is in scope, which is the default)
11:37hamidow
11:38hamid,(set? #{})
11:38clojurebottrue
11:38hamidi see
11:38hamid+1
11:38sdegutisjustin_smith: clarity trumps power every time
11:38justin_smithsdegutis: then we agree!
11:38sdegutisjustin_smith: that's why they banned call/cc
11:39justin_smithand it's also why you need a prescription to use macros, and you can only get them in restricted quantity
11:40armlesshobojustin_smith: sounds better than my insurance company's policies on prescriptions lol
11:53sdegutis:)
11:53sdegutisSo many new regular faces here lately.
11:59armlesshobo:)
12:05sdegutis...which means a lot of you have been breaking the first two rules of fight club.
12:07bendavisnchey should i be using function? to test if something is a function? i'm a bit confused because it seems likei it's meant just for unit testing
12:07bendavisncis reflecting if something is a function just a no no in standard clojure code?
12:07bendavisnci feel like i'm definitely missing something
12:08justin_smithbendavisnc: most clojure code is not coded defensively - if someone does something dumb we just let them deal with the consequences
12:08justin_smithbendavisnc: and deciding what to do based on type of an arg is better done with multimethods or protocols rather than boolean checks
12:09hiredman,(doc function?)
12:09clojurebotPardon?
12:09bendavisncok so what i'm trying to do is use the match macro to have a condition based on if it's matching a thing with a function
12:09hiredmanwhy do you think function? exists?
12:09justin_smithpersonally I do like to code defensively at system boundaries - where parts of an app interact - and there I use prismatic schema to describe the expectations
12:10hiredmanthere is fn? and ifn? depending on what you are doing
12:10bendavisnchttps://clojuredocs.org/clojure.test/function_q
12:11bendavisnchmmm i think fn? is what i'm looking for. thanks!
12:11hiredmanyeah, definitely don't use that
12:11hiredman(ever, for anything)
12:11bendavisncthe test/function? you mean @hiredman ?
12:12hiredmanyes
12:12bendavisncyeah, it's not clear to me why that exists and fn? but i'm not sure how much i care if i'm being perfectly honest
12:13justin_smithbendavisnc: if you look at the source for test/function? you'll see that it's just fn? with an added special case for symbols that resolve to a function, and I doubt you want or need the latter
12:13bendavisncah, okay. thanks for that
12:14hiredmanit is not the same as fn?, it is built on fn?, it is used by clojure.test to try and do better reporting of errors for certain kinds of (is ...) assertions
12:18hiredmanI would hesitate before using fn?, or ifn?, or doing any kind of function sniffing, because the line between data and functions in clojure can be blury
12:19hiredmanfn? basically returns true for anything created using (fn ...), and ifn? for anything else that can be invoked like a function
12:20hiredmanif you test with fn? you can't use keywords with functions, if you test with ifn? lots of data also is seen as a function (keywords, maps, sets, symbols)
12:21hiredmanfn? may actually return false for multimethods too, I forget
12:21hiredman,(fn? print-method)
12:21clojurebotfalse
12:22bendavisncyeah i think as long as i'm using fn i'm good
12:23bendavisnc(fn? "howthisfalse")
12:23bendavisnc,(fn? "howthisfalse")
12:23clojurebotfalse
12:24hiredmanit is highly context dependent
12:24hiredman(if it will be ok or not)
12:25hiredmanif you are writting a function that takes a bunch of arguments and using fn? the essential parser apart the different possible options, and the function is some kind of accessor for a value from a datastructure, that means you can't just pass in a keyword
12:26sdegutisGood evening.
12:26sdegutisHow is your current state?
12:33tolstoyUnsynchronized and racey.
12:33justin_smithfailover
12:41hamidin (source swap!), what is this "^clojure.lang.IAtom" all about? "([^clojure.lang.IAtom atom f] (.swap atom f))"
12:41hamidtype checking?!
12:41hiredmantype hint
12:41hamidhiredman, compile time?
12:41hiredmanit isn't checked, but it is a directive to the compiler so it can generate optimal code
12:42hiredmanhttp://clojure.org/reference/java_interop#typehints
12:42hamidthank you ^
12:43hamidnice!
12:44hamidi wish it could type check! except core.typed... is there any form of lisp that type checks?
12:45tolstoyhamid: Maybe this? http://shenlanguage.org
12:45sg2002Hello. I've been playing around with gnu global. There's pygments plugin for it that allows it so parse clojure. Anyone tried this?
12:54hamidtolstoy, hmm weird it is! it has even pattern matching.
12:55tolstoyhamid: Seems to be something you use on another platform base. Scheme, Ruby, Common Lisp certified, JavaScript and Clojure "awaiting".
13:38sg2002Ok, so it seems that pygments is not worth it, but the universal-ctags works pretty fine.
14:01sdegutisHiccup is really well designed, all except the very strange decision to differentiate between vectors and every other kind of data type.
14:02sdegutisIf it's a vector, then it's an element, otherwise if it's sequential?, then it's a collection of things to be examined individually.
14:02sdegutisWhy not rather if it's sequential? then check the first element, and if it's a keyword then the coll is an element, otherwise it's a collection of elements?
14:14hamidI'm trying to learn macros. Would anyone confirm this? https://www.refheap.com/116692 ?
14:15hamidin repl this happens: (macroexpand-1 '(update-state state $ (assoc $ :x 1)))
14:15hamid(clojure.core/swap! user/_state (clojure.core/fn [user/__state] (clojure.core/as-> user/__state user/state (assoc $ :x 1))))
14:16hamidim not sure why the namespace (user/*) is there! in the arugments that i passed
14:17lumabecause you have the symbol '__state inside a syntax-quote, so it is expanded into its fully qualified name user/__state
14:17luma(since your macro is in the user namespace)
14:17hamidluma, would you fix it for me so i can see how it's done?
14:20lumahamid, this is probably what you're trying to do: https://www.refheap.com/116694
14:21lumafirst of all, exprs should be a vararg (variable argument) so that you can pass any number of those
14:22lumathen, syntax-quote (backtick) is used when you return code from a macro. inside the syntax-quote, you can use ~ to unquote parameters, and ~@ to unquote and splice a list from the parameters
14:23lumaand when you want to generate a symbol inside a syntax-quote, put # in the end of it so that a new symbol is generated instead
14:24hamidluma, aawww niceee... thank youuuu :) it's awesome that you folks are here. that # thing is awesome.
14:24hamidnow it's exactly what i intended to generate:
14:24hamid(clojure.core/swap! state (clojure.core/fn [state__8210__auto__] (clojure.core/as-> state__8210__auto__ $ (assoc $ :x 1))))
14:57Borishi. stuck in a little java interop (which I seldomly do). Can anyone help me with translating this one line to clojure?
14:57Borisjava: GPlot plot = new GPlot(this);
14:58BorisI would normally do something like (def plot (new GPlot)), but don't know how to deal with the "this"
14:58Boriscontext is here: https://forum.processing.org/two/discussion/136/grafica-library , trying to use the grafica extension of processing in quil.
15:05justin_smithBoris: a function can use it's own name to refer to itself
15:05justin_smith,(defn me [] me)
15:05clojurebot#'sandbox/me
15:05justin_smith,(= me (me))
15:05clojurebottrue
15:06boris133so I would do (def plot (new Gplot plot))
15:06justin_smithboris133: no, more lik (defn setup [] (Gplot. setup)) - that would be a closer analog (this refers to the function owning the setup method)
15:07justin_smitherr, object owning it, of course
15:07boris133ah, ok. I'll play with it.
15:07justin_smithboris133: but I'm not certain this would work - processing is weird and magic, and so is quil
15:08justin_smithmaybe you would actually want to provide the name of the sketch (first arg to defsketch) instead? I really don't know
15:08boris133ugh. will see. I was just charmed by the plots from grafica - http://jagracar.com/grafica.php
15:08justin_smithhopefully someone else knows quil better than I
15:08boris133wanted to see if I could get that through quil.
15:08boris133*nod*
15:18sdegutisim back
15:18sdegutis,((fn x [] (x)))
15:18clojurebot#error {\n :cause nil\n :via\n [{:type java.lang.StackOverflowError\n :message nil\n :at [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" -1]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval25$x__26 invoke "NO_S...
15:18sdegutishahaha stupid clojure, cant even handle infinite recursion
15:24lokienstupid clojure indeed
15:26lokieneven nobody's advocating it
15:31dysfunmwahahaha, thwarted by the halting problem again
15:46sdegutis,(:i :i)
15:46clojurebotnil
15:46sdegutis,(:i :i :i)
15:46clojurebot:i
15:46sdegutishahahah clojue is funny guy
15:47sdegutisI think clojure is a pretty cool guy. Eh accepts any input and doesn't afraid of anything.
15:50luma,((get get get (get get get get)) {:a 42} :a)
15:50clojurebot42
15:51sdegutisluma: you win
15:51sdegutis/this/ round
15:51sdegutisbut you ahvent won
15:51sdegutisthe .war
15:51luma(i think justin_smith is the one who likes to (get get get get) here)
15:51sdegutis,(get get get get)
15:51clojurebot#object[clojure.core$get 0x1a3f6a10 "clojure.core$get@1a3f6a10"]
15:55justin_smith,(= get (get get get get) ((get get get get) (get get get get) (get get get get) (get get get get)))
15:55clojurebottrue
15:55justin_smithetc.
16:06dysfunyou'd love perl, you know, justin_smith
16:10PunicHey everyone.
16:10lokienhello Punic
16:10justin_smithdysfun: it appeals to my enjoyment of absurdity, but that isn't actually what I want in a programming language
16:11PunicHow is it going guys?
16:12justin_smithpretty good! I just figured out an elegant way to claim ownership of tasks for a distributed pool using zookeeper
16:12justin_smith*from a distributed pool
16:12lokienjustin_smith: absurdity is the best part of programming languages
16:12PunicWell that sounds cool. Altough I didn't understand shit from what you said
16:13lokienPunic: I wanted to do a project, but then I realised plenty of people have done that already
16:14PunicDon't tell me you were after "the next facebook"?
16:15lokienno, I just wanted to scrape some websites to my Kindle :<
16:16lokien(which I don't even own yet)
16:17lokiencan you guys give me some good clojure code to read?
16:17lokienlike, the most beautiful clojure code in your opinion
16:24kenrestivothe clojure source itself, or the cljs source, written by rich?
16:25kenrestivoalso, anything rich has written, like his example code for codeq and datomic
16:27sdegutisI look around, I look around.. I see a lot of new faces.
16:28justin_smithring, and other stuff by weavejester. amalloy writes good code (in particular flatland/useful, a util lib, has some ideas worth emulating)
16:28lokienI'm an old face, come on
16:29sdegutisI've also seen an awful lot of unnecessarily convoluted code by respectable people though.
16:29sdegutisSo that's not always a safe bet.
16:29lokienkenrestivo: clojure source frightened me last time I looked at it, I don't want to do it again
16:29sdegutisAll I can recommend personally is just to write a lot of code and read a lot of code from as many sources as you can, and just compare things based on your own reasoning and experiments and experience.
16:29lokienjustin_smith: thanks, will check
16:30justin_smithsdegutis: (let [years-here (number of years justin_smith has hung out in #clojure) beard-length (length of justin_smith's beard in inches)] (assert (= (/ beard-length years-here) 2)))
16:30lokiensdegutis: I don't have any ideas now, so no code is being written by me. downside of not having a job :(
16:31sdegutislokien: meh, there's nothing wrong with not doing something you have no reason to do; just like how I don't go digging ditches all over my front yard
16:31sdegutislokien: that said, if you want to get a Clojure job, start writing tons and tons and tons of Clojure
16:32justin_smithsdegutis: it works in the other direction too
16:32sdegutisjustin_smith: how so
16:32justin_smithif you want to write tons and tons of Clojure, get a Clojure job
16:32sdegutisjustin_smith: sure, but it doesn't hurt to have some experience
16:33justin_smithlokien: lol
16:33sdegutislokien: actually why not just this?
16:33sdegutis,(take 3 (iterate #(get get %)))
16:33clojurebot#error {\n :cause "Wrong number of args (1) passed to: core/iterate"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/iterate"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval26 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eva...
16:34sdegutis,(take 3 (iterate #(get get %) get))
16:34clojurebot(#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] nil nil)
16:34justin_smithlokien: I only share stupid things like that so you'll be pleasantly surprised when I say something that isn't stupid
16:34sdegutis,(take 5 (iterate #(get get %) get))
16:34clojurebot(#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] nil nil nil nil)
16:34lokienjustin_smith: "How I Became A Professional Developer In Three Weeks Using This One Weird Trick"
16:34sdegutis,(nth (iterate #(get get get %) get) 100)
16:34clojurebot#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"]
16:34sdegutishahaha
16:34justin_smithlokien: programmers hate him!
16:34sdegutis,(= get (nth (iterate #(get get get %) get) 10000000))
16:34clojurebottrue
16:34sdegutisstupid clojure hahaha
16:35sdegutislokien: use iterate, that's an easier way to recurse (get (get (get (get (get ... without doing it manually
16:35hiredmanI think I am pretty happy with https://github.com/hiredman/kvgc/blob/master/src/com/manigfeald/kvgc.clj if I do say so myself
16:35luma,(take 3 (iterate #(% % % %) get))
16:35clojurebot(#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] #object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] #object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"])
16:35sdegutisWAIT I GOT IT!!!
16:37lokienhiredman: tell me your secret of hiredness
16:37hiredmanactually I am looking for work :P
16:37lokien:D
16:37lokienchange your nick then, you mischief
16:38TEttingerit's hire d-man
16:38sdegutishold on
16:38sdegutisits not working
16:39sdegutiswhy not?
16:39sdegutis(apply apply (repeat 4 get))
16:39hiredmanI was hired once, I think they were impressed with my knowledge of clojure internals, which got my foot in the door (this was a few years ago), and then once my foot was in the door, I was willing to tackle anything, so they hung on to me for a while
16:41sobeli hate when that happens
16:41sobeler.. :)
16:42sdegutisi cant figure this out
16:42hiredmanhttps://github.com/liebke/analemma is a neat project, I think it may even has started as a teaching aid
16:42sdegutisjustin_smith: help what am i doing wrong
16:42sdegutisi mean for sure this works (apply get [get get get])
16:42sdegutisbut i cant get it to take [get get get get] and turn it into (get get get get) anyhow
16:42lokienhiredman: that terrifies me a little, I'd like to get a job writing clojure, but it seems so unlikely
16:42sdegutiswhat am i doing wrong #:'(
16:43sdegutisoops that waffle doesnt belong on my head
16:43sobellokien: easiest way to get a job writing clojure is to get a job writing java where they won't complain if you write some in clojure
16:43sobellokien: then you're the local expert, too. that doesn't hurt.
16:43lokiensdegutis: don't try to fool us, we saw everything
16:43hiredmanif you live or are willing to live near one of the tech centers in the us (sf, seattle, chicago, ny) it should be no problem
16:43sdegutisalso why doesnt ((fn [x & y] (apply x y)) (repeat 4 get)) work when it should definitely?
16:44lokiensobel: working with java people? I'm getting goosebumps already
16:44justin_smith,(apply apply ((juxt first rest) (repeat 4 get))) ; sdegutis
16:44lokienhiredman: Poland >:c
16:44clojurebot#object[clojure.core$get 0x32badd00 "clojure.core$get@32badd00"]
16:44hiredmanmy last job was a remote position, and I cannot go back to having a commute
16:44sdegutisYESSSSS
16:44sdegutisjustin_smith: you win
16:44sdegutismy brain is defeated on a friday afternoooooooon
16:45sobellokien: <shrug> i am a data nerd, but i like using clojure when i have to program. i work at a java shop, so clojure is easy to integrate.
16:46sdegutisahhhh i found out why
16:46lokiensobel: I'm an expressive languages nerd, it won't be as easy for me
16:46sdegutis,((fn [[x & y]] (apply x y)) (repeat 4 get))
16:46clojurebot#object[clojure.core$get 0x32badd00 "clojure.core$get@32badd00"]
16:46sdegutishaha
16:47justin_smithsdegutis: but no juxt
16:47sdegutisaww
16:47hiredmanit seems like there is more interest in ClojureScript developers, sort of front end ui focused stuff
16:48hiredmanI see positions where they have a go/python backend and clojurescript frontends
16:48KirchgehammerSay I'm in Java and I have a string with a Clojure form like "(def a 42)", how would I evaluate this by Clojure? Are there static methods I can call for reading and evaluating?
16:48KirchgehammerSurely this must be documented somewhere?
16:48hiredmanKirchgehammer: yes
16:48KirchgehammerDo you know the names of these functions?
16:48hiredmanKirchgehammer: https://clojure.github.io/clojure/javadoc/
16:48justin_smithKirchgehammer: yes, you would want read followed by eval, there's methods in clojure.lang.RT
16:48sdegutishiredman: thats because people suck
16:49lokienhiredman: yups, for someone that loves js ecosystem, but doesn't like its syntax, cjls is a blessing
16:50KirchgehammerObject form = RT.readString("(def a 42)");
16:50Kirchgehammerjustin_smith Can't find the eval function :(
16:51KirchgehammerOh wait, Clojure has an eval function, I just need to grab that via var?
16:52justin_smithKirchgehammer: yeah, I forgot the steps, but yeah, first you need read-string, then eval
16:52KirchgehammerIFn eval = Clojure.var("clojure.core", "eval");
16:52KirchgehammerSomething like that?
16:52justin_smithand the var lookup / invoke might be the trick
16:52justin_smithI think so
16:52justin_smithshould be quick to test out
16:53kenrestivohmm. cider-doc is giving me fits. http://pastebin.com/wk6EpeGp
16:53kenrestivoany ideas?
16:53kennytiltonDoes clojure have a type t like Common Lisp? I want to defmethod on a multi-fn and specialize on only some of the parameters.
16:53kenrestivoall i did is cider-doc at a particular point
16:53justin_smithkenrestivo: you just made me read code in comic sans :(
16:54KirchgehammerObject form = RT.readString("(def a 42)");
16:54KirchgehammerIFn eval = Clojure.var("clojure.core", "eval");
16:54KirchgehammerObject result = eval.invoke(form);
16:54KirchgehammerSystem.out.println(result);
16:54Kirchgehammer#'clojure.core/a
16:54KirchgehammerOMG it works!!!
16:54justin_smithKirchgehammer: awesome
16:54kenrestivoi didn't write that in comic sans
16:55kenrestivoit's a pastebin. isn't refheap closed to new pastes?
16:55justin_smithkenrestivo: just teasing, it's clearly an april fools thing
16:55kenrestivoah! it isn't
16:55kenrestivohttps://www.refheap.com/116704
16:56justin_smithkenrestivo: that looks like buggy elisp to me
16:56kenrestivoit sure is. but... why? where? i'm using the cider from packages
16:57kenrestivo20160401.1308
16:57kennytiltonOh. Object. Duh.
16:58kenrestivothis is actually why i stayed away from cider and used nrepl.el for years. it worked. :/
16:59justin_smithyes, nrepl.el was much more stable
16:59kenrestivo*sigh*
17:01justin_smithkenrestivo: it's like the opposite of the unix tool building philosophy: try to do everything you possibly can in one tool
17:03kwladykaif i added as dependency in project.clj package X and use from there only X.namespace-1 after compile it will include all other namespaces or only which i am using in code?
17:04justin_smithkwladyka: it will load that namespace, and whichever other namespaces that namespace loads
17:04justin_smithkwladyka: require is transitive (otherwise it would be a pain in the ass to use libs)
17:04kenrestivojustin_smith: ok dude, yeah, it's trying to be an ide. and it's broken. but... any idea how to get cider-doc to work?
17:04kenrestivothis is like one of the most basic features
17:05justin_smithkenrestivo: I wish I could be more helpful, I don't even use emacs any more myself
17:05kenrestivo(cider-doc-lookup (make-symbol "while")) gives a stringp error
17:05kwladykajustin_smith sounds good :)
17:05kenrestivoeven though that's not a stringp
17:06justin_smithkenrestivo: you could try the step debugger - elisp is actually really great for interactive debugging
17:07kenrestivoyep, i'm in the debugger. thanks
17:08sdegutisthis sucks
17:08sdegutismy old code sucks
17:09kenrestivooh well, i can just (doc foo) for now
17:09sdegutisim sorry, me, im sorry for putting you in this position
17:10kenrestivoeveryone's old code sucks. that's what old code is.
17:11justin_smithkenrestivo: the sad thing is my good code is the code I never have to look at again
17:11justin_smithkenrestivo: I've written a handful of good namespaces, those are the ones I haven't had to load into an editor in ages...
17:11justin_smithhaha
17:12kenrestivotrue, but i bet if you did, you'd be gripped with an urgent need to refactor it
17:13justin_smithkenrestivo: no, I go back and look at old code just for the sake of looking at it sometimes, and there are a few that are just gems. Or, more likely, I am not wise enough yet to know why they are terrible. But no urge to refactor (unlike most of the code I read, no matter who wrote it)
17:20sdegutisjustin_smith: haha so wise
17:21justin_smithsdegutis: I assure you, I'm a fool
17:21sdegutishaha so modest
17:21dysfunjustin_smith: we all feel that way when we look at our old code
17:22justin_smithsdegutis: there's things off the topic of this room that I'll totally brag about - like I lost 34 pounds in the last 7 weeks
17:22justin_smithsdegutis: but I'm bad at code
17:22dysfunjustin_smith: you should probably stop keeping english money in your pockets then
17:22justin_smithba-dum-tish
17:22sdegutisjustin_smith: that sounds unhealthy
17:22sdegutisjustin_smith: i lost like.. hold on lemme check
17:23justin_smithsdegutis: I looked for professional advice - taking a suppliment every day, keeping to a specific calorie count every day, making sure not to exceed 5 pounds lost a week
17:23sdegutisjustin_smith: like 6-8 lbs in the past few weeks
17:23sdegutisassuming our crappy scale can be trusted, which it cant
17:23justin_smithheh
17:24sdegutisthe trick is to cut down on red bull to only 2-3 per day
17:24lokienjustin_smith: what editor do you use now? I fired up emacs five minutes ago and it was broken, again. I don't want to deal with that anymore
17:24sdegutislokien: justin_smith <3 vim
17:24sdegutislokien: i <3 emacs
17:24sdegutislokien: YOU decide.
17:24justin_smithlokien: I don't know if you'd want to develop like I do, but I use vim and a regular repl in a terminal (I don't use fireplace)
17:25sdegutisjustin_smith: my doc told me i have to start cutting out carbs and sugars and check back in 6 months and i might have to go on a fricken pill to prevent a heart attack if i dont
17:25lokienjustin_smith: any plugins?
17:25justin_smithso I use require :reload for in project stuff, load-file for files in a lib in anotehr project that I have in disk, etc.
17:25sdegutisjustin_smith: so i eat like eggs and mixed veggies and chicken and stuff, and we bought an ellipsis to run on in the living room
17:25justin_smithlokien: just the basic vim-clojure
17:26dysfunyou run on an ellipsis?
17:26justin_smithsdegutis: now I'm imagining you riding a ...
17:26justin_smithvery abstract, but funny
17:26sdegutisdysfun: yeah its easier on my knees
17:26sdegutisjustin_smith: you mean …
17:26dysfuni used to have a manual treadmill which had rollers in the middle, so it was a bit like an ellipsis
17:26sdegutisweird
17:27lokienjustin_smith: o-kay, time to make my 4th vimrc
17:27justin_smithlokien: you don't have to do it my way! there's also monroe in emacs
17:27lokiensdegutis: how's your pinky? mine hurt after few hours, I had to switch to vim bindings
17:28sdegutislokien: its fine as long as i dont wrest my rist on the wdesk
17:28sdegutishaha i jest, no lest
17:28lokienjustin_smith: I just don't want to experience headaches ever again
17:29sdegutisdysfun: we used to have a treadmill desk for coding at at my old job
17:29sdegutisi think thye still have it
17:29sdegutisit was 2hard4me
17:29sdegutisi mean 2hard5me dangit i messed it up
17:29justin_smithlokien: well, if you are ok with :reload and load-file, my experience doing things without editor integration has been decent, but I think I also code slower than other people, so I am OK with going and looking up doc strings instead of seeing them automatically, etc.
17:30dysfunyeah i should make a standing desk arrangement now i work from home all the time
17:30dysfuni've stopped taking public transport in favour of cycling
17:30justin_smithdysfun: same but walking - 4.5 mile walk (though I do occasionally bus too)
17:30justin_smith(9 miles round trip)
17:31justin_smith1.5 hours of understimulation is a nice thing!
17:31dysfuntoo much time out of the day to walk
17:31lokienjustin_smith: my programming is 80% looking at the code, 20% writing it
17:31dysfuni love cycling even though my legs are hurting because i took 18 months off
17:31justin_smithdysfun: that's just because you have a life, and probably loved ones, if you were a loser like me you'd have all the time in the world to go walking
17:31lokienjustin_smith: or even less.
17:31lokienlike 90-10
17:32dysfunjustin_smith: i really don't have a life and i pity anyone daft enough to love me. but between all my code and the shopping and the housework, i still don't have time to walk
17:32sdegutisdysfun: oh man i got one of those
17:33lokiendysfun: I love you!
17:33TEttingermy programming is about 70% writing the code, 25% pacing inefficiently, and 5% going to the bathroom and almost always getting a useful idea in the process
17:33dysfunhaha
17:33TEttingerit's like I'm incapable of passing a block in my code without passing a stool
17:33lokienTEttinger: my idea for a startup - coding toilet desks
17:34tolstoylokien: Hopefully not open plan.
17:34TEttingerhahaha
17:34sdegutishahahaha
17:34justin_smithTEttinger: lokien: 90% confustion, 5% contemplation, 2% writing code, and 25% underestimating the time needed for the task
17:34dysfunjustin_smith: it's actually 460% underestimating the time needed for the task
17:34TEttingerconfustius say...
17:34lokienjustin_smith: 120% configuring my text editor
17:35justin_smithdysfun: oh man...
17:35sdegutishttps://www.dropbox.com/s/h6kol44npg7n51d/workspace.JPG?dl=0
17:35sdegutisdysfun: its that
17:35dysfuni've taken to just letting my mind wander in useful directions and not worrying too hard about when it actually solidifies into code
17:35sdegutisim standing in that very spot as we speak
17:36dysfunnice desk
17:36sdegutismy dad made the middle shelf and put it on here
17:36sdegutisthanks
17:36dysfunthe only redeeming thing about my desk is the aeron in front ofi t
17:36lokiensdegutis: nice drawings
17:36TEttingerindeed
17:36sdegutishaha that was my wife
17:37sdegutisone of them is sign language
17:37sdegutisthe other is a <3
17:37dysfuni thought she was just sticking two fingers up at the person holding a shield?
17:37sdegutishaha no thats sign language
17:37scottjsdegutis: I think either your keyboard is too high or your monitor is too low
17:37TEttinger3
17:37scottjor your legs are too long
17:37lokiensdegutis: "Children don't obey"
17:37sdegutisscottj: my monitor may be too low acrually
17:38dysfunyour eyes should be level with the top of your monitor
17:38lokiensdegutis: sadly I can't read anything else
17:38sdegutisand you assume you got that one correct
17:42sdegutisscottj: now that i look at it, when i stand up str8, my eyes go directly above the top of the monitor
17:42sdegutislike evenly flat
17:42sdegutisim sasying it all wrong, but i hope i make sense
17:43tolstoyYeah. Where should your eyes fall when you slouch?
17:43Kirchgehammerjustin_smith: http://i.imgur.com/qh4dTrZ.png
17:43justin_smithspeaking of legs being too long, I totally want to make a data coersion library called Procrustes https://en.wikipedia.org/wiki/Procrustes
17:43KirchgehammerJust finished the first working prototype ;)
17:44justin_smithKirchgehammer: nice!
17:45justin_smithfirst task, coerce the string "coersion" to become "coercion"
17:45sdegutislol clopad
17:45sdegutishard to believe thats a monospace font too
17:45justin_smithsdegutis: I think we should be nice here - he just went and made a thing over the course of an hour or two
17:46sdegutisjustin_smith: he made that? then whats the one im thinking of?
17:46justin_smithsdegutis: no idea! he was asking how to call clojure to evaluate strings, and came back with that java app
17:46sdegutisKirchgehammer: nice app. what do you think of changing the font to menlo?
17:47KirchgehammerIs that the official Clojure font or something?
17:47KirchgehammerMy editor uses a bitmap font :)
17:47sdegutisjustin_smith: im definitely thinnking of a different one
17:47sdegutisKirchgehammer: no i just like menlo
17:47Kirchgehammernever heard of menlo
17:47sdegutisyou may like it who knows
17:48Kirchgehammermaybe
17:48sdegutisOh!
17:48sdegutisClooj
17:48sdegutisi was thinking of Clooj
17:48tolstoyThere's also night-something.
17:48sdegutisyeah nightcode but thats active
17:48sdegutisclooj was last touched late 2013 early 2014
17:49tolstoynightcode.info: nothing! Hm.
17:49sdegutisi like the idea of a clojure ide written in clojure
17:49sdegutisa lot.
17:49sdegutisi just dont like the idea of it using a java ide
17:49sdegutisor clojurescript + web
17:49justin_smithsdegutis: Procrustes was "a rogue smith and bandit from Attica who physically attacked people by stretching them or cutting off their legs"
17:50sdegutisjustin_smith: let me guess 'justin' is an alias
17:50sdegutisjustin_smith: or should i say PROCRUSTES
17:50sdegutisjustin_smith: but srsly im way too unconcentratd to know why you brought that up
17:50justin_smithsdegutis: you're just jealous because there's never been a rogue degutis
17:50sdegutishahahaha
17:50sdegutisactually we looked it up
17:51sdegutisdegutis is based on the lithuanian name for tar worker
17:51sdegutisso my ancestors basically made pitch for boats or something
17:51justin_smithsdegutis: the above conversation, someone said "or your legs are too long", which reminded me someone needs to make a coercion library named Procrustes
17:51sdegutis:'(
17:51sdegutisoh right
17:52lokienmy last name is a vim plugin manager /:
17:52sdegutisit would go along with the technomancy-esque naming scheme thats all the rage these days
17:54TEttingersdegutis: and a degu is a cute little squirrel type thing
17:54TEttingerhttp://homeanimals.co.uk/images/degu.jpg
17:55justin_smithTEttinger: that's what I assume sdegutis looks like, tbh
17:55lokien_That squinting one?
17:57sdegutiscorrect.
17:57TEttingertommy ettinger is an anagram for gritty teen mom
17:58TEttingerjustin smith is not very anagrammy
17:58justin_smithno, not really
17:59sdegutisOkay so my wife called and asked what I want for dinner, with the stipulation that she's not gonna make anything, but she's at the store and can buy whatever.
17:59TEttingersteven degutis is an anagram for Nudest Vestige
17:59sdegutisBut I can't think of what would be a great dinner tonight.
17:59Glenjaminthin jit sums
17:59sdegutisSomething that's easy to buy and not hard to make.
17:59justin_smithGlenjamin: nice
17:59tolstoyMexican food!
17:59sdegutisyeah but what kind?
18:00sdegutisi mean, i was gonna say nachos
18:00Glenjaminartithmetic in a hot loop :D
18:00TEttingeralso, devise gun test
18:00sdegutishmm
18:00sdegutiswtf TEttinger lol
18:00sdegutisso many inappropriate anagrams of my name
18:00TEttingerhttp://wordsmith.org/anagram/anagram.cgi?anagram=steven+degutis&amp;language=english&amp;t=1000&amp;d=&amp;include=&amp;exclude=&amp;n=&amp;m=&amp;source=adv&amp;a=n&amp;l=n&amp;q=n&amp;k=1
18:00sdegutisi half expect the next one to include like murder or something
18:00tolstoyGround beef, spices, green onions, tomato, hot sauce, tortilla, done.
18:00sdegutistolstoy: but thats a lot of work to chop up the things
18:01srrubyyum
18:01sdegutishmm
18:01justin_smithhas anyone made a statistical model based taco bell food generator yet?
18:01tolstoyNot longer than it takes the meat to cook. And if you want cheese, you can get that pre-grated. ;)
18:01justin_smithyou probably wouldn't even need a markov model, I but just a random percentage of including each ingredient on the list would suffice
18:02tolstoyYeah, seems to me that the difference between one dish and another is the style of the tortilla.
18:02sdegutistolstoy: then its settled
18:03srrubyQuestion about unit testing. When I do lein new app foo, I get a test file in test/foo/core_test.clj Should I follow this approach in unit testing other clj files ?
18:03tolstoyHeh. Add some re-fried beans, if that's your thing, too. I like black-bean best.
18:04TEttingerjustin_smith: have you had a quesalupa, or whatever the chalupa with a quesadilla shell is?
18:04srrubycook the beef separately and drain off the fat unless you like the fat....
18:04sdegutisaw heck yeah, shes gonna make sweet & spicy chicken wraps
18:04tolstoyStrainer!
18:05sdegutisturns out jewel sells precooked and precut up chicken
18:05sdegutisyay
18:05sdegutisso btw, guys, this is slightly more on topic:
18:05sdegutisturns out, music with no lyrics or singing in it, just instruments, is really good to listen to while programming
18:06tolstoyClassical all the way.
18:06sdegutissuch as https://www.amazon.com/gp/product/B00P1AYVBS (preview the things)
18:06lokien_I can't focus listening to piano, I just keep listening to the piano for ten minutes instead of coding and get distracted
18:06tolstoyI had to grow into listening to stuff while working due to Open Plan / Cubicle life.
18:06justin_smith,(defn taco-bell-recipe [] (concat (take (rand-int 4) (shuffle ["flour tortilla" "corn tortilla" "chips" "gordita" "rice"])) (take (rand-int 10) (shuffle ["onions" "beans" "cheese" "beef" "chicken" "lettuce" "tomatoes" "enchilada sauce" "sour cream" "guacamole" "nacho cheese"]))))
18:06clojurebot#'sandbox/taco-bell-recipe
18:06sdegutisok so thats the setup (its also true btw).
18:06justin_smith,(taco-bell-recipe)
18:06clojurebot("corn tortilla" "rice" "sour cream" "guacamole" "cheese" ...)
18:06sdegutisnow heres the joke
18:07justin_smithsdegutis: your dinner^
18:07sdegutissuch as Bon Iver also
18:07tolstoySeparate the data (ingredients) from the functions (particular dish)?
18:07sdegutisi mean,
18:07sdegutis"also, anything by Bon Iver"
18:07sdegutishaha!
18:07tolstoySigur Ros is nice.
18:08sdegutisjustin_smith: hmm could use more thread-last
18:08justin_smith,defn taco-bell-recipe [] (clojure.string/join ", " (concat (take (rand-int 4) (shuffle ["flour tortilla" "corn tortilla" "chips" "gordita" "rice"])) (take (rand-int 10) (shuffle ["onions" "beans" "cheese" "beef" "chicken" "lettuce" "tomatoes" "enchilada sauce" "sour cream" "guacamole" "nacho cheese"])))))
18:08clojurebot#error {\n :cause "Can't take value of a macro: #'clojure.core/defn"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defn, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Can't take value of a macro: #'clojur...
18:08justin_smith,(defn taco-bell-recipe [] (clojure.string/join ", " (concat (take (rand-int 4) (shuffle ["flour tortilla" "corn tortilla" "chips" "gordita" "rice"])) (take (rand-int 10) (shuffle ["onions" "beans" "cheese" "beef" "chicken" "lettuce" "tomatoes" "enchilada sauce" "sour cream" "guacamole" "nacho cheese"])))))
18:08clojurebot#'sandbox/taco-bell-recipe
18:09justin_smith,(taco-bell-recipe)
18:09clojurebot"rice, sour cream, guacamole, tomatoes, lettuce, enchilada sauce"
18:09justin_smithsdegutis: yeah, thread-last would make that more readable
18:09scottj"Mexican Rice Bowls"
18:09scottj,(taco-bell-recipe)
18:09clojurebot"corn tortilla, tomatoes, beef, sour cream, cheese"
18:10scottj"Beef Taco"
18:10sdegutisanyway so mainly i just wanted to make that joke about how Bon Iver sounds like theres no lyrics
18:10Glenjaminplease turn that into a 4clojure question somehow
18:10justin_smithGlenjamin: oh man
18:10sdegutisbut also you should check out that FFVII Melancholy Tribute album its actually great for programmin to
18:10TEttingerI haven't found the no-lyrics music to be always a better option. last night I programmed a pretty sizable chunk of complex permutation-based java code while listening to https://www.youtube.com/watch?v=635qfYt8eyg
18:11tolstoysdegutis I'm one of those people that almost never hears the lyrics as language.
18:11sdegutistolstoy: you are so lucky
18:12tolstoyYeah. People say they love this or that song, and I can't figure it. Turns out, they're talking about lyrics, and I'm talking about the music itself.
18:12sdegutisTEttinger: hmm, [retracted inappropriate joke]
18:12sdegutistolstoy: oh yeah for sure, i half know what u mean
18:13tolstoyThus, hip-hop is kinda just a bunch of men yelling at me.
18:13lokien_tolstoy: even in your native language?
18:14tolstoylokien_ Yep. It's not that I don't understand the words, it's that I don't put them together in a meaninful way, unless I really try.
18:15sdegutistolstoy: i dunno this is pretty good https://www.youtube.com/watch?v=6mTtAh-KYW0
18:15sdegutisgot kind of an epic feel, which is appropriate give nthe story it tells
18:15tolstoyI like, say, Cocteau Twins or Sigur Ros just fine, even though there's basically just voice-as-instrument.
18:15lokien_tolstoy: teach me your ways, sensei
18:15tolstoyHeh. ;) It's just genetic, or something.
18:16justin_smith,(defn taco-bell-recipe [] (->> (concat (->> ["flour tortilla" "corn tortilla" "chips" "gordita" "rice"] shuffle (take (rand-int 4))) (->> ["onions" "beans" "cheese" "beef" "chicken" "lettuce" "tomatoes" "enchilada sauce" "sour cream" "guacamole" "nacho cheese"] shuffle (take (rand-int 10)))) (clojure.string/join ", ")))
18:16clojurebot#'sandbox/taco-bell-recipe
18:16sdegutis"when he hit the scene, he commanded respect; he'd needed something done, and every hand hit the deck; took the first shot, and nobody fired back"
18:16justin_smithsdegutis: ^ fixed for you
18:16tolstoyToo distracted by the actual music? Grew up (to 13) in a house with only Classical?
18:16justin_smith,(taco-bell-recipe)
18:16clojurebot"corn tortilla, flour tortilla, rice, chicken, enchilada sauce, beans"
18:16sdegutisjustin_smith: whoa too much thread-z now
18:16sdegutisjustin_smith: that code brings tears to my eyes
18:17justin_smith,(taco-bell-recipe)
18:17clojurebot#error {\n :cause "Unable to resolve symbol: taco-bell-recipe in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: taco-bell-recipe in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve...
18:17sdegutisHAHHAHA
18:17justin_smith,(defn taco-bell-recipe [] (->> (concat (->> ["flour tortilla" "corn tortilla" "chips" "gordita" "rice"] shuffle (take (rand-int 4))) (->> ["onions" "beans" "cheese" "beef" "chicken" "lettuce" "tomatoes" "enchilada sauce" "sour cream" "guacamole" "nacho cheese"] shuffle (take (rand-int 10)))) (clojure.string/join ", ")))
18:17clojurebot#'sandbox/taco-bell-recipe
18:17justin_smith,(taco-bell-recipe)
18:17clojurebot"gordita, corn tortilla, chips, guacamole, enchilada sauce, sour cream, lettuce, beans, beef, chicken, cheese, tomatoes"
18:17lokien_tolstoy: I need to buy a piano
18:18tolstoyjustin_smith: I think you're on to something. Start a .io domain and call y-combinator.
18:18sdegutislokien_: also oxygen, dont forget oxygen
18:18sdegutistolstoy: LOL man you guys are on a roll
18:19justin_smithtolstoy: for our C round funding we will expand to also cover Italian and Chinese foods
18:19lokien_sdegutis: I'm a lucky man, oxygen is free in my country
18:20sdegutis:D
18:20tolstoymexican.menu.io
18:20tolstoychinese.menu.io
18:20justin_smithtolstoy: and the best one, stoner.menu.io - which randomly pulls ingredients from all the others
18:20tolstoyBy these 5 basic ingredients, never worry again.
18:20tolstoyHeh.
18:21lokien_justin_smith: don't forget 30$/mo pro subscription
18:21tolstoyClick this button, it creates the meal, messages the store, queries your inventory, phones your partner.
18:21sdegutisjustin_smith: stoner is basically just clojure.core/random-sample
18:22tolstoyIn fact, here's a little device with just a button on it. Pair it via bluetooth, then just push the button and wait.
18:22sdegutis,(random-sample 0.5 (range 10))
18:22clojurebot(2 3 4 8 9)
18:22sdegutishahah nice
18:22sdegutisi never knew about this fn til 2day
18:22tolstoystoner.menu.io: Blends whatever's left over, cooks, desiccates: cheesy puffs.
18:24justin_smith,(apply str (random-sample 0.1 (slurp "http://history.eserver.org/gettysburg-address.txt&quot;)))
18:24clojurebot#error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkRead nil -1]\n [java.io.FileInputStream <init> "FileInp...
18:24justin_smith:P
18:25justin_smithanyway, that returned "T\rooa ileta \ree nacntdddcretoa toaet o\raills-afreeti.tt\rhlcn nrio lhgr te\r d Torwtl efereihted oc. tbdcaetarmh drntsers d-t sao l ronpeeopolrrhe--ableee- iter NPo)ryd,e svpr itig e nuto"
18:25amalloyoh, random-sample is a new one
18:25sdegutisamalloy: for sure, looks way handy
18:27justin_smith,(:added (meta #'random-sample))
18:28clojurebot"1.7"
18:28sdegutisyeah for sure, 1.7
18:29sdegutisjustin_smith, amalloy: the implementation is amazing too
18:29sdegutisdont look at it, take a guess how it works
18:29justin_smithhaha, too late
18:30sdegutissorry
18:32hiredmanI know
18:33hiredmanrandom-sample is such an exciting addition
18:33TEttinger,(random-sample 1/7 (range 10))
18:33clojurebot(2 7)
18:35sdegutishaha so close
18:36TEttinger,(random-sample Math/PI (range 10))
18:36clojurebot(0 1 2 3 4 ...)
18:36TEttinger,(random-sample (/ 1 Math/PI) (range 10))
18:36clojurebot(0 6 7 9)
18:36TEttingerit's hilarious that we have random-sample but not any way to seed the RNG
18:36TEttingerseems kinda handy for tests!
18:39sdegutisI HAVE AN IDEA
18:39justin_smithsdegutis: did you just invent test.generative?
18:42srrubyI'm porting some code that doesn't loop through a sequence. I'm looking at using take-while and iterate or using for :while
18:43srrubyDoes it makes sense to use (for if you aren't going through a collection ?
18:43justin_smithsrruby: well, it has to be a seq of some sort before for can use it
18:43justin_smithwhat is the source of data
18:44amalloywhat a philosophical question
18:45srrubyI'm doing some number crunching and repeatedly . Source is a single number that I'm factoring
18:45sdegutis,(let [n 1/7] (->> #(random-sample n (range 10)) (repeatedly) (map-indexed list) (filter (fn [[index item]] (and (> (count item) 1) (not (zero? (last item))) (= n (apply / item))))) (ffirst)))
18:45clojurebot4
18:45sdegutispretty printed version https://gist.github.com/sdegutis/8b7e1c066645b288781d1921cce5a3e6
18:45sdegutis,(let [n 1/7] (->> #(random-sample n (range 10)) (repeatedly) (map-indexed list) (filter (fn [[index item]] (and (> (count item) 1) (not (zero? (last item))) (= n (apply / item))))) (ffirst)))
18:45clojurebot23
18:45sdegutis,(let [n 5/7] (->> #(random-sample n (range 10)) (repeatedly) (map-indexed list) (filter (fn [[index item]] (and (> (count item) 1) (not (zero? (last item))) (= n (apply / item))))) (ffirst)))
18:45amalloywhat makes you think the result of repeatedly is not a sequence, srruby?
18:45clojurebot30859
18:45sdegutisWHOA
18:46TEttingersrruby: do you mean something like iterate ?
18:46srrubyamalloy: Sorry for being unclear. I'm not using repeatedly.
18:47srrubyamalloy: Thanks everyone, I guess I'll either use iterate or for. I'm porting a while loop.
18:48justin_smithsrruby: are you trying to generate a collection or are you doing this for side effects?
18:48justin_smithif you aren't doing this in order to generate a collection, don't use for, if you don't need the return value, use doseq, if you need some other kind of result use reduce
18:48srrubyjustin_smith: Thanks everyone!
18:48sdegutisso, to be clear:
18:48kwladykahttps://github.com/pelle/clauth or https://github.com/ddellacosta/friend-oauth2 or something else?
18:49sdegutisit took 30860 tries before (random-sample 5/7 [0 1 2 3 4 5 6 7 8 9]) returned [5 7]
18:51sdegutis,(defn times-to-get-to-fraction [n x] (->> #(random-sample n (range x)) (repeatedly) (map-indexed list) (filter (fn [[index item]] (and (> (count item) 1) (not (zero? (last item))) (= n (apply / item))))) (ffirst)))
18:51clojurebot#'sandbox/times-to-get-to-fraction
18:51sdegutis,(times-to-get-to-fraction 1/7 10)
18:51clojurebot111
18:51sdegutis,(times-to-get-to-fraction 1/7 100)
18:52sdegutistoo mcuh broke bot
18:52amalloy.(apply * 5/7 5/7 (repeat 8 2/7) 1.0)
18:52clojurebotExecution Timed Out
18:52amalloy,(apply * 5/7 5/7 (repeat 8 2/7) 1.0)
18:52clojurebot#error {\n :cause "Don't know how to create ISeq from: java.lang.Double"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Double"\n :at [clojure.lang.RT seqFrom "RT.java" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.lang.RT cons "RT.java" 662]\n [clojure.core$cons__433...
18:52sdegutisamalloy: lol ur drunk thats a period
18:52amalloy,(apply * 1.0 5/7 5/7 (repeat 8 2/7))
18:52clojurebot2.2656852317705177E-5
18:52amalloy1/50000
18:52amalloyish
18:54sdegutisamalloy: you work for cognitect right?
18:56sdegutisbbl she made delicious taco wrap things with chicken meat
18:56sdegutisi dunno or care what its called its good
18:59TEttingermmm factoradic numbering is my favorite
19:05tolstoyCan you get openjdk 8 on the Mac these days?
19:10TEttingertolstoy: yeah, Zulu
19:10TEttingerit's actually a really nice build
19:10tolstoyWhat's that?
19:11tolstoyH. This? https://hub.docker.com/r/azul/zulu-openjdk/
19:12tolstoyAh: http://www.azul.com/downloads/zulu/zulu-mac/
19:13sdegutistolstoy: did you get your openjdk8 q answered
19:13sdegutisi have oracle java sdk 8 installed and its such a pita
19:13tolstoyI think so.
19:13sdegutisit pops up every few days telilng me to upgrade my java and im like shut up
19:13tolstoyAh, the java browser plugin thing.
19:13sdegutissimilar to https://img.buzzfeed.com/buzzfeed-static/static/2016-01/20/11/enhanced/webdr15/enhanced-14111-1453306596-2.png but not 100%
19:16tolstoysdegutis Every use /usr/libexec/java_home?
19:17tolstoyWith -V?
19:17tolstoyHm. If you add -v 1.8, it'll find the most recent (this zulu thing for me).
19:18tolstoyAND, it has startcom certs. ;)
19:18sdegutistolstoy: i never touch java via cmdline
19:18sdegutistolstoy: my only interaction with java is either via clojure or via some .pkg file
19:19sdegutisthat said, i enjoy using java 1.8 apis like LocalDateTime (sooo nice)
19:19tolstoysdegutis It's possible to have multiple versions on OSX, so that util can be used to set JAVA_HOME to the right one.
19:19sdegutiscool
19:20tolstoyIt never comes up if you just use the latest oracle one.
19:24noethicsare there any decent libraries for bytecode engineering
19:24noethicsspecifically for clojure
19:25tolstoynoethics: Probably not what you were thinking of, but https://github.com/clojure/tools.emitter.jvm. ;)
19:26TEttingerdoesn't one of ztellman's libs do that? gloss?
19:26sdegutisyeah i was gonna say, if anyone did it its ztellman
19:26tolstoyThat's for working with bytes, but noethics said bytecode.
19:26noethicsjvm bytecode
19:26hiredmanI've only ever used asm (the library the clojure compiler uses) to generate bytecode
19:26noethicsthis is interesting but not useful to me :P
19:27noethicsyeah i would prefer some clojure wrapper for asm
19:27tolstoyYeah.
19:28hiredmanhttps://github.com/hiredman/bc/blob/master/src/bc/core.clj is a badly written classfile parser written in clojure
19:28noethicslol
19:28hiredmanalong with some completely nonsensical ruby code generting stuff
19:29hiredman(I think I wanted to translate some bytecode into ruby for reasons)
19:29noethicsi feel liek there could be some really nice wrapper for asm in clojure
19:29hiredmanI dunno, I have't found asm to be very terrible to use directly
19:29noethicsit's pretty terrible to use by itself ime :P
19:32kwladykaI am looking the best OAuth 2 solution for Clojure. I found some solutions, but i am not sure about functionality. I need connect as a client to authorisation-app, and later with the same client to another app with token to get some resources.
19:32kwladykaCan you share some experience about OAuth 2 in Clojure?
19:34kwladyka(i need to client both sided, client and server authorisation, also app to get resources)
19:39kwladykammm time to sleep, i will think about that tomorrow :)
19:40sdegutisbbl
19:48hiredmanI seem to recall someone doing their own port of the clojure compiler a few years back, and they wrote their own assembler for it
19:53hiredmansomeone already mentioned tools.emitter.jvm, which a data based syntax like https://github.com/clojure/tools.emitter.jvm/blob/master/src/main/clojure/clojure/tools/emitter/jvm/emit.clj#L400-L426 and then has code to use that to drive asm
20:00noethicsi need to do some analysis too
20:01noethicsnot just write instructions :P
20:03noethicsbut i think there could be some nice clojure way of making my own ast with just asm
20:04noethicsi can only thing of doing that with lists of classnodes though. visitor pattern would be best i assume?
22:01sdegutisI think a function like if-let with multiple sequentially bound bindings like let would be useful.
22:02sdegutisIt would be kind of like some->
22:02sdegutisIn the sense that it would continue as long as none of the bindings were nil, but short-circuiting.
22:02sdegutissome-let
22:03sdegutisThis may be the first and only general-purpose macro that I'm actually considering implementing for myself if clojure.core doesn't end up with it.
22:06sdegutisI'm going to assume that justin_smith's going to say that amalloy_ has already implemented this in flatland/useful.
22:13Lewiswhat makes code data? this concept is still abstract to me
22:15sdegutisLewis: watch
22:16hiredman,(type (read-string "(def x 1)"))
22:16sdegutis,'(+ 1 2)
22:16clojurebotclojure.lang.PersistentList
22:16clojurebot(+ 1 2)
22:16sdegutis,(first '(+ 1 2))
22:16clojurebot+
22:16sdegutis,(second '(+ 1 2))
22:16clojurebot1
22:16sdegutis,(type (first '(+ 1 2)))
22:16clojurebotclojure.lang.Symbol
22:16sdegutis,((juxt identity type) (first '(+ 1 2)))
22:16clojurebot[+ clojure.lang.Symbol]
22:16Lewisso what makes it data?
22:16sdegutisAnyway, it's done. Here:
22:16Lewisas opposed to what
22:17sdegutisLewis: try representing Ruby code as Ruby data
22:17sdegutis,(defmacro some-let [bindings body] (let [[x y & rest] bindings] `(if-let [~x ~y] ~(if (empty? rest) body `(some-let ~(vec rest) ~body)))))
22:17clojurebot#'sandbox/some-let
22:17sdegutis,(some-let [a 1, b (do (prn :a a) (inc a)), c (do (prn :b b) (inc b))] :bla)
22:17clojurebot:a 1\n:b 2\n:bla
22:17Lewissdegutis: simple example please. I'm picked up clojure today again after a long hiatus
22:18sdegutis,(some-let [a 1, b (do (prn :a a) nil), c (do (prn :b b) (inc b))] :bla)
22:18clojurebot:a 1\n
22:18Lewiss/example/examples*
22:18sdegutisSweet, it works!!!
22:18Lewiscan you just say in words what make it data
22:18sdegutisLewis: Sorry, my some-let macro wasn't an example intended for you. This is though:
22:19sdegutisLewis: watch how reverse works:
22:19sdegutis,(reverse [1 2 3])
22:19clojurebot(3 2 1)
22:19sdegutisLewis: With me so far?
22:19Lewisok?
22:19Lewisi am
22:19sdegutisLewis: now is it clear to you how this function call works?
22:19Lewisyou reversed a vector
22:19sdegutis,(+ 1 2 3)
22:19clojurebot6
22:20Lewisyou summed up a list
22:20sdegutisLewis: so what happens if I do this?
22:20sdegutis(3 2 1 +)
22:20Lewiserror
22:20sdegutisLewis: what will that last form evaluate to?
22:20sdegutisAnd why?
22:20Lewisbecause the first operator should be a function
22:20sdegutisRight. But if it were reversed, it would be fine, right?
22:20Lewisfirst argument*
22:21Lewisyes
22:21sdegutisLewis: Now what do you think this is?
22:21sdegutis,(quote (+ 1 2 3))
22:21clojurebot(+ 1 2 3)
22:21hiredmanthe clojure code (let [x 1] 1) is a list first the symbol let as its first element, say in javascript the code might be var x = 1; return 1, what data structure is that code? it isn't one
22:21sdegutishiredman: shut up im having fun here
22:21sdegutisLewis: no need to guess, watch:
22:21sdegutis,(type (quote (+ 1 2 3)))
22:21clojurebotclojure.lang.PersistentList
22:21sdegutis,(map type (quote (+ 1 2 3)))
22:21clojurebot(clojure.lang.Symbol java.lang.Long java.lang.Long java.lang.Long)
22:22hiredmanocaml let x = 1 in 1, what data structure is that code?
22:22sdegutisIt's a List of a Symbol followed by 3 Longs.
22:22sdegutisLewis: with me so far?
22:22hiredmanclojure code is made up of datastructure literals, and only datastructure literals
22:22sdegutisLewis: now watch this
22:22sdegutis,(defmacro postfox [form] (reverse form))
22:22clojurebot#'sandbox/postfox
22:22sdegutis,(postfox (3 2 1 +))
22:22clojurebot6
22:23sdegutisLewis: see?
22:23Lewistchip
22:23Lewisdude
22:23sdegutisHm?
22:23Lewisjust tell me with words
22:23hiredmanthe syntax of clojure is the syntax of a datastructure notation, like json (but richer)
22:23sdegutisLewis: I just told you in a way more clear way than words.
22:23sdegutisLewis: Just like drawing a circle is a way better way of demonstrating what a circle is than trying to explain it.
22:23Lewisi clearly dont see the point , i realized that my issue might be with the definition of data
22:24sdegutisLewis: did you see how that macro just now worked?
22:24Lewiswhy code is data? can't you put it in words ?
22:24LewisI dont understand macro yet
22:24sdegutisLewis: Because Clojure expressions are homoiconic.
22:24hiredmancode is data because the code is written in datastructure literals (list literals, vector literals, symbols, etc)
22:25Lewishiredman: ok, let me ask it another way, why is that a language like ruby code is not data
22:25Lewisor javascript
22:25sdegutisLewis: the fact that code is data is only applicable in macros
22:25sdegutishiredman: I give up, have fun with this.
22:25hiredmanlewis: they have syntax that is not a datastructure
22:26sdegutis,(some-let [a 1 b nil c 2] a)
22:26clojurebotnil
22:26sdegutis,(some-let [a 1 b 3 c 2] a)
22:26clojurebot1
22:26sdegutisWoo!!
22:26sdegutis,(some-let [a 1, b nil, c (prn :c)] a)
22:26clojurebot#error {\n :cause "Unable to resolve symbol: some-let in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: some-let in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: some-le...
22:26sdegutisAww.
22:26sdegutis,(defmacro some-let [bindings body] (let [[x y & rest] bindings] `(if-let [~x ~y] ~(if (empty? rest) body `(some-let ~(vec rest) ~body)))))
22:26clojurebot#'sandbox/some-let
22:26hiredmanfor example, what datastructure is var x = 1? the equivilant clojure expression is represented as a list and a vector and a symbol and a number (let [x 1])
22:26sdegutis,(some-let [a 1, b nil, c (prn :c)] a)
22:26clojurebotnil
22:26sdegutisWOO!!
22:26sdegutis,(some-let [a 1, b 2, c (prn :c)] a)
22:26clojurebot:c\n
22:27sdegutisExciting times.
22:27sdegutishiredman: what do you think of this macro?
22:27sdegutissome-let
22:27hiredmanfor javascript to have code as data, you would have to get rid of all the javascript syntax that is not json, and figure out how to represent that syntax in json
22:28Lewishiredman: thank you i got it
22:29Lewisso the fact that code is data just mean that the source code is data structure on top of data structures. list of lists of symbols
22:30hiredmanyou can say just, but it makes different kinds of meta programming much nicer
22:31hiredmanbecause the same tools you use to manipulate data (maps, sets, vectors, lists) can be used to manipulate code
22:31Lewisright
22:31Lewiswhich make sense
22:31Lewisthanks i got it. i personally think that a word explanation speak louder than code in this instance (nto always the case)
22:31Lewisnot*
22:44sdegutisI just aid that.
22:44sdegutis*said
22:44sdegutisMan never mind, that's the last time I try to help.
23:13sdegutisHi.
23:27troydmis it possible to traverse transient sequence? and destructure it?
23:34troydmor rather is there any efficient way going over sequence and modifiying elements of it recursively but with a way to stop at any given point with all previous modifications intact
23:34troydmsomething like a map but with a way to bailout
23:35troydmor actually not map since I want to process atleast 6 elements per each iteration
23:35troydmI'm thinking of doing destructuring and then doing into
23:36troydm(into [a b c d e] rst) or something like that
23:36troydmbut I don't know if it's effiecient or not