#clojure log - Apr 01 2016

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

8:57 j-pb: Hey 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? :/

9:39 sdegutis: Hmm, I did not anticipate this.

9:40 Good morning, you /people/.

9:42 prohobo: dont "you people" me

9:42 you racist

9:43 sdegutis: Well if you weren't sitting there, acting all human and everything...

9:43 So this is the thing.

9:44 I came up with (defprotocol WebFeature (routes[this]) (css[this]) (schema[this])) which is cool cuz that's all my app is made of.

9:44 But I didn't anticipate that the Cart web-feature's (css) method is like 91 lines long.

9:44 And the (routes) is around like 350 lines long.

9:45 So that got pretty ugly pretty quick.

9:45 Most of it is the single Hiccup-returning function though, which is like 200 lines by itself.

9:49 prohobo: are you asking for help restructuring your code?

9:50 sdegutis: I'm just pondering out loud.

9:51 I guess, all in all, having a fully-featured website Cart in only 550 lines of code is pretty reasonable.

9:51 It just gives me pause that it's all in one giant-seeming file.

9:51 And most of it is inside a single defrecord.

9:52 ToxicFrog: Yank 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.

9:53 sdegutis: ToxicFrog: Oh, you just reminded me of Modules! Such a better name than Feature. Thanks, I'll use that.

9:53 I never liked the name of (defprotocol Feature (routes[this]) (css[this]) (schema[this])) in the web namespace.

9:54 Feature always seemed too, um, weird.

9:54 Module makes much more sense here.

9:55 ToxicFrog: 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.

9:55 ToxicFrog: What's the 200 lines of hiccup doing in the routes, then?

9:55 sdegutis: ToxicFrog: I felt that this separation was a bit excessive and cumbersome, and too often inconvenient.

9:56 ToxicFrog: 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.

9:56 ToxicFrog: 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.

9:57 ToxicFrog: sdegutis: 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.

9:57 Something that large in the middle of routes is going to require a context switch to read it anyways.

9:57 sdegutis: Although, I could probably make the Cart and Order model data structures match, and then combine their view-component functions.

9:58 mgaare: schema is, what, db schema?

9:58 sdegutis: ToxicFrog: there's very little context switch in Clojure, that's the beauty

9:58 mgaare: a custom data-based layer describing Datomic install-attribute transactions

9:58 ToxicFrog: sdegutis: regardless of the syntax used to present it, for me that's a context switch from "reading routing information" to "reading HTML"

9:58 sdegutis: mgaare: e.g. [[:one :instant :user/last-login-date], [:many :ref :cart/items]]

9:59 mgaare: ok

9:59 sdegutis: (that's fake data of course)

9:59 ToxicFrog: then yeah I agree somewhat

10:00 ToxicFrog: 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:00 ToxicFrog: sdegutis: yeah, that's fair

10:00 sdegutis: Meaning, sure, they're different things, but they go together so perfectly

10:00 But yeah, 200 lines is a bit much.

10:01 I'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:01 It's much nicer to have a single line saying (item-list) than a [:table ...] that's 100 lines in itself.

10:05 amalloy_, justin_smith: are your intermediate namespace names singular or plural when given the choice?

10:06 Like, in "src/myapp/x/cart.clj", would x be 'modules' or 'module'?

10:19 justin_smith: sdegutis: only rarely plural, exceptions being things like my.lib.protocols (it defines all the protocols)

10:19 sdegutis: Ah, hmm.

10:19 justin_smith: or my.app.routers (defines all the routing data)

10:20 but if it is named after what it does and not the things it defines, then I avoid plurals

10:23 sdegutis: justin_smith: hmm, weird

10:23 justin_smith: not your comment, just, this whole situation

10:37 Hi.

10:39 visof: hi guys

10:39 i have some image with some specific color region, can i filter the image which has this region?

10:39 is there a good way to do this in clojure?

10:42 ridcully: isn't opencv the goto lib for stuff like this?

10:44 visof: ridcully, maybe i can do something simpler imagez can help in this?

10:44 i'm going to not do complex image processing

10:44 justin_smith: visof: 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:45 because color perception (the real kind) is complex and hard

10:45 visof: for example humans always infer shading, refraction, color of light source, and still know the "real" color of the thing

10:48 sdegutis: Is there a way to tell Cider not to ever eval a certain namespace on cider-refresh?

10:49 justin_smith: sdegutis: if it uses tools.namespace/refresh, that has whitelist/blacklist options iirc

10:55 sdegutis: Nice. I'll do that then.

11:02 justin_smith: actually some-> solved it instead

11:02 (some-> conn d/db)

11:02 yay

11:02 justin_smith: interesting

11:21 sdegutis: ,(. (java.util.Date.) after (java.util.Date.))

11:21 clojurebot: false

11:21 sdegutis: I like this syntax a lot for Java comparison methods.

11:21 It's much more natural than this:

11:21 ,(.after (java.util.Date.) (java.util.Date.))

11:21 clojurebot: false

11:21 sdegutis: I wish > and < had a similar thing.

11:22 * justin_smith shudders at infix.

11:22 sdegutis: justin_smith: for .after it makes way more logical sense


11:23 sdegutis: justin_smith: your lack of faith is disturbing

11:23 justin_smith: you underestimate the power of the infix-side

11:34 hamid: do NOT underestimate the power of the dark side of the force!

11:36 anyway :D assuming i have a (def myset (set (range 1000000))) ... does a (set myset) have performance bottleneck since "myset" is already a set?

11:36 justin_smith: sdegutis: 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:36 hamid: no, it's basically a no-op

11:37 hamid: justin_smith, awesomeness there it is!

11:37 thank you

11:37 justin_smith: hamid: you can run (source set) in the repl and see for yourself

11:37 (assuming clojure.repl is in scope, which is the default)

11:37 hamid: ow

11:38 ,(set? #{})

11:38 clojurebot: true

11:38 hamid: i see

11:38 +1

11:38 sdegutis: justin_smith: clarity trumps power every time

11:38 justin_smith: sdegutis: then we agree!

11:38 sdegutis: justin_smith: that's why they banned call/cc

11:39 justin_smith: and it's also why you need a prescription to use macros, and you can only get them in restricted quantity

11:40 armlesshobo: justin_smith: sounds better than my insurance company's policies on prescriptions lol

11:53 sdegutis: :)

11:53 So many new regular faces here lately.

11:59 armlesshobo: :)

12:05 sdegutis: ...which means a lot of you have been breaking the first two rules of fight club.

12:07 bendavisnc: hey 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:07 is reflecting if something is a function just a no no in standard clojure code?

12:07 i feel like i'm definitely missing something

12:08 justin_smith: bendavisnc: most clojure code is not coded defensively - if someone does something dumb we just let them deal with the consequences

12:08 bendavisnc: and deciding what to do based on type of an arg is better done with multimethods or protocols rather than boolean checks

12:09 hiredman: ,(doc function?)

12:09 clojurebot: Pardon?

12:09 bendavisnc: ok 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:09 hiredman: why do you think function? exists?

12:09 justin_smith: personally 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:10 hiredman: there is fn? and ifn? depending on what you are doing

12:10 bendavisnc: https://clojuredocs.org/clojure.test/function_q

12:11 hmmm i think fn? is what i'm looking for. thanks!

12:11 hiredman: yeah, definitely don't use that

12:11 (ever, for anything)

12:11 bendavisnc: the test/function? you mean @hiredman ?

12:12 hiredman: yes

12:12 bendavisnc: yeah, 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:13 justin_smith: bendavisnc: 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:13 bendavisnc: ah, okay. thanks for that

12:14 hiredman: it 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:18 I 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:19 fn? basically returns true for anything created using (fn ...), and ifn? for anything else that can be invoked like a function

12:20 if 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:21 fn? may actually return false for multimethods too, I forget

12:21 ,(fn? print-method)

12:21 clojurebot: false

12:22 bendavisnc: yeah i think as long as i'm using fn i'm good

12:23 (fn? "howthisfalse")

12:23 ,(fn? "howthisfalse")

12:23 clojurebot: false

12:24 hiredman: it is highly context dependent

12:24 (if it will be ok or not)

12:25 if 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:26 sdegutis: Good evening.

12:26 How is your current state?

12:33 tolstoy: Unsynchronized and racey.

12:33 justin_smith: failover

12:41 hamid: in (source swap!), what is this "^clojure.lang.IAtom" all about? "([^clojure.lang.IAtom atom f] (.swap atom f))"

12:41 type checking?!

12:41 hiredman: type hint

12:41 hamid: hiredman, compile time?

12:41 hiredman: it isn't checked, but it is a directive to the compiler so it can generate optimal code

12:42 http://clojure.org/reference/java_interop#typehints

12:42 hamid: thank you ^

12:43 nice!

12:44 i wish it could type check! except core.typed... is there any form of lisp that type checks?

12:45 tolstoy: hamid: Maybe this? http://shenlanguage.org

12:45 sg2002: Hello. I've been playing around with gnu global. There's pygments plugin for it that allows it so parse clojure. Anyone tried this?

12:54 hamid: tolstoy, hmm weird it is! it has even pattern matching.

12:55 tolstoy: hamid: Seems to be something you use on another platform base. Scheme, Ruby, Common Lisp certified, JavaScript and Clojure "awaiting".

13:38 sg2002: Ok, so it seems that pygments is not worth it, but the universal-ctags works pretty fine.

14:01 sdegutis: Hiccup is really well designed, all except the very strange decision to differentiate between vectors and every other kind of data type.

14:02 If 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:02 Why 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:14 hamid: I'm trying to learn macros. Would anyone confirm this? https://www.refheap.com/116692 ?

14:15 in repl this happens: (macroexpand-1 '(update-state state $ (assoc $ :x 1)))

14:15 (clojure.core/swap! user/_state (clojure.core/fn [user/__state] (clojure.core/as-> user/__state user/state (assoc $ :x 1))))

14:16 im not sure why the namespace (user/*) is there! in the arugments that i passed

14:17 luma: because you have the symbol '__state inside a syntax-quote, so it is expanded into its fully qualified name user/__state

14:17 (since your macro is in the user namespace)

14:17 hamid: luma, would you fix it for me so i can see how it's done?

14:20 luma: hamid, this is probably what you're trying to do: https://www.refheap.com/116694

14:21 first of all, exprs should be a vararg (variable argument) so that you can pass any number of those

14:22 then, 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:23 and 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:24 hamid: luma, aawww niceee... thank youuuu :) it's awesome that you folks are here. that # thing is awesome.

14:24 now it's exactly what i intended to generate:

14:24 (clojure.core/swap! state (clojure.core/fn [state__8210__auto__] (clojure.core/as-> state__8210__auto__ $ (assoc $ :x 1))))

14:57 Boris: hi. stuck in a little java interop (which I seldomly do). Can anyone help me with translating this one line to clojure?

14:57 java: GPlot plot = new GPlot(this);

14:58 I would normally do something like (def plot (new GPlot)), but don't know how to deal with the "this"

14:58 context is here: https://forum.processing.org/two/discussion/136/grafica-library , trying to use the grafica extension of processing in quil.

15:05 justin_smith: Boris: a function can use it's own name to refer to itself

15:05 ,(defn me [] me)

15:05 clojurebot: #'sandbox/me

15:05 justin_smith: ,(= me (me))

15:05 clojurebot: true

15:06 boris133: so I would do (def plot (new Gplot plot))

15:06 justin_smith: boris133: no, more lik (defn setup [] (Gplot. setup)) - that would be a closer analog (this refers to the function owning the setup method)

15:07 err, object owning it, of course

15:07 boris133: ah, ok. I'll play with it.

15:07 justin_smith: boris133: but I'm not certain this would work - processing is weird and magic, and so is quil

15:08 maybe you would actually want to provide the name of the sketch (first arg to defsketch) instead? I really don't know

15:08 boris133: ugh. will see. I was just charmed by the plots from grafica - http://jagracar.com/grafica.php

15:08 justin_smith: hopefully someone else knows quil better than I

15:08 boris133: wanted to see if I could get that through quil.

15:08 *nod*

15:18 sdegutis: im back

15:18 ,((fn x [] (x)))

15:18 clojurebot: #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:18 sdegutis: hahaha stupid clojure, cant even handle infinite recursion

15:24 * lokien tries that in the repl

15:24 lokien: stupid clojure indeed

15:26 even nobody's advocating it

15:31 dysfun: mwahahaha, thwarted by the halting problem again

15:46 sdegutis: ,(:i :i)

15:46 clojurebot: nil

15:46 sdegutis: ,(:i :i :i)

15:46 clojurebot: :i

15:46 sdegutis: hahahah clojue is funny guy

15:47 I think clojure is a pretty cool guy. Eh accepts any input and doesn't afraid of anything.

15:50 luma: ,((get get get (get get get get)) {:a 42} :a)

15:50 clojurebot: 42

15:51 sdegutis: luma: you win

15:51 /this/ round

15:51 but you ahvent won

15:51 the .war

15:51 luma: (i think justin_smith is the one who likes to (get get get get) here)

15:51 sdegutis: ,(get get get get)

15:51 clojurebot: #object[clojure.core$get 0x1a3f6a10 "clojure.core$get@1a3f6a10"]

15:55 justin_smith: ,(= get (get get get get) ((get get get get) (get get get get) (get get get get) (get get get get)))

15:55 clojurebot: true

15:55 justin_smith: etc.

16:06 dysfun: you'd love perl, you know, justin_smith

16:10 Punic: Hey everyone.

16:10 lokien: hello Punic

16:10 justin_smith: dysfun: it appeals to my enjoyment of absurdity, but that isn't actually what I want in a programming language

16:11 Punic: How is it going guys?

16:12 justin_smith: pretty good! I just figured out an elegant way to claim ownership of tasks for a distributed pool using zookeeper

16:12 *from a distributed pool

16:12 lokien: justin_smith: absurdity is the best part of programming languages

16:12 Punic: Well that sounds cool. Altough I didn't understand shit from what you said

16:13 lokien: Punic: I wanted to do a project, but then I realised plenty of people have done that already

16:14 Punic: Don't tell me you were after "the next facebook"?

16:15 lokien: no, I just wanted to scrape some websites to my Kindle :<

16:16 (which I don't even own yet)

16:17 can you guys give me some good clojure code to read?

16:17 like, the most beautiful clojure code in your opinion

16:24 kenrestivo: the clojure source itself, or the cljs source, written by rich?

16:25 also, anything rich has written, like his example code for codeq and datomic

16:27 sdegutis: I look around, I look around.. I see a lot of new faces.

16:28 justin_smith: ring, and other stuff by weavejester. amalloy writes good code (in particular flatland/useful, a util lib, has some ideas worth emulating)

16:28 lokien: I'm an old face, come on

16:29 sdegutis: I've also seen an awful lot of unnecessarily convoluted code by respectable people though.

16:29 So that's not always a safe bet.

16:29 lokien: kenrestivo: clojure source frightened me last time I looked at it, I don't want to do it again

16:29 sdegutis: All 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:29 lokien: justin_smith: thanks, will check

16:30 justin_smith: sdegutis: (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:30 lokien: sdegutis: I don't have any ideas now, so no code is being written by me. downside of not having a job :(

16:31 sdegutis: lokien: 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:31 lokien: that said, if you want to get a Clojure job, start writing tons and tons and tons of Clojure

16:32 justin_smith: sdegutis: it works in the other direction too

16:32 sdegutis: justin_smith: how so

16:32 justin_smith: if you want to write tons and tons of Clojure, get a Clojure job

16:32 * lokien begines to write a lot of (get (get (get (get code to gain experience

16:32 sdegutis: justin_smith: sure, but it doesn't hurt to have some experience

16:33 justin_smith: lokien: lol

16:33 sdegutis: lokien: actually why not just this?

16:33 ,(take 3 (iterate #(get get %)))

16:33 clojurebot: #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:34 sdegutis: ,(take 3 (iterate #(get get %) get))

16:34 clojurebot: (#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] nil nil)

16:34 justin_smith: lokien: I only share stupid things like that so you'll be pleasantly surprised when I say something that isn't stupid

16:34 sdegutis: ,(take 5 (iterate #(get get %) get))

16:34 clojurebot: (#object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"] nil nil nil nil)

16:34 lokien: justin_smith: "How I Became A Professional Developer In Three Weeks Using This One Weird Trick"

16:34 sdegutis: ,(nth (iterate #(get get get %) get) 100)

16:34 clojurebot: #object[clojure.core$get 0x5351c06e "clojure.core$get@5351c06e"]

16:34 sdegutis: hahaha

16:34 justin_smith: lokien: programmers hate him!

16:34 sdegutis: ,(= get (nth (iterate #(get get get %) get) 10000000))

16:34 clojurebot: true

16:34 sdegutis: stupid clojure hahaha

16:35 lokien: use iterate, that's an easier way to recurse (get (get (get (get (get ... without doing it manually

16:35 hiredman: I 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:35 luma: ,(take 3 (iterate #(% % % %) get))

16:35 clojurebot: (#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:35 sdegutis: WAIT I GOT IT!!!

16:37 lokien: hiredman: tell me your secret of hiredness

16:37 hiredman: actually I am looking for work :P

16:37 lokien: :D

16:37 change your nick then, you mischief

16:38 TEttinger: it's hire d-man

16:38 sdegutis: hold on

16:38 its not working

16:39 why not?

16:39 (apply apply (repeat 4 get))

16:39 hiredman: I 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:41 sobel: i hate when that happens

16:41 er.. :)

16:42 sdegutis: i cant figure this out

16:42 hiredman: https://github.com/liebke/analemma is a neat project, I think it may even has started as a teaching aid

16:42 sdegutis: justin_smith: help what am i doing wrong

16:42 i mean for sure this works (apply get [get get get])

16:42 but i cant get it to take [get get get get] and turn it into (get get get get) anyhow

16:42 lokien: hiredman: that terrifies me a little, I'd like to get a job writing clojure, but it seems so unlikely

16:42 sdegutis: what am i doing wrong #:'(

16:43 oops that waffle doesnt belong on my head

16:43 sobel: lokien: 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:43 lokien: then you're the local expert, too. that doesn't hurt.

16:43 lokien: sdegutis: don't try to fool us, we saw everything

16:43 hiredman: if 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:43 sdegutis: also why doesnt ((fn [x & y] (apply x y)) (repeat 4 get)) work when it should definitely?

16:44 lokien: sobel: working with java people? I'm getting goosebumps already

16:44 justin_smith: ,(apply apply ((juxt first rest) (repeat 4 get))) ; sdegutis

16:44 lokien: hiredman: Poland >:c

16:44 clojurebot: #object[clojure.core$get 0x32badd00 "clojure.core$get@32badd00"]

16:44 hiredman: my last job was a remote position, and I cannot go back to having a commute

16:44 sdegutis: YESSSSS

16:44 justin_smith: you win

16:44 my brain is defeated on a friday afternoooooooon

16:45 sobel: lokien: <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:46 sdegutis: ahhhh i found out why

16:46 lokien: sobel: I'm an expressive languages nerd, it won't be as easy for me

16:46 sdegutis: ,((fn [[x & y]] (apply x y)) (repeat 4 get))

16:46 clojurebot: #object[clojure.core$get 0x32badd00 "clojure.core$get@32badd00"]

16:46 sdegutis: haha

16:47 justin_smith: sdegutis: but no juxt

16:47 sdegutis: aww

16:47 hiredman: it seems like there is more interest in ClojureScript developers, sort of front end ui focused stuff

16:48 I see positions where they have a go/python backend and clojurescript frontends

16:48 Kirchgehammer: Say 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:48 Surely this must be documented somewhere?

16:48 hiredman: Kirchgehammer: yes

16:48 Kirchgehammer: Do you know the names of these functions?

16:48 hiredman: Kirchgehammer: https://clojure.github.io/clojure/javadoc/

16:48 justin_smith: Kirchgehammer: yes, you would want read followed by eval, there's methods in clojure.lang.RT

16:48 sdegutis: hiredman: thats because people suck

16:49 lokien: hiredman: yups, for someone that loves js ecosystem, but doesn't like its syntax, cjls is a blessing

16:50 Kirchgehammer: Object form = RT.readString("(def a 42)");

16:50 justin_smith Can't find the eval function :(

16:51 Oh wait, Clojure has an eval function, I just need to grab that via var?

16:52 justin_smith: Kirchgehammer: yeah, I forgot the steps, but yeah, first you need read-string, then eval

16:52 Kirchgehammer: IFn eval = Clojure.var("clojure.core", "eval");

16:52 Something like that?

16:52 justin_smith: and the var lookup / invoke might be the trick

16:52 I think so

16:52 should be quick to test out

16:53 kenrestivo: hmm. cider-doc is giving me fits. http://pastebin.com/wk6EpeGp

16:53 any ideas?

16:53 kennytilton: Does 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:53 kenrestivo: all i did is cider-doc at a particular point

16:53 justin_smith: kenrestivo: you just made me read code in comic sans :(

16:54 Kirchgehammer: Object form = RT.readString("(def a 42)");

16:54 IFn eval = Clojure.var("clojure.core", "eval");

16:54 Object result = eval.invoke(form);

16:54 System.out.println(result);

16:54 #'clojure.core/a

16:54 OMG it works!!!

16:54 justin_smith: Kirchgehammer: awesome

16:54 kenrestivo: i didn't write that in comic sans

16:55 it's a pastebin. isn't refheap closed to new pastes?

16:55 justin_smith: kenrestivo: just teasing, it's clearly an april fools thing

16:55 kenrestivo: ah! it isn't

16:55 https://www.refheap.com/116704

16:56 justin_smith: kenrestivo: that looks like buggy elisp to me

16:56 kenrestivo: it sure is. but... why? where? i'm using the cider from packages

16:57 20160401.1308

16:57 kennytilton: Oh. Object. Duh.

16:58 kenrestivo: this is actually why i stayed away from cider and used nrepl.el for years. it worked. :/

16:59 justin_smith: yes, nrepl.el was much more stable

16:59 kenrestivo: *sigh*

17:01 justin_smith: kenrestivo: it's like the opposite of the unix tool building philosophy: try to do everything you possibly can in one tool

17:03 kwladyka: if 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:04 justin_smith: kwladyka: it will load that namespace, and whichever other namespaces that namespace loads

17:04 kwladyka: require is transitive (otherwise it would be a pain in the ass to use libs)

17:04 kenrestivo: justin_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:04 this is like one of the most basic features

17:05 justin_smith: kenrestivo: I wish I could be more helpful, I don't even use emacs any more myself

17:05 kenrestivo: (cider-doc-lookup (make-symbol "while")) gives a stringp error

17:05 kwladyka: justin_smith sounds good :)

17:05 kenrestivo: even though that's not a stringp

17:06 justin_smith: kenrestivo: you could try the step debugger - elisp is actually really great for interactive debugging

17:07 kenrestivo: yep, i'm in the debugger. thanks

17:08 sdegutis: this sucks

17:08 my old code sucks

17:09 kenrestivo: oh well, i can just (doc foo) for now

17:09 sdegutis: im sorry, me, im sorry for putting you in this position

17:10 kenrestivo: everyone's old code sucks. that's what old code is.

17:11 justin_smith: kenrestivo: the sad thing is my good code is the code I never have to look at again

17:11 kenrestivo: I've written a handful of good namespaces, those are the ones I haven't had to load into an editor in ages...

17:11 haha

17:12 kenrestivo: true, but i bet if you did, you'd be gripped with an urgent need to refactor it

17:13 justin_smith: kenrestivo: 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:20 sdegutis: justin_smith: haha so wise

17:21 justin_smith: sdegutis: I assure you, I'm a fool

17:21 sdegutis: haha so modest

17:21 dysfun: justin_smith: we all feel that way when we look at our old code

17:22 justin_smith: sdegutis: 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:22 sdegutis: but I'm bad at code

17:22 dysfun: justin_smith: you should probably stop keeping english money in your pockets then

17:22 justin_smith: ba-dum-tish

17:22 sdegutis: justin_smith: that sounds unhealthy

17:22 justin_smith: i lost like.. hold on lemme check

17:23 justin_smith: sdegutis: 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:23 * dysfun lost 85lbs a few years back

17:23 sdegutis: justin_smith: like 6-8 lbs in the past few weeks

17:23 assuming our crappy scale can be trusted, which it cant

17:23 justin_smith: heh

17:24 sdegutis: the trick is to cut down on red bull to only 2-3 per day

17:24 lokien: justin_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:24 sdegutis: lokien: justin_smith <3 vim

17:24 lokien: i <3 emacs

17:24 lokien: YOU decide.

17:24 justin_smith: lokien: 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:25 sdegutis: justin_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:25 lokien: justin_smith: any plugins?

17:25 justin_smith: so 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:25 sdegutis: justin_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:25 justin_smith: lokien: just the basic vim-clojure

17:26 dysfun: you run on an ellipsis?

17:26 justin_smith: sdegutis: now I'm imagining you riding a ...

17:26 very abstract, but funny

17:26 sdegutis: dysfun: yeah its easier on my knees

17:26 justin_smith: you mean …

17:26 dysfun: i used to have a manual treadmill which had rollers in the middle, so it was a bit like an ellipsis

17:26 sdegutis: weird

17:27 lokien: justin_smith: o-kay, time to make my 4th vimrc

17:27 justin_smith: lokien: you don't have to do it my way! there's also monroe in emacs

17:27 lokien: sdegutis: how's your pinky? mine hurt after few hours, I had to switch to vim bindings

17:28 sdegutis: lokien: its fine as long as i dont wrest my rist on the wdesk

17:28 haha i jest, no lest

17:28 lokien: justin_smith: I just don't want to experience headaches ever again

17:28 * sdegutis is super super dazed out

17:29 sdegutis: dysfun: we used to have a treadmill desk for coding at at my old job

17:29 i think thye still have it

17:29 it was 2hard4me

17:29 i mean 2hard5me dangit i messed it up

17:29 justin_smith: lokien: 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:30 dysfun: yeah i should make a standing desk arrangement now i work from home all the time

17:30 i've stopped taking public transport in favour of cycling

17:30 justin_smith: dysfun: same but walking - 4.5 mile walk (though I do occasionally bus too)

17:30 (9 miles round trip)

17:31 1.5 hours of understimulation is a nice thing!

17:31 dysfun: too much time out of the day to walk

17:31 lokien: justin_smith: my programming is 80% looking at the code, 20% writing it

17:31 dysfun: i love cycling even though my legs are hurting because i took 18 months off

17:31 justin_smith: dysfun: 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:31 lokien: justin_smith: or even less.

17:31 like 90-10

17:32 dysfun: justin_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:32 sdegutis: dysfun: oh man i got one of those

17:33 lokien: dysfun: I love you!

17:33 TEttinger: my 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:33 dysfun: haha

17:33 TEttinger: it's like I'm incapable of passing a block in my code without passing a stool

17:33 lokien: TEttinger: my idea for a startup - coding toilet desks

17:34 tolstoy: lokien: Hopefully not open plan.

17:34 TEttinger: hahaha

17:34 sdegutis: hahahaha

17:34 justin_smith: TEttinger: lokien: 90% confustion, 5% contemplation, 2% writing code, and 25% underestimating the time needed for the task

17:34 dysfun: justin_smith: it's actually 460% underestimating the time needed for the task

17:34 TEttinger: confustius say...

17:34 lokien: justin_smith: 120% configuring my text editor

17:35 justin_smith: dysfun: oh man...

17:35 sdegutis: https://www.dropbox.com/s/h6kol44npg7n51d/workspace.JPG?dl=0

17:35 dysfun: its that

17:35 dysfun: i've taken to just letting my mind wander in useful directions and not worrying too hard about when it actually solidifies into code

17:35 sdegutis: im standing in that very spot as we speak

17:36 dysfun: nice desk

17:36 sdegutis: my dad made the middle shelf and put it on here

17:36 thanks

17:36 dysfun: the only redeeming thing about my desk is the aeron in front ofi t

17:36 lokien: sdegutis: nice drawings

17:36 TEttinger: indeed

17:36 sdegutis: haha that was my wife

17:37 one of them is sign language

17:37 the other is a <3

17:37 dysfun: i thought she was just sticking two fingers up at the person holding a shield?

17:37 sdegutis: haha no thats sign language

17:37 scottj: sdegutis: I think either your keyboard is too high or your monitor is too low

17:37 TEttinger: 3

17:37 scottj: or your legs are too long

17:37 lokien: sdegutis: "Children don't obey"

17:37 sdegutis: scottj: my monitor may be too low acrually

17:38 dysfun: your eyes should be level with the top of your monitor

17:38 lokien: sdegutis: sadly I can't read anything else

17:38 sdegutis: and you assume you got that one correct

17:42 scottj: now that i look at it, when i stand up str8, my eyes go directly above the top of the monitor

17:42 like evenly flat

17:42 im sasying it all wrong, but i hope i make sense

17:43 tolstoy: Yeah. Where should your eyes fall when you slouch?

17:43 Kirchgehammer: justin_smith: http://i.imgur.com/qh4dTrZ.png

17:43 justin_smith: speaking of legs being too long, I totally want to make a data coersion library called Procrustes https://en.wikipedia.org/wiki/Procrustes

17:43 Kirchgehammer: Just finished the first working prototype ;)

17:44 justin_smith: Kirchgehammer: nice!

17:45 first task, coerce the string "coersion" to become "coercion"

17:45 sdegutis: lol clopad

17:45 hard to believe thats a monospace font too

17:45 justin_smith: sdegutis: I think we should be nice here - he just went and made a thing over the course of an hour or two

17:46 sdegutis: justin_smith: he made that? then whats the one im thinking of?

17:46 justin_smith: sdegutis: no idea! he was asking how to call clojure to evaluate strings, and came back with that java app

17:46 sdegutis: Kirchgehammer: nice app. what do you think of changing the font to menlo?

17:47 Kirchgehammer: Is that the official Clojure font or something?

17:47 My editor uses a bitmap font :)

17:47 sdegutis: justin_smith: im definitely thinnking of a different one

17:47 Kirchgehammer: no i just like menlo

17:47 Kirchgehammer: never heard of menlo

17:47 sdegutis: you may like it who knows

17:48 Kirchgehammer: maybe

17:48 sdegutis: Oh!

17:48 Clooj

17:48 i was thinking of Clooj

17:48 tolstoy: There's also night-something.

17:48 sdegutis: yeah nightcode but thats active

17:48 clooj was last touched late 2013 early 2014

17:49 tolstoy: nightcode.info: nothing! Hm.

17:49 sdegutis: i like the idea of a clojure ide written in clojure

17:49 a lot.

17:49 i just dont like the idea of it using a java ide

17:49 or clojurescript + web

17:49 justin_smith: sdegutis: Procrustes was "a rogue smith and bandit from Attica who physically attacked people by stretching them or cutting off their legs"

17:50 sdegutis: justin_smith: let me guess 'justin' is an alias

17:50 justin_smith: or should i say PROCRUSTES

17:50 justin_smith: but srsly im way too unconcentratd to know why you brought that up

17:50 justin_smith: sdegutis: you're just jealous because there's never been a rogue degutis

17:50 sdegutis: hahahaha

17:50 actually we looked it up

17:51 degutis is based on the lithuanian name for tar worker

17:51 so my ancestors basically made pitch for boats or something

17:51 justin_smith: sdegutis: the above conversation, someone said "or your legs are too long", which reminded me someone needs to make a coercion library named Procrustes

17:51 sdegutis: :'(

17:51 oh right

17:52 lokien: my last name is a vim plugin manager /:

17:52 sdegutis: it would go along with the technomancy-esque naming scheme thats all the rage these days

17:54 TEttinger: sdegutis: and a degu is a cute little squirrel type thing

17:54 http://homeanimals.co.uk/images/degu.jpg

17:55 justin_smith: TEttinger: that's what I assume sdegutis looks like, tbh

17:55 lokien_: That squinting one?

17:57 sdegutis: correct.

17:57 TEttinger: tommy ettinger is an anagram for gritty teen mom

17:58 justin smith is not very anagrammy

17:58 justin_smith: no, not really

17:59 sdegutis: Okay 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:59 TEttinger: steven degutis is an anagram for Nudest Vestige

17:59 sdegutis: But I can't think of what would be a great dinner tonight.

17:59 Glenjamin: thin jit sums

17:59 sdegutis: Something that's easy to buy and not hard to make.

17:59 justin_smith: Glenjamin: nice

17:59 tolstoy: Mexican food!

17:59 sdegutis: yeah but what kind?

18:00 i mean, i was gonna say nachos

18:00 Glenjamin: artithmetic in a hot loop :D

18:00 TEttinger: also, devise gun test

18:00 sdegutis: hmm

18:00 wtf TEttinger lol

18:00 so many inappropriate anagrams of my name

18:00 TEttinger: http://wordsmith.org/anagram/anagram.cgi?anagram=steven+degutis&language=english&t=1000&d=&include=&exclude=&n=&m=&source=adv&a=n&l=n&q=n&k=1

18:00 sdegutis: i half expect the next one to include like murder or something

18:00 tolstoy: Ground beef, spices, green onions, tomato, hot sauce, tortilla, done.

18:00 sdegutis: tolstoy: but thats a lot of work to chop up the things

18:01 srruby: yum

18:01 sdegutis: hmm

18:01 justin_smith: has anyone made a statistical model based taco bell food generator yet?

18:01 tolstoy: Not longer than it takes the meat to cook. And if you want cheese, you can get that pre-grated. ;)

18:01 justin_smith: you probably wouldn't even need a markov model, I but just a random percentage of including each ingredient on the list would suffice

18:02 tolstoy: Yeah, seems to me that the difference between one dish and another is the style of the tortilla.

18:02 sdegutis: tolstoy: then its settled

18:03 * sdegutis is calling her back

18:03 srruby: Question 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:03 tolstoy: Heh. Add some re-fried beans, if that's your thing, too. I like black-bean best.

18:04 TEttinger: justin_smith: have you had a quesalupa, or whatever the chalupa with a quesadilla shell is?

18:04 srruby: cook the beef separately and drain off the fat unless you like the fat....

18:04 sdegutis: aw heck yeah, shes gonna make sweet & spicy chicken wraps

18:04 tolstoy: Strainer!

18:05 sdegutis: turns out jewel sells precooked and precut up chicken

18:05 yay

18:05 so btw, guys, this is slightly more on topic:

18:05 turns out, music with no lyrics or singing in it, just instruments, is really good to listen to while programming

18:06 tolstoy: Classical all the way.

18:06 sdegutis: such as https://www.amazon.com/gp/product/B00P1AYVBS (preview the things)

18:06 lokien_: I can't focus listening to piano, I just keep listening to the piano for ten minutes instead of coding and get distracted

18:06 tolstoy: I had to grow into listening to stuff while working due to Open Plan / Cubicle life.

18:06 justin_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:06 clojurebot: #'sandbox/taco-bell-recipe

18:06 sdegutis: ok so thats the setup (its also true btw).

18:06 justin_smith: ,(taco-bell-recipe)

18:06 clojurebot: ("corn tortilla" "rice" "sour cream" "guacamole" "cheese" ...)

18:06 sdegutis: now heres the joke

18:07 justin_smith: sdegutis: your dinner^

18:07 sdegutis: such as Bon Iver also

18:07 tolstoy: Separate the data (ingredients) from the functions (particular dish)?

18:07 sdegutis: i mean,

18:07 "also, anything by Bon Iver"

18:07 haha!

18:07 tolstoy: Sigur Ros is nice.

18:08 sdegutis: justin_smith: hmm could use more thread-last

18:08 justin_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:08 clojurebot: #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:08 justin_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:08 clojurebot: #'sandbox/taco-bell-recipe

18:09 justin_smith: ,(taco-bell-recipe)

18:09 clojurebot: "rice, sour cream, guacamole, tomatoes, lettuce, enchilada sauce"

18:09 justin_smith: sdegutis: yeah, thread-last would make that more readable

18:09 scottj: "Mexican Rice Bowls"

18:09 ,(taco-bell-recipe)

18:09 clojurebot: "corn tortilla, tomatoes, beef, sour cream, cheese"

18:10 scottj: "Beef Taco"

18:10 sdegutis: anyway so mainly i just wanted to make that joke about how Bon Iver sounds like theres no lyrics

18:10 Glenjamin: please turn that into a 4clojure question somehow

18:10 justin_smith: Glenjamin: oh man

18:10 sdegutis: but also you should check out that FFVII Melancholy Tribute album its actually great for programmin to

18:10 TEttinger: I 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:11 tolstoy: sdegutis I'm one of those people that almost never hears the lyrics as language.

18:11 sdegutis: tolstoy: you are so lucky

18:12 tolstoy: Yeah. 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:12 sdegutis: TEttinger: hmm, [retracted inappropriate joke]

18:12 tolstoy: oh yeah for sure, i half know what u mean

18:13 tolstoy: Thus, hip-hop is kinda just a bunch of men yelling at me.

18:13 lokien_: tolstoy: even in your native language?

18:14 tolstoy: lokien_ 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:15 sdegutis: tolstoy: i dunno this is pretty good https://www.youtube.com/watch?v=6mTtAh-KYW0

18:15 got kind of an epic feel, which is appropriate give nthe story it tells

18:15 tolstoy: I like, say, Cocteau Twins or Sigur Ros just fine, even though there's basically just voice-as-instrument.

18:15 lokien_: tolstoy: teach me your ways, sensei

18:15 tolstoy: Heh. ;) It's just genetic, or something.

18:16 justin_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:16 clojurebot: #'sandbox/taco-bell-recipe

18:16 sdegutis: "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:16 justin_smith: sdegutis: ^ fixed for you

18:16 tolstoy: Too distracted by the actual music? Grew up (to 13) in a house with only Classical?

18:16 justin_smith: ,(taco-bell-recipe)

18:16 clojurebot: "corn tortilla, flour tortilla, rice, chicken, enchilada sauce, beans"

18:16 sdegutis: justin_smith: whoa too much thread-z now

18:16 justin_smith: that code brings tears to my eyes

18:17 justin_smith: ,(taco-bell-recipe)

18:17 clojurebot: #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:17 sdegutis: HAHHAHA

18:17 * sdegutis actually LOLd

18:17 justin_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:17 clojurebot: #'sandbox/taco-bell-recipe

18:17 justin_smith: ,(taco-bell-recipe)

18:17 clojurebot: "gordita, corn tortilla, chips, guacamole, enchilada sauce, sour cream, lettuce, beans, beef, chicken, cheese, tomatoes"

18:17 lokien_: tolstoy: I need to buy a piano

18:18 tolstoy: justin_smith: I think you're on to something. Start a .io domain and call y-combinator.

18:18 sdegutis: lokien_: also oxygen, dont forget oxygen

18:18 tolstoy: LOL man you guys are on a roll

18:19 justin_smith: tolstoy: for our C round funding we will expand to also cover Italian and Chinese foods

18:19 lokien_: sdegutis: I'm a lucky man, oxygen is free in my country

18:20 sdegutis: :D

18:20 tolstoy: mexican.menu.io

18:20 chinese.menu.io

18:20 justin_smith: tolstoy: and the best one, stoner.menu.io - which randomly pulls ingredients from all the others

18:20 tolstoy: By these 5 basic ingredients, never worry again.

18:20 Heh.

18:21 lokien_: justin_smith: don't forget 30$/mo pro subscription

18:21 tolstoy: Click this button, it creates the meal, messages the store, queries your inventory, phones your partner.

18:21 sdegutis: justin_smith: stoner is basically just clojure.core/random-sample

18:22 tolstoy: In fact, here's a little device with just a button on it. Pair it via bluetooth, then just push the button and wait.

18:22 sdegutis: ,(random-sample 0.5 (range 10))

18:22 clojurebot: (2 3 4 8 9)

18:22 sdegutis: hahah nice

18:22 i never knew about this fn til 2day

18:22 tolstoy: stoner.menu.io: Blends whatever's left over, cooks, desiccates: cheesy puffs.

18:24 justin_smith: ,(apply str (random-sample 0.1 (slurp "http://history.eserver.org/gettysburg-address.txt")))

18:24 clojurebot: #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:24 justin_smith: :P

18:25 anyway, 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:25 amalloy: oh, random-sample is a new one

18:25 sdegutis: amalloy: for sure, looks way handy

18:27 justin_smith: ,(:added (meta #'random-sample))

18:28 clojurebot: "1.7"

18:28 sdegutis: yeah for sure, 1.7

18:29 justin_smith, amalloy: the implementation is amazing too

18:29 dont look at it, take a guess how it works

18:29 justin_smith: haha, too late

18:30 sdegutis: sorry

18:32 hiredman: I know

18:33 random-sample is such an exciting addition

18:33 TEttinger: ,(random-sample 1/7 (range 10))

18:33 clojurebot: (2 7)

18:35 sdegutis: haha so close

18:36 TEttinger: ,(random-sample Math/PI (range 10))

18:36 clojurebot: (0 1 2 3 4 ...)

18:36 TEttinger: ,(random-sample (/ 1 Math/PI) (range 10))

18:36 clojurebot: (0 6 7 9)

18:36 TEttinger: it's hilarious that we have random-sample but not any way to seed the RNG

18:36 seems kinda handy for tests!

18:39 sdegutis: I HAVE AN IDEA

18:39 justin_smith: sdegutis: did you just invent test.generative?

18:42 srruby: I'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:43 Does it makes sense to use (for if you aren't going through a collection ?

18:43 justin_smith: srruby: well, it has to be a seq of some sort before for can use it

18:43 what is the source of data

18:44 amalloy: what a philosophical question

18:45 srruby: I'm doing some number crunching and repeatedly . Source is a single number that I'm factoring

18:45 sdegutis: ,(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:45 clojurebot: 4

18:45 sdegutis: pretty printed version https://gist.github.com/sdegutis/8b7e1c066645b288781d1921cce5a3e6

18:45 ,(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:45 clojurebot: 23

18:45 sdegutis: ,(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:45 amalloy: what makes you think the result of repeatedly is not a sequence, srruby?

18:45 clojurebot: 30859

18:45 sdegutis: WHOA

18:46 TEttinger: srruby: do you mean something like iterate ?

18:46 srruby: amalloy: Sorry for being unclear. I'm not using repeatedly.

18:47 amalloy: Thanks everyone, I guess I'll either use iterate or for. I'm porting a while loop.

18:48 justin_smith: srruby: are you trying to generate a collection or are you doing this for side effects?

18:48 if 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:48 srruby: justin_smith: Thanks everyone!

18:48 sdegutis: so, to be clear:

18:48 kwladyka: https://github.com/pelle/clauth or https://github.com/ddellacosta/friend-oauth2 or something else?

18:49 sdegutis: it took 30860 tries before (random-sample 5/7 [0 1 2 3 4 5 6 7 8 9]) returned [5 7]

18:51 ,(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:51 clojurebot: #'sandbox/times-to-get-to-fraction

18:51 sdegutis: ,(times-to-get-to-fraction 1/7 10)

18:51 clojurebot: 111

18:51 sdegutis: ,(times-to-get-to-fraction 1/7 100)

18:52 too mcuh broke bot

18:52 amalloy: .(apply * 5/7 5/7 (repeat 8 2/7) 1.0)

18:52 clojurebot: Execution Timed Out

18:52 amalloy: ,(apply * 5/7 5/7 (repeat 8 2/7) 1.0)

18:52 clojurebot: #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:52 sdegutis: amalloy: lol ur drunk thats a period

18:52 amalloy: ,(apply * 1.0 5/7 5/7 (repeat 8 2/7))

18:52 clojurebot: 2.2656852317705177E-5

18:52 amalloy: 1/50000

18:52 ish

18:54 sdegutis: amalloy: you work for cognitect right?

18:56 bbl she made delicious taco wrap things with chicken meat

18:56 i dunno or care what its called its good

18:59 TEttinger: mmm factoradic numbering is my favorite

19:05 tolstoy: Can you get openjdk 8 on the Mac these days?

19:10 TEttinger: tolstoy: yeah, Zulu

19:10 it's actually a really nice build

19:10 tolstoy: What's that?

19:11 H. This? https://hub.docker.com/r/azul/zulu-openjdk/

19:12 Ah: http://www.azul.com/downloads/zulu/zulu-mac/

19:13 sdegutis: tolstoy: did you get your openjdk8 q answered

19:13 i have oracle java sdk 8 installed and its such a pita

19:13 tolstoy: I think so.

19:13 sdegutis: it pops up every few days telilng me to upgrade my java and im like shut up

19:13 tolstoy: Ah, the java browser plugin thing.

19:13 sdegutis: similar to https://img.buzzfeed.com/buzzfeed-static/static/2016-01/20/11/enhanced/webdr15/enhanced-14111-1453306596-2.png but not 100%

19:16 tolstoy: sdegutis Every use /usr/libexec/java_home?

19:17 With -V?

19:17 Hm. If you add -v 1.8, it'll find the most recent (this zulu thing for me).

19:18 AND, it has startcom certs. ;)

19:18 sdegutis: tolstoy: i never touch java via cmdline

19:18 tolstoy: my only interaction with java is either via clojure or via some .pkg file

19:19 that said, i enjoy using java 1.8 apis like LocalDateTime (sooo nice)

19:19 tolstoy: sdegutis It's possible to have multiple versions on OSX, so that util can be used to set JAVA_HOME to the right one.

19:19 sdegutis: cool

19:20 tolstoy: It never comes up if you just use the latest oracle one.

19:24 noethics: are there any decent libraries for bytecode engineering

19:24 specifically for clojure

19:25 tolstoy: noethics: Probably not what you were thinking of, but https://github.com/clojure/tools.emitter.jvm. ;)

19:26 TEttinger: doesn't one of ztellman's libs do that? gloss?

19:26 sdegutis: yeah i was gonna say, if anyone did it its ztellman

19:26 tolstoy: That's for working with bytes, but noethics said bytecode.

19:26 noethics: jvm bytecode

19:26 hiredman: I've only ever used asm (the library the clojure compiler uses) to generate bytecode

19:26 noethics: this is interesting but not useful to me :P

19:27 yeah i would prefer some clojure wrapper for asm

19:27 tolstoy: Yeah.

19:28 hiredman: https://github.com/hiredman/bc/blob/master/src/bc/core.clj is a badly written classfile parser written in clojure

19:28 noethics: lol

19:28 hiredman: along with some completely nonsensical ruby code generting stuff

19:29 (I think I wanted to translate some bytecode into ruby for reasons)

19:29 noethics: i feel liek there could be some really nice wrapper for asm in clojure

19:29 hiredman: I dunno, I have't found asm to be very terrible to use directly

19:29 noethics: it's pretty terrible to use by itself ime :P

19:32 kwladyka: I 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:32 Can you share some experience about OAuth 2 in Clojure?

19:34 (i need to client both sided, client and server authorisation, also app to get resources)

19:39 mmm time to sleep, i will think about that tomorrow :)

19:40 sdegutis: bbl

19:48 hiredman: I 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:53 someone 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:00 noethics: i need to do some analysis too

20:01 not just write instructions :P

20:03 but i think there could be some nice clojure way of making my own ast with just asm

20:04 i can only thing of doing that with lists of classnodes though. visitor pattern would be best i assume?

22:01 sdegutis: I think a function like if-let with multiple sequentially bound bindings like let would be useful.

22:02 It would be kind of like some->

22:02 In the sense that it would continue as long as none of the bindings were nil, but short-circuiting.

22:02 some-let

22:03 This 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:06 I'm going to assume that justin_smith's going to say that amalloy_ has already implemented this in flatland/useful.

22:13 Lewis: what makes code data? this concept is still abstract to me

22:15 sdegutis: Lewis: watch

22:16 hiredman: ,(type (read-string "(def x 1)"))

22:16 sdegutis: ,'(+ 1 2)

22:16 clojurebot: clojure.lang.PersistentList

22:16 (+ 1 2)

22:16 sdegutis: ,(first '(+ 1 2))

22:16 clojurebot: +

22:16 sdegutis: ,(second '(+ 1 2))

22:16 clojurebot: 1

22:16 sdegutis: ,(type (first '(+ 1 2)))

22:16 clojurebot: clojure.lang.Symbol

22:16 sdegutis: ,((juxt identity type) (first '(+ 1 2)))

22:16 clojurebot: [+ clojure.lang.Symbol]

22:16 Lewis: so what makes it data?

22:16 sdegutis: Anyway, it's done. Here:

22:16 Lewis: as opposed to what

22:17 sdegutis: Lewis: try representing Ruby code as Ruby data

22:17 ,(defmacro some-let [bindings body] (let [[x y & rest] bindings] `(if-let [~x ~y] ~(if (empty? rest) body `(some-let ~(vec rest) ~body)))))

22:17 clojurebot: #'sandbox/some-let

22:17 sdegutis: ,(some-let [a 1, b (do (prn :a a) (inc a)), c (do (prn :b b) (inc b))] :bla)

22:17 clojurebot: :a 1\n:b 2\n:bla

22:17 Lewis: sdegutis: simple example please. I'm picked up clojure today again after a long hiatus

22:18 sdegutis: ,(some-let [a 1, b (do (prn :a a) nil), c (do (prn :b b) (inc b))] :bla)

22:18 clojurebot: :a 1\n

22:18 Lewis: s/example/examples*

22:18 sdegutis: Sweet, it works!!!

22:18 Lewis: can you just say in words what make it data

22:18 sdegutis: Lewis: Sorry, my some-let macro wasn't an example intended for you. This is though:

22:19 Lewis: watch how reverse works:

22:19 ,(reverse [1 2 3])

22:19 clojurebot: (3 2 1)

22:19 sdegutis: Lewis: With me so far?

22:19 Lewis: ok?

22:19 i am

22:19 sdegutis: Lewis: now is it clear to you how this function call works?

22:19 Lewis: you reversed a vector

22:19 sdegutis: ,(+ 1 2 3)

22:19 clojurebot: 6

22:20 Lewis: you summed up a list

22:20 sdegutis: Lewis: so what happens if I do this?

22:20 (3 2 1 +)

22:20 Lewis: error

22:20 sdegutis: Lewis: what will that last form evaluate to?

22:20 And why?

22:20 Lewis: because the first operator should be a function

22:20 sdegutis: Right. But if it were reversed, it would be fine, right?

22:20 Lewis: first argument*

22:21 yes

22:21 sdegutis: Lewis: Now what do you think this is?

22:21 ,(quote (+ 1 2 3))

22:21 clojurebot: (+ 1 2 3)

22:21 hiredman: the 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:21 sdegutis: hiredman: shut up im having fun here

22:21 Lewis: no need to guess, watch:

22:21 ,(type (quote (+ 1 2 3)))

22:21 clojurebot: clojure.lang.PersistentList

22:21 sdegutis: ,(map type (quote (+ 1 2 3)))

22:21 clojurebot: (clojure.lang.Symbol java.lang.Long java.lang.Long java.lang.Long)

22:22 hiredman: ocaml let x = 1 in 1, what data structure is that code?

22:22 sdegutis: It's a List of a Symbol followed by 3 Longs.

22:22 Lewis: with me so far?

22:22 hiredman: clojure code is made up of datastructure literals, and only datastructure literals

22:22 sdegutis: Lewis: now watch this

22:22 ,(defmacro postfox [form] (reverse form))

22:22 clojurebot: #'sandbox/postfox

22:22 sdegutis: ,(postfox (3 2 1 +))

22:22 clojurebot: 6

22:23 sdegutis: Lewis: see?

22:23 Lewis: tchip

22:23 dude

22:23 sdegutis: Hm?

22:23 Lewis: just tell me with words

22:23 hiredman: the syntax of clojure is the syntax of a datastructure notation, like json (but richer)

22:23 sdegutis: Lewis: I just told you in a way more clear way than words.

22:23 Lewis: Just like drawing a circle is a way better way of demonstrating what a circle is than trying to explain it.

22:23 Lewis: i clearly dont see the point , i realized that my issue might be with the definition of data

22:24 sdegutis: Lewis: did you see how that macro just now worked?

22:24 Lewis: why code is data? can't you put it in words ?

22:24 I dont understand macro yet

22:24 sdegutis: Lewis: Because Clojure expressions are homoiconic.

22:24 hiredman: code is data because the code is written in datastructure literals (list literals, vector literals, symbols, etc)

22:25 Lewis: hiredman: ok, let me ask it another way, why is that a language like ruby code is not data

22:25 or javascript

22:25 sdegutis: Lewis: the fact that code is data is only applicable in macros

22:25 hiredman: I give up, have fun with this.

22:25 hiredman: lewis: they have syntax that is not a datastructure

22:26 sdegutis: ,(some-let [a 1 b nil c 2] a)

22:26 clojurebot: nil

22:26 sdegutis: ,(some-let [a 1 b 3 c 2] a)

22:26 clojurebot: 1

22:26 sdegutis: Woo!!

22:26 ,(some-let [a 1, b nil, c (prn :c)] a)

22:26 clojurebot: #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:26 sdegutis: Aww.

22:26 ,(defmacro some-let [bindings body] (let [[x y & rest] bindings] `(if-let [~x ~y] ~(if (empty? rest) body `(some-let ~(vec rest) ~body)))))

22:26 clojurebot: #'sandbox/some-let

22:26 hiredman: for 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:26 sdegutis: ,(some-let [a 1, b nil, c (prn :c)] a)

22:26 clojurebot: nil

22:26 sdegutis: WOO!!

22:26 ,(some-let [a 1, b 2, c (prn :c)] a)

22:26 clojurebot: :c\n

22:27 sdegutis: Exciting times.

22:27 hiredman: what do you think of this macro?

22:27 some-let

22:27 hiredman: for 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:28 Lewis: hiredman: thank you i got it

22:29 so 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:30 hiredman: you can say just, but it makes different kinds of meta programming much nicer

22:31 because the same tools you use to manipulate data (maps, sets, vectors, lists) can be used to manipulate code

22:31 Lewis: right

22:31 which make sense

22:31 thanks i got it. i personally think that a word explanation speak louder than code in this instance (nto always the case)

22:31 not*

22:44 sdegutis: I just aid that.

22:44 *said

22:44 Man never mind, that's the last time I try to help.

23:13 Hi.

23:27 troydm: is it possible to traverse transient sequence? and destructure it?

23:34 or 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:34 something like a map but with a way to bailout

23:35 or actually not map since I want to process atleast 6 elements per each iteration

23:35 I'm thinking of doing destructuring and then doing into

23:36 (into [a b c d e] rst) or something like that

23:36 but I don't know if it's effiecient or not

Logging service provided by n01se.net