#clojure logs

2015-01-27

00:23elarsonlooking at java.io.Reader.read and the args in the java doc suggest that you pass in the char buf you want to to read the chunk into. how would that work in clojure?
00:26elarsonfor example, something like (let [chunk (.read fh 1024)]) makes more sense to me
00:27justin_smithelarson: I think the straightforward way is to create a buffer to read into, and then create a string from the relevent subsequence after reading
00:27elarsonah ok, so I would go ahead and create a buffer
00:27justin_smithlike, there isn't a method with the signiture you suggest here
00:29justin_smithyeah, and the mutability isn't a huge issue, because the buffer should be local in scope and all you do is read into it and immediately create an immutable string from that
00:29justin_smiththough of course accidentally sharing a buffer would be a nono
00:31elarsonjustin_smith: that makes sense. is this idiom relatively common b/c of clojure's java/jvm roots?
00:32justin_smithyeah, in my experience at least
00:32justin_smithyou could make a wrapper, but it's only a small amount of interop, and there would be many ways for the wrapper to go wrong
00:50audiodudehello, I’m learning Clojure with the Pragmatic book "Programming Clojure"
00:51audiodudeany recommendations for a starter project?
00:56scottjaudiodude: everytime you wish there were a program that doesn't exist add it to a list and you'll never have to ask that question again :)
00:58sujeetaudiodude, or clone simple programs that already exist
00:59audiodudescottj: I feel like I am very complacent because I’m largely satisfied with the character and quality of existing programs
00:59audiodudesujeet: that seems like not a bad idea
01:21jinagaranoi'm having trouble setting up korma, when i try to insert it says "table not found." where can i find a solution?
01:35fairuzHi guys. Is there any simpler than this -> (cons A (if (vector? B) B [B]))
01:35fairuzIt should produce (A B) at the end
02:20tomjackI'm guessing there is something in core.logic.nominal which has performs badly in the number of noms involved?
02:22tomjackhttps://www.refheap.com/d77cdbc9bea84a3e02c122ce8
02:23tomjackit's strange to me, because I'm unifying with an lvar
02:23tomjackthe term is already there, I just want to convert noms to a_i so it prints a bit prettier
02:26tomjackalso, it's a rather simple term :)
02:33tomjackI feel like I'd better start playing with debruijn indices...
03:40tomjackhmm, that happens even without noms
03:40tomjackand without ties
03:41tomjackesets maybe..?
03:49hellofunki'm looking at this: http://dev.clojure.org/display/community/Library+Coding+Standards odd i had not seen it before. this suggestion is confusing to me: "Don't unroll optional named arguments. While it's nice for callers to not have to wrap optional named arguments in a map, clearly specified configuration maps are laudable."
03:51Glenjaminhellofunk: it's annoying to build unrolled kwargs manually
03:52Glenjaminit refers to (func :a 1 :b 2) vs (func {:a 1 :b 2})
03:54Glenjaminoh, i se - there's already an example
03:54Glenjaminoh, weird
03:54Glenjaminthe prose doesn't seem to match the code sample in the doc
04:01tomjackI think the sample just makes a second point that is not in the prose?
04:02Glenjaminthe prose indicates the second and third are preferrable
04:03Glenjaminbut the comments say to use 1st and second
04:04tomjacks/Don't unroll/Consider not unrolling/ ?
04:04hellofunkexactly, it's a confusing point being made there
04:05Glenjaminthe general advice i've seen lately is that (release-sharks 2 {:verbose true}) is sensible for optional options
04:08zactshi
04:11zactshum.. I need more experience with designing functional programs. I don't know what to represent with functions, and what to represent with data.
04:14Glenjaminzacts: this talk might help https://www.youtube.com/watch?v=3oQTSP4FngY
04:15Glenjamin"Decompose the pieces. If your name isn't Rich, don't write a form as long as, say, the definition of doseq."
04:16clgvGlenjamin: how about `for`? :P
04:16Glenjamini type the following with trepidation:
04:16Glenjamin$source for
04:16lazybotfor is http://is.gd/x33p56
04:16Glenjaminalso, robots are great.
04:17clgv`doseq` almost fits on the 24" screen here ;)
04:17Glenjamini'd always sort-of assumed doseq was (comp doall for)
04:18Glenjamin #_"not the inner-most loop" ; <- amazing comment
04:18clgvGlenjamin: the `for` implementation is the best example how you do not need comments in Clojure since it's implementation is so clear when reading through it quickly
04:19hyPiRionnot sure if srs
04:19clgvhyPiRion: pssshhht!
04:19Glenjamina large part of the length seems to be functions-in-let
04:20Glenjamini wonder why they're not just defn-
04:20Glenjaminah, there's quite a bit of closing over stuff
04:20clgvGlenjamin: strange idea of hiding them since the implementer thinks they are not useful in any other context
04:21Glenjamin*implementor doesn't want to have to support using in other context?
04:21clgvyeah maybe the closures make it less complicated ;)
04:21Glenjamini guess you can rely on the fact that changing them will only affect the definition of for
04:23slipsetI seem to remember from http://vimeo.com/100518965 that Rich doesn't always write code with readability in mind...
04:23slipsethe seems to be optimizing for something else.
04:23zactscool, thanks /me watches
04:23Glenjaminhah, i recall rich briefly refuting the large java files being a problem directly after that talk
04:24Glenjamini dunno if that's on video
04:24slipsetGlenjamin: one thing is the 10k loc, but another thing is that one may argue that the code is not strictly idiomatic java
04:24Glenjaminwell, rich pointed out that although it's 10k lines, it's really flat and the IDE lets you jump around functions easily
04:25hyPiRionit's idiomatic hickey-styled java
04:25Glenjaminand then wiggled his mouse at the symbol list in intelliJ
04:25slipsetbut IIRC, the first clojure compiler generated java-code, not java byte code, right?
04:25clgvGlenjamin: that's true the IDE helps a lot there
04:25slipsetand I was thinking when I saw this code, that it looked as if it would make sense if it was generated.
04:26clgvslipset: are you sure?
04:26slipsetclgv: nope
04:26clgvslipset: I somehow doubt that statement
04:26Glenjaminthe indentation is a bit unusual, but i've never had a real problem reading clojure's java code
04:26clgvGlenjamin: could have more comments and method descriptions ;)
04:26Glenjaminit's just a bit different. I saw a suggestion once that writing code differently forces the reader to slow down and actually read it
04:27Glenjaminthat's true, i've mostly only looked at the collection implementations, which are tidy to a point, then arcane
04:27clgvyou have to rely on debugging step by step a lot of times to find out what is actually happening
04:27clgvGlenjamin: I hacked the compiler a bit ;)
04:27hyPiRionThe collection implementations are okay. They are just hard to grasp when you don't know *why* they're doing that one weird thing
04:28Glenjaminluckily someone wrote a bunch of blog posts about that :)
04:28hyPiRionhehe :p
04:29slipsetand is preparing talks about it, as one can read on twitter
04:31hyPiRionslipset: That was just a suggestion from someone – I'm not sure if a talk will be that valuable, but we'll see
04:31slipsetI know it was a suggestion from someone, since I know the guy quite well.
04:31hyPiRionah
04:31slipsetIf you know what I mean :)
04:33hyPiRionslipset: well, I'm considering it at least :)
04:33slipset:)
04:34slipsetI don't know if flatmap(oslo) is happening this year, but even though it's a (mostly) scala conf,
04:34slipsetI think the subject should fit right in.
04:35slipsetThere's been clojure workshops and om and datomic talks
04:35slipset(or was it quiescent)
04:35hyPiRionyeah, and the ImmutableVector in Scala is basically the same thing
04:44cflemingIs there an easy way to check if two objects are equal, but also take into account if their metadata is equal?
04:44whodidthishow do i (defmacro [& thingies] `~thingies)
04:45Empperiwhodidthis: please elaborate
04:45tomjackcfleming: (and (= x y) (= (meta x) (meta y)))
04:45hyPiRioncfleming: not afaik. You also have to be a bit careful with objects that can't contain metadata
04:46hyPiRion,(meta 1)
04:46tomjackah, I see
04:46clojurebotnil
04:46cflemingtomjack: That won't take into account if their sub-objects' meta is equal
04:46hyPiRionhuh, that used to fail
04:46whodidthissorry, (defmacro a [& b] `~b) so i get all them thingies in (a 1 2 3) in a list or something
04:46EmpperihyPiRion: (meta 1) gives nil
04:46tomjackcfleming: ah
04:46tomjacks/objects/clojure collections/ ?
04:46hyPiRionEmpperi: yeah, I just tried :p
04:47Empperiwhodidthis: (defmacro a [& body] (list ~@body))
04:47cflemingtomjack: Well, collections are objects, but right, I should have been more precise, sorry
04:48zactshuh cool
04:50james234hi
04:50james234I'm having trouble getting my clojure app to accept a POST request
04:50james234is this the right place to ask?
04:50slipsetcould be,
04:50hyPiRionhuh, that is weird. I thought meta would throw an error if given a non-IMeta object.
04:50tomjackcfleming: good question
04:50hyPiRionBut it appears it never has.
04:50Glenjamin$source meta
04:50slipsetjames234: do you have a link to your code?
04:50lazybotmeta is http://is.gd/bgjvT6
04:50cfleminghyPiRion: I believe it checks (instance? IMeta)
04:51Glenjaminmaybe that's with-meta?
04:51james234slipset: let me get one
04:51Glenjamin,(with-meta {} 1)
04:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentMap>
04:51Glenjamini think i did that wrong...
04:51tomjackI mean, really all you need is map, for whatever functor you pick (like "lists of lists of lists of ..." or what you like)? then you can (map (juxt identity meta)) and compare?
04:52zactsI guess I have the problem that with some of my projects the functions/procedures rely too heavily on the data having a specific form. What are ways people have had to deal with this problem? So that one can extend or modify the data later on? Would I need to use Data Abstraction?
04:52james234slipset: here is a link to the relevant code:
04:52cflemingtomjack: But that's still not recursive, right? I'd need something like tree-seq
04:52james234slipset: http://pastebin.com/FJwV0N04
04:52zactsand how does data abstraction, in the SICP sense, work with Clojure with all of it's already presented data types?
04:53Glenjaminzacts: try and separate the "doing work" functions from the "extracting data from the structure" functions
04:53zactsit seems clojurists want to keep their data structures naked, rather than abstracting data in the SICP sense?
04:53clgvjames234: the nested defroutes is certainly weird
04:53tomjackcfleming: right, I just mean you need the "map" operation for some type which is not lazy seqs
04:53clgvjames234: you know that there is just `routes`
04:53tomjacksay, trees, if that's what you've got
04:54james234clgv: yeah I tried that also
04:54zactshuh, ok Glenjamin
04:54tomjackthen you write a tree-map and do (= (tree-map (juxt identity meta) x) (tree-map (juxt identity meta) y))
04:54clgvjames234: are you sure you actually sent a "POST"?
04:54clgvand not a "GET"
04:54james234clgv: this code seems to work, when I test the 'app' function, I get back a normal response map
04:54Glenjamineg. (fn my-thing [some-map args] (update-in some-map [:drill :down :data] apply-transformation args))
04:55james234clgv: yes I am sending the "POST" using postman
04:55zactsGlenjamin: was that for me?
04:55Glenjaminyeah
04:55zactsah ok
04:55cflemingtomjack: Interesting idea, I'll play around with that, thanks. I'm a little worried about the elements of tree-seq not necessarily being the elements used by default equality (i.e. trickiness around map entries, or whatever) but that looks promising.
04:56zactsGlenjamin: so your example would not be a good design in this case
04:56zactsbecause it has the transformation stage within the data access functionality
04:56Glenjaminthat's preferrable to one big function, because the structure part is separate from the "apply-transformation"
04:56tomjackyeah.. good luck. maybe look at clojure.walk too if it works with the data you've got?
04:56Glenjaminyou still need both bits, but you can combine them in more ways like this
04:57Glenjaminmaybe that wasn't the best example
04:57cflemingtomjack: yeah, I'll take a look at that too - thanks
04:58james234clgv: when I test the 'app' function in the repl, using a request map, I get back a status 200 response map. But when I try to send a POST using postman (or my clientside javascript) it always sends back a 404.
04:58hellofunkslipset: that vimeo video like many is frustrating to watch since it doesn't show any of the slides the presenter is talking about.
04:58hellofunkslipset: oh i slap my face. i see there isa link in the comments to the slides.
04:58slipsethellofunk :)
04:59slipsethellofunk: btw, I haven't watched the video, I was in the audience.
04:59zactsI guess the goal for me is to make composable pieces like if I were composing music. Let me think of my example. I want to build more complex pieces of music from smaller building blocks
05:00zactsI don't want to represent a song as a specific data structure
05:00slipsethellofunk: maybe an idea for euroclojure to integrate the slides into the video
05:00zactsI want it to be composed from functions
05:00zactsso I guess one of my problems is how to represent something like this in data that I could share with others
05:00zactsyet the data still contains how it was composed together
05:02zactsI want many of my projects to have the flexibility of this kind of functional composition, in my design with functions and data
05:02zactsI don't know how to design data, namely config formats, and composable functions
05:02zacts(I hope this kind of makes sense)
05:04zactsshould a song in this case be represented as maps / vectors / etc... or should it be a bunch of composed functions, I think the latter would be better.
05:04slipsetzacts: sounds to me like you'd want to design a dsl for yiour problem?
05:04zactshuh, yeah kind of
05:04zactsI want a dsl for composing music
05:04ianhedoesitzacts: github.com/overtone/overtone
05:05zactsyeah I know overtone
05:05ianhedoesitoh okay
05:05zactsbut I'm also trying to extend this metaphore into other domains
05:05zactsmetaphor
05:05ianhedoesitI wasn't saying "use that instead!" or anything, I was going to say maybe get ideas from that
05:05zactsah ok
05:05ianhedoesitI haven't looked into overtone itself much though, so don't expect anything. I only know of it because I'm using overtone/at-at for a project.
05:05slipsetzacts: curious if you could make your data somthing like tools.analyzer.jvm
05:06slipsetcheck this video by tbaldridge https://www.google.no/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=video&amp;cd=5&amp;cad=rja&amp;uact=8&amp;ved=0CDQQtwIwBA&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKhRQmT22SSg&amp;ei=g2LHVO2pI4X5yQOTooKoBQ&amp;usg=AFQjCNGnX0-U0XGGwwT8QKu2bcEbGxASTA&amp;sig2=WJ4BCXTMoTDXnsb0sfkD4Q&amp;bvm=bv.84349003,d.bGQ
05:07zactsI guess I really like the flexibility of composing music this way, I know how to do this. I just want to apply this level of flexibility and composability in other non-musical domains of design
05:07zactssome of my other projects seem to be too rigid
05:08zactsand I would like to extend this composablitity to other projects.
05:09zactsperhaps a more concrete example would be better.
05:09whodidthisok im just being a bad, if i have (defmacro a [& b] `(let [b# ~b] b#)), how do i make it less bad so that it wont call (1 2 3) but return [1 2 3] or something
05:10zactshuh, let me find the plugin for one problem I had
05:11clgvwhodidthis: transform it to a vec
05:11whodidthisoh '~b and then just convert it seems to work
05:11whodidthisthanks, sweet
05:12zactsI found it
05:12clgv,(defmacro a [& b] `(let [b# (vec ~b)] b#))
05:12zactshttps://github.com/lispcast/intro-clojure-1/blob/master/video1.clj
05:12clojurebot#'sandbox/a
05:12clgv,(a 1 2 3)
05:12clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
05:12zacts^ I was following this lispcasts tutorial
05:12clgv,(defmacro a [& b] `(let [b# ~(vec b)] b#))
05:12clojurebot#'sandbox/a
05:12clgv,(a 1 2 3)
05:12clojurebot[1 2 3]
05:12whodidthisohh, dont even need to quote it cool
05:13clgvwhodidthis: for this case you need quote only if you want a list as value
05:13slipsetzacts: multimethods?
05:13zactswhat are multimethods?
05:13slipset(defmulti action :action)
05:13zactsthe interesting thing with this project, is that he represented much of the code as a datastructure
05:14zactsah yeah
05:14slipset(defmethod action :squeeze ...)
05:14slipset{:action :squeeze ...
05:14zactswell I seem to lose much of the composability of the data from this
05:14slipsetthen you could imagine just sending a nested map to your action function and let it walk it.
05:14zactskind of like how I want to keep the composability similiar to my music idea
05:15zactswhat is the advantage of multimethods, versus just using functions?
05:15zactss/is/are/
05:15slipsetit's open ended polymorphism
05:16zactsI don't know what that means
05:16zactsyou can overload the same functions with multiple data?
05:17slipsetnope, it means you can solve the expression problem :)
05:17zactsplease define 'expression problem'
05:17slipsetif I give you a library with a multimethod and several implementations, you can add your own other implementations which suit your data
05:17slipsethttp://www.ibm.com/developerworks/library/j-clojure-protocols/
05:18slipsethere done with protocols
05:18slipsethttp://adambard.com/blog/structured-clojure-protocols-and-multimethods/
05:19zactsah cool let me read this
05:20zactsthis is kind of what my questions in my mind have been about, now realized into a blog.
05:20slipsetgreat!
05:20zactsthanks
05:24ianhedoesitslipset: I like the Data All The ASTs talk.
05:25slipsetzacts: https://gist.github.com/slipset/42ce72108f9fa4502ada
05:26slipsetianhedoesit: cool!
05:28zactsoh neat slipset
05:28hellofunkzacts: a meaningful and flexible way to organize the data that is music is something i've thought about a lot. for me, it seems to depend on what you consider the key organizing parameter. for example, all music is a function of time. but is time a good way to organize it?
05:29bielllsHello everyone, I'm getting a really strange error when I apply str to a lazy seq http://pastebin.com/xj8Dni2D . Does anyone know why that happens?
05:29zactshellofunk: yeah
05:30hellofunkzacts: when you structure music data as an application of time, you easily lose the independent flow of individual moving lines, so i'm not convinced that's the wise approach.
05:30zactsand also, there could be static songs that are exactly the same, and then there can be guidelines for an improvisation or composition, that are different every time
05:32zactsslipset: the problem I see with that is that you still have to write action handlers for each action
05:32zactsand
05:32zactsjust a sec..
05:33zactsI'm trying to gather my thoughts on this
05:33hellofunkzacts: and when you structure a piece such that all the musical lines are slaves to time, you lose the ability for each line to easily have its own interpretation of time, which is what makes 19th centure music so great, and jazz, and any arena where the expression is separated from the constraints of a shared rhythm
05:33zactshellofunk: indeed
05:34zactsI think the quote from SICP is good for this musical idea
05:34zactslet me find it
05:34zacts (Even while it changes, it stands still.)
05:34zactsHeraclitus
05:35zactshow do you represent movement in a static data type?
05:35hellofunkzacts: the naive yet common commercial approach is to organize music data as moments in time, but that is deeply flawed in my opinion and greatly limits what can be *easily* achieved in computer music. i've more recently thought serious about music as not data points in time, but rather each point is a minor thunk (type of function application) that governs its place in the greater context.
05:35zactsyeah, that sounds neat.
05:36hellofunkafter all, that's how the musical mind subsconsciously creates the expression, musicians are thinking in the same way that a computer is prorammed (usually)
05:36hellofunki mean, *not* thinking
05:37hellofunkzacts: would like to know what SICP quote you are referring to
05:37zactshttp://mitpress.mit.edu/sicp/full-text/book/book-Z-H-19.html#%_chap_3
05:37zactsat the top of ch3 in SICP
05:37hellofunkinteresting
05:38zactsit's a metaquote (kidding) (I'm referencing a quote that is quoted within SICP)
05:39hellofunkzacts: that's an intresting quote. after all, a function is something that transforms something else (i.e. a type of "change"). yet, the function itself is a value that is not changing.
05:40hellofunkand in the immutable world (which at its heart, isn't all the universe immutable?), even what the function changes is not really changing.
05:42zactswell I had this idea that anything could be computed given infinite time, it just takes forever to get there. and that is where all motion comes from. so it's like godel escher bach. or a strange loop.
05:42zactsso there is both motion and no motion at the same time, it just takes forever to get the motion
05:42zactsor something like that
05:42zactsbut now we are getting philosophical GEBish. lol.
05:43zactsso I think a turing machine is sort of right and sort of wrong at the same time
05:44zactsand with that, I must get some tea or coffee
05:45zactsI think we must view functions / state as a strange loop
05:46zactspure functional vs mutated state
05:46clgvzacts: that assumption is false. not everything is computable
05:46clgvnot even when you assume you had infinite time
05:46zactsclgv: indeed, but it's like a strange loop
05:47TEttingercan you compute the last digit of pi?
05:47zactsnope
05:47clgvTEttinger: hehe nice try
05:48zactsbut back to clojure, this is getting too philosophical
05:48clgvzacts: it's called theoretical computer science ;)
05:48hellofunkTEttinger perhaps the question is, not whether can we or anyone compute it, but rather, is it possible in some way to compute it, but we haven't discovered how?
05:48zactsclgv: lol
05:48zactsyeah
05:48ianhedoesitTEttinger: I bet it's [0-9]
05:48clgvhellofunk: there is none since pi is transcendent ;)
05:49TEttingerhellofunk: it's easy if you use a base-pi numbering system
05:49hellofunkclgv: but correct me if i'm wrong, doesn't nature manage to "compute" it just fine?
05:49TEttingernever precisely
05:49TEttingerapproximately
05:49zactswell, I see pi as this
05:49zactsjust a sec..
05:50zactspi is like a thunk as hellofunk described
05:50zactsit's not a static thing, but it's a means for finding the relationships between things
05:50zactsor something like that
05:50clojurebotCool story bro.
05:50TEttingerlol clojurebot
05:50clgvclojurebot: botsnack
05:50clojurebotthanks; that was delicious. (nom nom nom)
05:50zactslol
05:52hellofunki wonder what triggered that clojurebot retort
05:52zactsoh, well. It's like 3:50am for me. I'm still waking up, perhaps this is just philosophical mind vomit from me
05:52clgvhellofunk: I think he does that randomly from time to time
05:52hellofunkzacts: waking up or going to bed?
05:52zactswaking up
05:52hellofunkzacts: damn son you are an early riser. you aren't Tim Cook by chance?!
05:52zactsno I'm zac
05:52hellofunki was kidding
05:53clgvmaybe he just slept through the entire monday ;)
05:53zacts:-D
05:53zactsso, back to clojure let me try to come up with a more concrete example for this baker idea
05:53hellofunkzacts: i will guess that you live in Porland or near SF
05:54zactsheh, I used to live in Portland, I live in NM now
05:55hellofunkzacts: right, SF, as in Santa Fe
05:55zactsoh sorry, I thought san francisco
05:55hellofunkjust kidding. i meant the other SF. but my guesses were badly designed. i was off by an hour. i've thought about moving to NM more than once in my life.
05:56ianhedoesithellofunk: Portland's cooler.
05:56ianhedoesitliterally.
05:56martinklepschwondering how to test private fns?
05:56martinklepschis this the way to go: (#'scratch.core/super-secret-function 5) ?
05:56clgvmartinklepsch: don't make them private in the first place. this is seldom a good idea
05:57martinklepschclgv: making functions private is rarely a good idea?
05:57martinklepschclgv: why that?
05:58clgvmartinklepsch: have you not been annoyed so far that when writing a macro some of the clojure core functions used in defn or similar are private?
05:58ianhedoesitmartinklepsch: I don't know his reasoning, but I would like to ask you why should some function be private? what benefits are there in the situation?
05:58Glenjaminif it's not private, you're sort-of promising not to break it in future
05:59clgvmartinklepsch: similar holds for different libraries. the implementation is there, but you need to rearrange it differently. but with idiomatic clojure you cant because of the private fns
05:59martinklepschclgv: actually havn't written many macros so that problem is unknown to me
05:59Glenjaminsmaller api surface area is sometimes beneficial when publishing a library
06:00martinklepschianhedoesit: the reason is that there is some functionality that is exposed via a single public function and I don't want anyone to use the functions used to implement that functino
06:00ianhedoesitwhy not?
06:00schmirsome people prefer implementation namespaces to private functions. that would allow using the function from multiple namespaces
06:00martinklepschbecause most likely it would be wrong to use those functions somewhere else
06:01martinklepschschmir: impl namespaces don't restrict usage as private fns do
06:02martinklepschThis is mostly a warning sign for other people working with the code - "hey! you're not supposed to do that"
06:03schmirmartinklepsch: yes, right. I also use private functions. I don't see a problem with them....
06:03schmirmartinklepsch: btw. thanks for the nice talk on boot!
06:04ianhedoesitmartinklepsch: as a counter point (and I don't have a strong opinion on the matter, really. I think private functions have their place and there isn't necessarily a hard and fast rule), I've been using a library which does some stuff I need, but it has tons of private functions that I've ended up needing to recreate in my code because I need the lower-level functions the authors thought would not be needed. I don't like this.
06:04martinklepschschmir: oh thank you :) who are you? :P
06:04zothidey ho :) I'm trying clojure.walk for the first time, and have a nested tree-ish structure built both from vectors and maps; I would ideally like to walk the structure, building up a 'path' along the way, which would be suitable for use w/ (update-in) while evaling the 'inner' function. anybody know of some example/sample/working code that does something similar?
06:04justin_smithianhedoesit: @#'ns/f :)
06:04ianhedoesitjustin_smith: shh. neat!
06:05martinklepschianhedoesit: yeah I see the point, I guess there it's mostly a design decision. like the library author wants to keep the surface area he has to maintain small
06:05schmirmartinklepsch: Ralf Schmitt, but we didn't talk
06:05martinklepschjustin_smith: what does that do vs #'ns/f?
06:06martinklepschschmir: too bad. say hi next time :)
06:06martinklepschschmir: are you using boot?
06:07justin_smithmartinklepsch: it explicitly derefs, for a function it isn't needed actually I guess
06:07schmirmartinklepsch: I'm thinking about switching over for a GUI application that I develop
06:08martinklepschjustin_smith: for what would that be needed? (I guess it's not an atom deref kind of thing)
06:08martinklepschschmir: Clojurescript based?
06:09justin_smithmartinklepsch: vars need to be derefed, but in the calling position the deref is automatic
06:09justin_smith,(@#'+ 1 1)
06:09clojurebot2
06:09justin_smith,(#'+ 1 1)
06:09clojurebot2
06:10martinklepsch,(def n 5)
06:10clojurebot#'sandbox/n
06:10schmirmartinklepsch: no, clojure with javafx as a GUI toolkit
06:10martinklepsch(+ #'n 1)
06:10martinklepsch,(+ #'n 1)
06:10clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to java.lang.Number>
06:10martinklepsch,(+ @#'n 1)
06:10clojurebot6
06:10martinklepschI see. Thanks for the explanation justin_smith
06:11martinklepschschmir: nice. let me know if you need help :)
06:11martinklepsch(i.e. run into trouble or anything like that)
06:12schmirmartinklepsch: thanks!
06:23hellofunk,(apply #'+ 5 6)
06:23clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
06:24hellofunk,(apply #'+ [5 6])
06:24clojurebot11
06:24hellofunkjustin_smith: that was not in the calling position, right? still didn't need de-ref
06:24justin_smithapply translates to a call where it is in the calling position though
06:24Bronsahellofunk: vars automatically deref when used as functions
06:25justin_smithyeah, that's more precise anyway
06:25justin_smith(inc Bronsa)
06:25lazybot⇒ 87
06:28H4nsdoes anyone have recommendations for an image processing library? i mostly need to rescale jpegs. i have tried mikera.imagez, but it is lacking.
06:29justin_smithH4ns: for lichen we used the built in java stuff and it just works (BufferedImage etc.)
06:29justin_smithwhat was lacking?
06:29Glenjamin~lichen
06:29clojurebotPardon?
06:29Glenjaminjustin_smith: what's lichen?
06:29justin_smithGlenjamin: lichen is an image resizing server with aws support
06:30Glenjaminah, i see
06:30justin_smithGlenjamin: supports upload, and then cached resizes based on request parameters
06:30justin_smithcan host locally, or use aws storage
06:30justin_smithdoes jpg, gif, png, with transperency support
06:30H4nsjustin_smith: rescaling is lacking parameters, and it cannot save all jpegs without screwing up the colors. i've seen how that'd be fixed in its usage of the java builtin stuff, yet if there'd be something that works, i'd gladly use that instead of hacking on imagez
06:32H4nsjustin_smith: i'll review lichen, thanks!
06:32justin_smithH4ns: we got the stuff working via interop with the built in stuff in java, it shouldn't be too hard to use the appropriate functions in lichen but not run the server
06:32H4nsjustin_smith: lichen has the same bug as imagez with respect to screwing up the colos of jpegs, as far as i can see :)
06:33justin_smithoh, do tell the fix
06:33H4nsjustin_smith: http://stackoverflow.com/questions/9340569/jpeg-image-with-wrong-colors
06:33justin_smithhttps://github.com/caribou/lichen/blob/master/src/lichen/image.clj#L135 this is the function you would likely want to use, btw
06:33H4nsjustin_smith: basically, one needs to save the original image metadata
06:33justin_smithOH MY GOD THAT CMYK BUG WAS SUCH A PAIN IN THE ASS
06:33justin_smiththanks man!
06:33justin_smithI will fix it
06:34H4ns:D
06:34justin_smiththat solution is a total hack though :(
06:35H4nsthe java image api is so clunky. if one wants to know how java sucks, that is what to look at to be convinced.
06:35H4nssorry for the pointless ranting
06:36justin_smithnp, I tore my hair out over that bug
06:36justin_smiththe issue is that the java libs don't support CMYK jpeg
06:36justin_smiththis workaround is to treat it as a generic jpeg, and then hand copy the headers
06:36justin_smithhmm
06:38H4nsmaybe i should just wrap gd
06:46clgvmartinklepsch: that was one example of many where private fns made things much more complicated than need be
06:46justin_smithwhy not implement the metadata fix in mikera's lib or mine and issue a PR? I'll likely implement it eventually but it feels a bit hackish.
06:47clgvmartinklepsch: why can it be wrong to use a function somewhere else? that reminds me strongly of http://steve-yegge.blogspot.de/2010/07/wikileaks-to-leak-5000-open-source-java.html
06:49martinklepschclgv: that article is fun.
06:49martinklepschI'm not working on a library but on an application. so any other developer can just make it public, there's no way to avoid this (and also I don't want to avoid it)
06:50martinklepschmaking it private in my case is probably more a kind of documentation than it is an attempt to restrict people from using it
06:51martinklepsch"Who cares if I have a private helper function they need? What, is their copy/paste function broken?" hahaha
06:51clgv;)
06:52Glenjaminsomething like this: (defmacro publicize [vr] (def (name ~vr) (var vr)))
06:53clgvGlenjamin: hacking the check is not really a solution to this ;)
06:53justin_smithGlenjamin: you likely want a deref on that var, then it works for private data too
06:53clgvyou could just use #'the.ns/f instead ;)
06:54Glenjaminit's probably more of a philosophical question really :)
06:54clgvor similar, depending on your :require clauses
06:54clgvit's uncessary additional code.
06:54Glenjamini was thinking the macro expresses intent a bit better than using the var quote
06:55Glenjaminand specifically imports into the current namespace
06:55Glenjaminwhich in the testing scenario, is probably desirable?
06:57martinklepschclgv: you still think it's a bad idea to make this private?
06:58clgvmartinklepsch: usually there is almost no benefit from a private fn but much more hassle
06:59Glenjaminclgv: what about having to maintain back compat on the api? or do you prefer some other method to indicate "i might change these" vs "i'm unlikely to change these" ?
07:00clgvanother thought: if you are trying to test private functions and you made them private because they are only supposed to be used internally, then you are testing implementation details, which is not a good idea at all, since they will likely break on valid refactorings
07:01clgvGlenjamin: there is :skip-wiki although I don't like that name. then it is in generated docs. would you suspect undocumented functions to be backwards compatible?
07:01clgv+not
07:01Glenjaminthat's probably a reasonable line to draw
07:03martinklepschclgv: what speaks against testing an implementation detail?
07:03Glenjaminon the testing private side: i think there's value in testing an implementation detail - but not that testing a caller uses that implementation detail correctly
07:03Glenjamineg. test a helper fn, but don't test the real fn with the helper mocked
07:03jinagaranoi'm trying to set up korma with an h2 database. i did a ragtime migration, and when i try to do an insert, i get an error "table not found." why? project.clj and the korma code point to the same file.
07:12clgvmartinklepsch: valid refactorings are likely to cause test errors
07:19H4nsjustin_smith: i'll be doing that, now that i know about leiningen checkouts :)
07:24jinagaranoi'm trying to set up korma with an h2 database. i did a ragtime migration, and when i try to do an insert, i get an error "table not found." why? project.clj and the korma code point to the same file.
07:25zoldarHi. When writing and executing tests created with "deftest" directly from active repl, I experience a following problem: after removing and/or renaming one or more tests the old bindings are still in the namespace. I have to either a) restart REPL b) do manual unmap with 'ns-unmap'. Is there some more convenient approach, like clearing the whole namespace before reevaluating it?
07:26clgvzoldar: namespace reloading via tools.namespace
07:27clgvzoldar: or a custom function that flags all current variables as :old, then reloads the current namespace and ns-unmaps those that are still marked as :old
07:27zoldarclgv: forgot about this one, thanks
07:36luxbockwhat's the best way to get a [ns sym] tuple from a symbol?
07:37clgvluxbock: (juxt namespace name)
07:37clgv,((juxt namespace name) 'bla.blubb/foo)
07:37clojurebot["bla.blubb" "foo"]
07:37luxbockclgv: thanks
07:38luxbockI just ran into an amusing bug with my solution
07:38luxbockI was doing ##(apply str (drop 2 (str (resolve 'map)))) first
07:38lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
07:39luxbockwhich worked but then when it got a class name, then it would return "ass clojure.lang.Number"
07:42clgvluxbock: Clojure swearing back at you ;)
07:43luxbockI think I'll have to handle classes as a special case anyways
07:43luxbock,((juxt namespace name) 'clojure.lang.Numbers)
07:43clojurebot[nil "clojure.lang.Numbers"]
07:56Glenjaminjust catching up on that yegge rant - interesting that "final" is included, given clojure's hard stance on any inheritance
07:56Glenjamineven if it means there's loads of legwork to implement custom collections
07:58clgvGlenjamin: "final" is evil in the cases "this is almost what I need if I could just add something to that one function" ;)
07:58Glenjaminmm
08:14SagiCZ1how does exception catching works in clojure? i need to catch a specific type of exception and handle it.. and all OTHER exception types just log and rethrow..
08:14SagiCZ1would this work?
08:14SagiCZ1(try ... (catch MyException e ...) (catch Exception e ...))
08:15Glenjaminyes, it should
08:15SagiCZ1and how would this behave?
08:15SagiCZ1(try ... (catch xception e ...) (catch MyException e ...))
08:16SagiCZ1s/xception/Exception
08:16Glenjamintry it and see
08:18SagiCZ1ok.. the order does matter.. if the Exception catch is first, it will catch and handle everything.. so it needs to be last
08:32jinagaranoi'm trying to set up korma with an h2 database. i did a ragtime migration, and when i try to do an insert, i get an error "table not found." i don't understand why, project.clj and the korma code point to the same file.
08:34SagiCZ1does anyone know how to get ButtonGroup reference from JRadioButton? considering the JRadioButton is assigned to the ButtonGroup.. i just have references only to the buttons, not to the button group
08:47gfrederi`am thinking of making a lein task for deploying a fork
09:18clgvgfredericks: got into the shaving business, eh?
09:21freewaterHello. If I'm writing a macro that has `(aggregate (count :id)), when I do macro expand I get (korma.core/aggregate (clojure.core/count :id)) which is not what I want. I understand this is because of the ` but how do I get escape that to get just count without the clojure.core before it?
09:22tbaldridgefreewater: you can import korma.core with a name, and then prefix the call to count. `(aggregate (k/count :id))
09:23tbaldridge*require korma.core with a name
09:23gfredericksclgv: it's a yakky sort of morning
09:23tbaldridgefreewater: (:require [korma.core :as k])
09:23gfrederickspeople are always adding features to the master branch of their library and then waiting four months to make a release
09:24Glenjaminthat's one thing i like about Node - the culture is to release often, and not be afraid to have lots of version numbers
09:25Glenjamini guess fragmentation is more of a worry in this case?
09:26freewatertbaldridge: thanks, but the problem is it isn't in korma.core, and it does a lookup on the key 'count: https://github.com/korma/Korma/blob/master/src/korma/sql/engine.clj#L234
09:26muhukfreewater: also `(aggregate (~'count :id))
09:26tbaldridgefreewater: ahh, then you can do this:
09:26muhukfreewater: but it might not be what you want.
09:26tbaldridgeyeah, what muhuk said
09:26tbaldridge(or just don't use korma...it's pretty macro-heavy)
09:27muhukgfredericks: and there is no pull request for releases
09:27gfredericksmuhuk: good point
09:27tbaldridgefreewater: perhaps consider something like yesql https://github.com/krisajenkins/yesql#rationale
09:27freewatertbaldridge & muhuk: thanks, I'll give that a try
09:28muhukyw
09:28freewatertbaldridge: I tried looking at that first, but I couldn't figure out how to easily create dynamic queries, for lack of a better description
09:28clgvtbaldridge: a little offtopic: does pixie already have something like primitive type hints for function arguments and return value?
09:32tbaldridgeclgv: not needed, as the JIT adds them automatically.
09:33clgvtbaldridge: it does? interesting. so I should be able to do benchmark comparisons for numeric calculatins between clojure and pixie
09:33tbaldridgeclgv: yep, The JIT created by pypy is known as a "tracing jit" and is quite a different beast from the JVM
09:35clgvtbaldridge: I just remembered that Common Lisp needed those declare statements to optimize for numerics.
09:36tbaldridgeyeah, most JITs and compilers that only look at a single function in isolation will need that. Tracing JITs like PyPy, LuaJIT, etc. compile loops, not functions, so they will often inline much more aggressively, leading to less need for type hinting.
09:36freewater:muhuk does this work because ~ first unquotes from the ` and then requotes it with ', which doesn't return fully qualified symbols?
09:37clgvtbaldridge: are there facilities to see what the JIT does to a specific executed code snippet?
09:41gfrederickshuh; clojars lets you claim a subgroup of an existing group
09:41stuartsierragfredericks: That sounds like an oversight.
09:41gfredericksagreed
09:41gfredericksconfirming
09:42stuartsierraUnless the group you're claiming is a subgroup of a group you already own.
09:43gfredericksI just deployed this by accident despite not owning the existing mvxcvi group: https://clojars.org/mvxcvi.com.gfredericks.forks/puget
09:43Glenjaminclojars has subgroups?
09:43gfredericksGlenjamin: maven generally
09:45gfredericksthe one I linked to doesn't come up when searching for "puget" though
09:46muhukfreewater: ~'sym is actually sym, except when ` looks for stuff to quote it sees it as a call to ~ instead of the result of ~'sym
09:46gfrederickslol; the clojars issues page has delete requests in it
09:46muhukfreewater: something like that
09:47Glenjamingfredericks: it looks like some pages reverse the group id
09:48Glenjaminoh, nope - you just pushed it again
09:48gfredericksright
09:48gfrederickswelp I filed an issue
09:49gfrederickscan't figure out why my task failed to modify the description, but oh well
09:56gfredericksokay here's a new deploy-fork task you can use: https://github.com/gfredericks/corncob-cigar#deploy-fork
10:12zactsyo
10:14hellofun`zacts: 'sup
10:14zactshey man
10:14zactshellofun`: I would be interested in working further with you on some music + clojure ideas.
10:14zactsbut right now I need to wake up a bit, and make some breakfast
10:15zactsI took a nap, but I'm waking up now
10:15hellofun`zacts: no doubt my G. i'm actually about to shut down for the day. been a long one already and a long night last night too.
10:15zactscoolio
10:15zactsheh, I'm actually listening to bach's air on the G string right now, and bobby mcferrin singing it
10:16hellofun`yo 'sup bobby
10:16zactsbach was the original G I guess
10:16hellofun`yo that dude be everybody's G, son
10:17hellofun`zacts: there have been a number of interesting discussions lately with amalloy_ about related ideas too. it's an interesting area of research
10:17zactsah cool
10:24SagiCZ1can i somehow call a function if i have the string of its name?
10:24SagiCZ1(call "foo")
10:24tbaldridge,((resolve 'clojure.core/+) 1 2)
10:25clojurebot3
10:25SagiCZ1tbaldridge: thank you very much
10:25SagiCZ1,(resolve (symbol "+"))
10:25clojurebot#'clojure.core/+
10:25SagiCZ1sweet
10:26zwer,(resolve (symbol "+") 1 2)
10:26clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/resolve>
10:27zwer,((resolve (symbol "+") 1 2))
10:27clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/resolve>
10:27SagiCZ1,((resolve (symbol "+")) 1 2)
10:27clojurebot3
10:27zwer.. right
10:27tbaldridgeSagiCZ1: note though that resolve returns a var. If you don't want the var, but the thing inside the var, you'll need to deref it.
10:27tbaldridgeIt's just that vars auto-deref when they are called like functions
10:28SagiCZ1tbaldridge: interesting.. well it is a function so i guess i dont need to deref it
10:29SagiCZ1(def foo (shuffle [1 2 3]))
10:29SagiCZ1(defn foo [] (shuffle [1 2 3]))
10:30SagiCZ1the difference between these two is just that if its a function it gets shuffled every time its called?
10:30gfredericksyep
10:30hellofun`SagiCZ1: def foo is just storing the return value from shuffle, one time
10:30SagiCZ1so if i have a zero argument function and i want the result to be the same every time and it has no side-effect.. i should just use def, right?
10:30tbaldridgeyep
10:30hyPiRion(defn foo [] ...) is just (def foo (fn [] ...))
10:30hyPiRion"just"
10:30SagiCZ1thanks, that makes sense
10:32hellofun`i'm curious about terminology. if a fn doesn't make side-effects, but depends on data that could change that it reads from outside, then while it is side-effect-free, it is not pure, yes?
10:33SagiCZ1hellofun`: isnt reading outside data a form of side-effect?
10:33Glenjaminnot under the hickey definitions
10:33SagiCZ1well in any case it is not referentially transparent
10:33hellofun`SagiCZ1: i don't know, i'm curious about the terminology
10:33stuartsierraPeople tend to toss around terms like "pure" in conversation without being precise about their meanings.
10:34tbaldridgehellofun`: example? what do you mean by "reads from the outside"
10:34hellofun`i think of "pure" as meaning a funciton that is idempotent, referentially transparent, and without side-effects. is this valid? simply
10:34gfredericksidempotent, no
10:35gfrederickse.g., inc is not idempotent
10:35Glenjaminyes it is
10:35hellofun`tbaldridge: consider a zero-arg fn that merely returns the dereffed value of an atom but makes no changes
10:35tbaldridgeit is if you always pass in 1
10:35Glenjamin(inc 1) is always 2
10:35gfredericksGlenjamin that's not what idempotent means
10:35tbaldridgehellofun`: right, that's not pure
10:35Glenjaminwell, in that case isn't it meaningless on immutable values?
10:36gfredericksGlenjamin: no, idempotent means (= (f x) (f (f x)))
10:36hellofun`that (inc 1) is always 2 is idempotence, no?
10:36Glenjaminhrm, i see what you mean
10:36tbaldridgehellofun`: so by that standard, no clojure function is really pure, as a var could be re-deffed. But that's a price paid for REPL development
10:36Glenjaminthat's a good strong simple definition of idempotence - i like it
10:36gfredericksI think it's *the* definition :)
10:37Glenjaminhttp://stackoverflow.com/a/1077421/173062 seems to offer 2 definitions, no source though =/
10:37gfredericksyeah I guess there's a usage in the context of side-effects as well
10:38hellofun`actually, that (inc 1) always = 2 is perhaps an example of referential integrity/transparency
10:38SagiCZ1resolve takes a namespace parameter.. can it be in the short form as created by :require :as ? .. it works in repl but not in the actual program
10:39stuartsierra"Idempotence" is mostly useful when you're talking about something that potentially changes state or has side effects (e.g. HTTP GET vs POST).
10:39SagiCZ1,(require clojure.string :as str)
10:39clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>
10:39SagiCZ1 ,(require clojure.core.string :as str)
10:39clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core.string, compiling:(NO_SOURCE_PATH:0:0)>
10:39gfredericksI just used clojure inheritance to do something useful https://github.com/gfredericks/dotfiles/blob/master/.lein/profiles.clj.symlink#L26
10:40SagiCZ1,(require '[clojure.string :as str])
10:40clojurebotnil
10:40SagiCZ1,(str/join "hey" "word")
10:40clojurebot"wheyoheyrheyd"
10:40tcrayford____garee you're profiles.clj
10:40tcrayford____woah
10:40SagiCZ1,(resolve (symbol "str" "join"))
10:40clojurebot#'clojure.string/join
10:41gfrederickstcrayford____: I decided to start putting effort into it a year ago or something
10:41SagiCZ1,(resolve (symbol "clojure.string" "join"))
10:41clojurebot#'clojure.string/join
10:41tcrayford____that thing is huge
10:41SagiCZ1it should work..
10:41gfrederickstcrayford____: um and beautiful
10:42defnHello
10:42defnWhat's the rationale for having both partition and partition-all?
10:43SagiCZ1(inc defn)
10:43lazybot⇒ 1
10:43benmossdefn: a blog post just from yesterday on the two: http://gigasquidsoftware.com/blog/2015/01/26/partition-with-game-of-thrones-pugs/
10:44benmossdoes anyone konw how the version of Clojure determined if you don’t specify one in your project.clj?
10:44defnbenmoss: ya my question remains
10:45defnNo sense in having both as far as I can tell
10:45tbaldridgemaybe you want one or the other. What's the harm in having both?
10:45defnSubtle errors and no real expressivity benefit
10:46SagiCZ1does anyone know why resolve can resolve aliased namespaces in repl but not at run-time in the app? (resolve 'alias/foo)
10:46defnNot the end of the world but I don't understand the rationale
10:46tcrayford____defn: I agree with this - I've been using clojure for 5 years, not really used partition that much, ran into this recently and went kinda crazy
10:47defn"Why not both?" Is not a rationale
10:47Glenjamindefn: there are two distinct scenarios, which would you remove?
10:47SagiCZ1defn: dont they do different things? can you achieve partiton-all with partiton or vice-versa?
10:47defnI don't see why not
10:48defnI'd drop partition-all, make the default behavior of partition to be inclusive
10:48tbaldridgeand all existing code that uses partition may break
10:49defnHe asked. I never said its a viable option.
10:49SagiCZ1defn: and what if i want not inclusive partition?
10:49defnCheck the last yourself
10:49hyPiRionit's not "the last" though
10:50hyPiRion,(partition 3 1 (range 4))
10:50clojurebot((0 1 2) (1 2 3))
10:50hyPiRion,(partition-all 3 1 (range 4))
10:50clojurebot((0 1 2) (1 2 3) (2 3) (3))
10:50tbaldridge(inc hyPiRion)
10:50lazybot⇒ 60
10:51defnAlright. Nailed it.
10:51defnThat's all I was looking for :)
10:51tbaldridgefor the feature I've used several times, but always forget.
10:51SagiCZ1how do i deref a var?
10:51Glenjaminderef
10:51Glenjamin,(identical? + @#'+)
10:51clojurebottrue
10:52SagiCZ1oh.. thanks
10:56stuartsierraSagiCZ1: re your question about aliased Vars, it's because the REPL knows what the "current" namespace is. Running application code usually doesn't.
10:56SagiCZ1stuartsierra: cool.. well i used the fully qualified name and it works
11:00sdegutisSo I'm going through the book /Learn you a Haskell for Great Good/ and so far Haskell has all the features that made me love Clojure so much.
11:01sdegutisThe one feature I miss from Clojure that Haskell doesn't have is the -> macro.
11:01sdegutisJust thought I'd report my findings to anyone who also likes Clojure very much like me :)
11:02sdegutis*like I do
11:03hellofun`sdegutis: i would think there is an analog to clojure's comp though, is there?
11:03sdegutisYep, the . operator (or function since all operators are functions)
11:04hellofun`i've always preferred comp-style to threading for some reason
11:04sdegutisHaskell's map foo . filter bar is Clojure's (comp (partial map foo) (partial filter bar))
11:05agarmanquestion: why do transducers comp in reverse to normal functions?
11:05hellofun`it's interesting (from what i read online) that you can fold left and right both and still maintain laziness. that's the quality of the language i find so interesting. and that partial is implicit
11:05sdegutisagarman: they do? huh, didn't realize that
11:05sdegutishellofun`: oh neat I didn't know that -- but I bet you can do the same thing in Clojure
11:06agarmanyeah, (comp (filter odd?) (map inc)) -- does filter then does a map
11:06sdegutisSo far Clojure can do everything Haskell can do (I think), just with dynamic typing.
11:06stuartsierraagarman, sdegutis: It just sort of falls out of how they are implemented. Each layer of composition adds another "step" to the beginning of the "process".
11:06agarmanversus (comp inc second)
11:06hellofun`sdegutis: no, not on those things i mentioned. we've had a number of debates in here and on SO, those are features clojure doesn't really have
11:06sdegutisagarman, stuartsierra: well at least it reads more naturally to me this way
11:06sdegutishellofun`: oh
11:07agarman@sdegutis it reads backwards from mathematical function def (f (g (h x))) => (comp f g h)
11:07sdegutisI forgot why I ever liked dynamic typing.
11:07sdegutisagarman: ah
11:07ToxicFrogI liked dynamic typing because I'd only ever used languages with terrible static typing.
11:07sdegutisagarman: I don't know math so I'm unbiased.
11:07ToxicFrogSo the options were "dynamic typing" or "Java"
11:07sdegutisToxicFrog: that's probably the same with me too (C++, C, etc)
11:08ToxicFrogStatic typing looks a lot more attractive once you're introduced to type inference, generics, etc
11:08ToxicFrogYou spend less time fighting with the type system.
11:08SagiCZ1ToxicFrog: do yuo consider java to have good static typing system? jw
11:08ToxicFrogSagiCZ1: no
11:08sdegutisYeah Go really got me into type inference, but lack of generics put me off. Then recently I learned Swift which has both but with a similar syntax, but it's Apple-only.
11:09Glenjaminhaskell has type classes, which are nice
11:09Glenjaminnot many well known langs with ad-hoc polymorphism =/
11:09sdegutisThen I found OCaml which is basically a better Swift, but it's still pretty weird in some spots for me. So that's why I'm learning Haskell which has type inference and generics (kind of) and *all* my favorite features of Clojure.
11:09ToxicFrogsdegutis: looked at Rust? I haven't used it but I have a friend who's very pro-static-typing-for-real-world-use and speaks favourably of it after some experimentation.
11:09ToxicFrogHaskell is one of those languages that I really like on paper but have never actually gotten anything done with.
11:09Glenjaminrust doesn't have ad-hoc polymorphism either afaik :(
11:09ToxicFrogI think it was Scala that convinced me that static typing doesn't have to be a painful trainwreck.
11:09sdegutisToxicFrog: yeah but Rust is still a low-level language, where you can't really omit specifying low-level details when you want to write higher-level code, which turned me off to it
11:09hyPiRionGlenjamin: ad-hoc? It has traits
11:10hellofun`sdegutis: how is that book LYAGH
11:10sdegutisToxicFrog: that's why I looked into Nim(rod) and OCaml.
11:10ToxicFrogClojure with static typing would be pretty great, but core.typed just isn't there yet
11:10sdegutishellofun`: sooooo good
11:10GlenjaminhyPiRion: my understanding was they're limited in such a way that don't actually give you the same power as protocols and type classes
11:10ToxicFrogI haven't tried OCaml, I've looked at some resources for it and found it pretty offputting at first glance
11:10hellofun`sdegutis: i believe amalloy_ was recommending the same book to me last year or last night can't remember, recently
11:10Glenjamini am now reading up on it
11:10sdegutishellofun`: if you know Clojure it'll be slightly slow, but his very colorful and humble writing style makes it a breeze (and fun) to skim
11:10sdegutisToxicFrog: what about it?
11:11hyPiRionGlenjamin: type classes doesn't give you the same power as protocols though. You can afaik only implement typeclasses where the type is defined or where the typeclass is defined
11:11ToxicFrogsdegutis: no polymorphism, mostly, so you need different operators/functions for different data types even if the conceptual operation (e.g. addition) is the same for both
11:11hellofun`sdegutis: i didn't realize that book was online for free. i wonder if that is recent.
11:11GlenjaminhyPiRion: right, that's probably what i'm thinking of - i had assumed the "ad-hoc" part meant you didn't have to be the owner
11:12ToxicFrogI like having one "+" function that works for all numeric types and one "map" function that works for all sequence types
11:12sdegutisToxicFrog: ouch yeah that sucks
11:12hyPiRionGlenjamin: That being said, I can imagine typeclasses with some language extensions (or maybe even without) being more general than traits.
11:12Glenjaminone of the nicer parts is that functions are namespaced
11:13Glenjaminwhereas (afaik) obj.method syntax isn't - even with traits
11:13hyPiRionyeah
11:13ToxicFrogsdegutis: arguably I haven't given ocaml a fair shake, I haven't actually written any code in that, but I just find that feature-lack really, really offputting.
11:13crash_epIn clojure.test, are there any hazards with making the "is" checks in a separate thread, or with looping them? I ask b/c I notice the final report says I only have N assertions, where N is the number of separate occurrences of "is" in the code, although I am calling it hundreds of times in a separate thread.
11:14sdegutisSo as I'm reading through Learn you a Haskell online (http://learnyouahaskell.com/), I'm finding in pretty much every chapter that the examples look *almost exactly* like Clojure.
11:14Glenjaminis there a general name for "solves expression problem and has avoids namespace collisions on dispatch item" polymorphism?
11:14sdegutisAnd I'm just like "Awesome, it has that feature too!"
11:14sdegutisToxicFrog: no you're right, that's totally fair
11:15sdegutisToxicFrog: I had a lot of problems with OCaml that I tried to overlook to learn it, and then there was one or two that was just the straw that broke the Caml's back and I was like "welp, let's look at Haskell"
11:15sdegutisSo far I haven't had *any* problems with Haskell yet. It's basically a typed Clojure with fewer parentheses and less syntax.
11:15ToxicFrogsdegutis: yeah, I've futzed around with haskell a bunch but I've never actually solved any problems with it. I always end up confused, sad, and tangled up in the IO monad. :(
11:16sdegutisHeh, I haven't gotten to IO or monads yet -- we'll see if that causes me to abandon it! ;)
11:17hyPiRionread http://blog.jle.im/entry/io-monad-considered-harmful before you dig into it
11:17sdegutislove the first paragraph :D
11:18sdegutishyPiRion: But I don't think it's prudent of me to read that until I first learn about monads in LyaH.
11:19hellofun`sdegutis: correct me if I'm wrong, but didn't you just start learning ocaml about a week ago?
11:19hyPiRionsdegutis: sure, just be aware that the "IO monad" might be referring to the IO type instead
11:19sdegutishellofun`: nope, only a few days ago
11:19sdegutishellofun`: I definitely didn't get far.
11:20hellofun`sdegutis: ok i thought so. while i admire your energetic survey of all these languages, i do think you'd have to use a language and understand its idioms for a while before passing judgements on what the langauge lacks, because usually there are hidden strengths to how it does things
11:20sdegutishellofun`: we'll have to agree to disagree on that in part
11:21Glenjamini think i agree with this io monad post
11:21hellofun`sdegutis: after all, your early desire to get OOP going in Clojure.. different languages have different thought processes
11:21sdegutishellofun`: "early"?
11:21Glenjaminrecently someone said deferred IO action to me - and it all clicked
11:22ToxicFroghyPiRion: so, the issue I have is that as soon as I want to do any sort of IO at all, I can no longer figure out how to appease the type checker
11:22hellofun`sdegutis: apologize if it sounds like criticism but i just think it's not always black/white to compare features between languages and you might find fascinating concepts if you give them a chance to be their own thing
11:23sdegutishellofun`: you most likely misunderstood my experiment due to lack of context -- I've been using Clojure for years, striving to learn and write very idiomatic code
11:23hellofun`sdegutis: oh ok.
11:23sdegutishellofun`: and while my opinions are flexible and mutable, I try to both learn idiomatic language features and pragmatic approaches and patterns before deviating in any way from idiomaticity
11:24sdegutisThat's not a word actually.
11:24GlenjaminToxicFrog: i like to think of the IO type as tagging my value as dirty, and to get back into clean code i need to shake off the IO part somehow
11:24ToxicFrogI keep wanting to learn Haskell and I keep bouncing off it.
11:24hellofun`i have a cousin who insisted a few years back that objective-c wasn't a real programming language. the reasoning was bonkers, so perhaps i am projecting that context i have into the discussion. he tried to compare it to a bunch of other languages, all of which have their own weaknesses.
11:24sdegutisToxicFrog: that happened to me about twice in the past 4 years ;)
11:24sdegutishellofun`: it's a terrible language, sure, but very real
11:25sdegutishellofun`: it's got many legitimate and permanent flaws that make Swift a great alternative
11:25hellofun`sdegutis: i don't know, it has a lot of cool features for a strong OO language
11:25hellofun`the rich OO and dynamic typing make it quite an odd one in and of itself.
11:25sdegutishellofun`: meh it really only has very few features, the rest is just stuff the standard library provides
11:26sdegutisGlenjamin: very good and helpful analogies so far, thanks for them
11:27sdegutisAnyway am I doing a good job being bitemyapp/callen in his absence?
11:27ToxicFroghyPiRion: now that I've read the whole thing, one issue seems to be "it's only when you want to sequence these [IO actions] that you need the monadic interface", but that's all the time
11:27clojurebotExcuse me?
11:28Pupnik_honestly I didn't find LYAH that helpful
11:28ToxicFrogI can't think of a single program I've written where I either (a) only needed to do one IO operation or (b) had to do a bunch but didn't care what order they happened in.
11:28GlenjaminToxicFrog: was that due to the structure of the solution, or the problem space?
11:28sdegutisToxicFrog: my window manager might count, I plan to port it soon enough
11:28Glenjaminfor example: consider implementing unix's sort
11:29Glenjaminor even grep
11:29Glenjamin99% of the program is not IO
11:29Glenjaminimplementation optimisations notwithstanding
11:29Pupnik_https://github.com/bitemyapp/learnhaskell good haskell resources
11:30ToxicFrogGlenjamin: right, but in the parts that are you often need some kind of ordering, or to use the results of one IO operation to decide what the next one should be
11:30ToxicFrogWhich means you need do
11:30ToxicFrogWhich means monads
11:30Glenjaminright, but only in that little bit
11:31ToxicFrogRight, but if you can't write that little bit, you don't have a working program!
11:31Glenjaminand as mentioned elsewhere, you can use data to describe the relationship between the actions, and have something else translate to IO
11:31hyPiRionToxicFrog: a >>= b is "take the dirty IO value from a, polish it, and give it as a "pure" argument to b which then returns an IO type"
11:31Glenjaminyeah, but if you just use do notation, it looks like normal imperative code - assuming you're not mixing in other, wackier monads
11:31ToxicFrogIn the comments the OP is also saying "you don't have to understand Functor or Applicative or Monad to use this, you just need to understand fmap, pure, bind, etc" but all of the explanations of what those do, how they work, and when to use them rely on understanding of Functor, Applicative, or Monad!
11:32hyPiRionhm
11:33hyPiRionToxicFrog: I tried to understand what they were by reading about them, gave up and just played with them until I understood what they actually were
11:33Glenjamini dunno (if (= x 1) y z) is pure, and you can just fmap that onto any IO Int (i forget the real haskell syntax)
11:33hyPiRion*are
11:33hyPiRionGlenjamin: if x = 1 then y else z
11:34ToxicFroghyPiRion: I like understanding things by reading about them, especially in a language like haskell where not understanding them means I can't even experiment in the REPL because the type checker will reject everything I enter with messages I don't understand.
11:34Glenjamini did nearly type that, but it seemed too psudeocodey
11:34hyPiRion*==
11:36ToxicFrogMaybe I'm just too used from Lua, Scala, and Clojure to being able to understand builtins by reading the reference documentation and source code for them.
11:40HijiriI just think of IO as composable programs
11:40ToxicFrogActually, question for the Haskellers in here, esp. Glenjamin and hyPiRion -- what's the deployment and GUI story like?
11:41ToxicFrogLike, with Clojure if I want to release a program 'lein uberjar' gives me a redistributable jar, and Seesaw gives me a native API for GUI programming. What are the Haskell equivalents?
11:41Glenjamini'm not a haskeller i'm afraid - i just did some ages ago and went to an talk relatively recently where the IO penny dropped :)
11:41HijiriHaskell is compled down, usually statically
11:41Glenjaminhttps://wiki.haskell.org/WxHaskell seems to exist, i dunno if wx is still popular
11:42ToxicFrogwx, the foremost test suite in C compiler error reporting~
11:46SagiCZ11under what circumstances does this throw Duplicate key: null exception?
11:46SagiCZ11(filter #(#{x y} %) coll)
11:47Bronsa,#{nil nil}
11:47clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: null>
11:47SagiCZ11Bronsa: oh
11:47Bronsa,(let [x nil y nil coll []] (filter #(#{x y} %) coll))
11:47clojurebot()
11:47Bronsa,(let [x nil y nil coll [1]] (filter #(#{x y} %) coll))
11:47clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: null>
11:47Bronsa^there
11:48SagiCZ11Bronsa: thank you
11:54clgvSagiCZ11: you know that you do not need to wrap the set into a function right?
11:54clgv,(filter #{2 5 9} (range 20))
11:54clojurebot(2 5 9)
11:55SagiCZ11clgv: yeah there was some more code in the function i just simplified it for the sake of this exampl
12:18pdohertyhas anyone had issues with lein repl ignoring keypresses on os x?
12:19pdohertyit refuses to let me enter "("
12:20crash_epToxicFrog: GHC-compiled Haskell apps are native binaries, so the only "deployment" is whatever it takes to get the binary onto a machine that can execute that architecture, and exposing it somehow to be executed.
12:20gfredericksanybody know if there's a way to customize leiningen to look for local profiles in a specific file of the project?
12:20gfredericksI think it supports /profiles.clj or something to that effect
12:22crash_epToxicFrog: I'm not sure about 100% pure Haskell GUI apps. My understanding is that some GUI developers write a thin GUI in another language/framework (e.g., Swift/Cocoa) and then call into a Haskell library to "do work".
12:22crash_epThough there are pure Haskell GUI bindings.
12:22ddima_gfredericks: yes, it can: https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md - ~/.lein/profiles and profiles.d/
12:22crash_ep(And then of course there are langauges like Elm)
12:23ddima_gfredericks: oh, misread your question
12:25ddima_gfredericks: maybe you can just symlink the file in question to project-profiles.clj
12:25gfredericksddima_: my goal is to not check this stuff into the project
12:26gfredericksbut gitignoring that file either in the project or globally seems unideal
12:26ddima_gfredericks: but then you could use the user-local profiles location maybe (and maybe additionally symlink)
12:26gfredericksthe what?
12:27ddima_well, ~/.lein/profiles.clj would be perfectly outside of your project, if you have clashing profile names for multiple projects, then maybe symlink to project location
12:27ddima_that would be my attempt at quickly getting this out of the way ;)
12:28gfredericksbut ~/.lein/profiles.clj is global, I'm thinking for project-specific stuff
12:31gfredericksI'll probably just monkeypatch leiningen.core.project/project-profiles
12:31ddima_hm, thought one could solve it with custom profile names, but well. then I guess .gitignore is the way to go, its also the way i've seen it done with almost any build system if "global" (user-wide) settings are not appropriate :/
12:34ddima_for some project I also had some small script set up to switch ~/.m2 to a project specific location, but thats not too much fun
12:36justin_smithddima_: wait, why would you need that? two different versions with the same pom?
12:38gfredericksI was hoping I could monkeypatch leiningen from my user profile but I suppose at that point it might be too late to affect profile lookup behavior
12:38gfredericksHMMMM.
12:38ddima_justin_smith: well, if was actually the settings.xml with different corporate repos/passwords, so I kept to repo/ but needed different * mirrors
12:39gfredericksit will probably turn out this is only possible with env variables
12:39justin_smithddima_: ahh, OK
12:39ddima_justin_smith: but not really worth discussing, I have not invested much time figuring out if theres a cleaner way, I just needed it to work quickly ;)
12:39muhuk__I'm trying to make sense of indentation customization of cljfmt.
12:40muhuk__It says "You can also customize the indentation rules cljfmt uses.", but where do we put that map?
12:42justin_smithmuhuk__: https://github.com/weavejester/cljfmt#configuration
12:43muhuk__justin_smith: that's where I was quoting from
12:43justin_smith"You can configure lein-cljfmt by adding a :cljfmt map to your project:"
12:43justin_smithit goes in your project.clj
12:44muhuk__justin_smith: keep reading
12:44justin_smithI read it, what's your question?
12:44csd_Can any of you recommend a resource for learning to write a threaded server application?
12:45muhuk__justin_smith: where do we put the map where we specify :inner & :block?
12:45justin_smithmuhuk__: in your project.clj, you add a key :cljfmt and a map of options
12:45muhuk__justin_smith: like this https://github.com/weavejester/cljfmt/blob/master/cljfmt/resources/cljfmt/indents/clojure.edn
12:45justin_smiththe key will be :cljfmt, and it should be followed by that map
12:45justin_smithin project.clj
12:46justin_smithdo you understand how project.clj works?
12:46muhuk__justin_smith: so these symbol keys are mixed with the keyword ones? (:insert-missing-whitespace? etc.)
12:47justin_smithas far as I know, yes.
12:48justin_smithmuhuk__: alternately, you could try shadowing resources/cljfmt/indents/clojure.edn within your own project
12:49justin_smithif the former does not work
12:49muhuk__justin_smith: I'm trying to make 'checker behave line 'defn
12:49muhuk__justin_smith: :cljfmt {checker [[:inner 0]]} doesn't work
12:50justin_smithOK
12:50muhuk__justin_smith: also tried with 1 instead of 0
12:50muhuk__justin_smith: also tried 'checker instead of checker
12:50justin_smithsometimes weavejester is around, but it appears he is not here now
12:50muhuk__still doesn't use 2 spaces
12:50justin_smithtry creating your own copy of resources/cljfmt/indents/clojure.edn
12:51justin_smithwhich should be a modified copy of the version in the original project
12:51justin_smiththat's the only other way I could see that being customized
12:51muhuk__justin_smith: thanks, but no thanks
12:52muhuk__I still expect these overrides to be under some keyword and not mixed with the other stuff.
12:54justin_smithmuhuk__: AHA - reading the source, it looks for an :indents key
12:54justin_smithhttps://github.com/weavejester/cljfmt/blob/master/cljfmt/src/cljfmt/core.clj#L167
12:54justin_smiththat's totally missing from the readme
12:55justin_smithshould have just read the source in the first place, my apologies
12:55muhuk__justin_smith: why, thanks for your help
12:55muhuk__justin_smith: I was trying to find something in the lein plugin src
12:56justin_smithmuhuk__: so, based on the source :cljfmt {:indents {...}} should be your option
12:56hyPiRionToxicFrog: Deployment is rather easy with Cabal, but may take some time. Not done any GUI apps, but web apps are apparently alright
12:56R0B_RODHi
12:57muhuk__justin_smith: indeed it worked
12:57muhuk__justin_smith: thanks!
12:57justin_smithawesome, do you want to make that pr against the readme, or should I?
13:03Jahkeup_Is anyone having/had issues bringing up cider repl in Emacs?
13:03Jahkeup_I can connect but the repl doens't seem to open or connect
13:06justin_smithJahkeup_: did you do a version upgrade recently?
13:06Jahkeup_today, I use quelpa to fetch HEAD
13:06Jahkeup_I was having the ns problem so I updated
13:06justin_smithyou probably need to delete all your relevant elc files, and then restart emacs
13:07justin_smiththis is a common issue with cider version upgrades
13:07Jahkeup_I did restart, but haven't removed the .elc..one sec ;)
13:07justin_smithyeah, you can end up with invalid compiled code very easily after an upgrade
13:09Jahkeup_justin_smith: I removed all versions of cider I had and reinstalled, its working
13:09Jahkeup_justin_smith: thanks a bunch!
13:10justin_smithJahkeup_: np
13:10SagiCZ11uberjar creates two jars.. one is standalone and the other not.. whats the diffrence?
13:11justin_smithSagiCZ11: the standalone is the actual uberjar
13:11SagiCZ11its so big though
13:11martinklepschwhen specifying a plugin dep in leiningen is that loaded as transitive dep when I'm using the lib: https://github.com/DomKM/silk/blob/master/project.clj#L24
13:11justin_smithSagiCZ11: yes, it has to contain all the code of all of your dependencies
13:11justin_smithso it will be big if you have a lot of deps
13:12tcrayford____(for the reference, Yeller's is 82MB)
13:12SagiCZ11justin_smith: i am using incanter so i guess it is a big dependency.. is there a way to just depend on a small part of that library?
13:12justin_smithSagiCZ11: not that I know of - you could try making your own stripped down fork with only the parts you use?
13:12justin_smithI bet its license would allow that
13:12SagiCZ11justin_smith: ok thanks.. not worth, let the bandwidth suffer
13:14muhuk__justin_smith: what I was talking about: https://github.com/weavejester/cljfmt/issues/4
13:14justin_smithmuhuk__: interesting. I left this PR btw https://github.com/weavejester/cljfmt/pull/9
13:15muhuk__justin_smith: yeah, I saw that.
13:16muhuk__justin_smith: exciting lib/plugin, I'll definitely give it a try later
13:16DomKMmartinklepsch: Hmm, yeah it looks like is being pulled in https://clojars.org/com.domkm/silk
13:16DomKMmartinklepsch: None of the other plugins are. I'm not sure why cljx is.
13:19martinklepschDomKM: maybe try adding something like :scope "test"? I don't really know whats going on there so thats really an out-of-the-blue guess
13:20DomKMmartinklepsch: Are you able to add cljx to exclusions for now?
13:21martinklepschDomKM: it's not an issue for me, I just was surprised to see that happening
13:23DomKMmartinklepsch: Cool, sorry about that. I'll look into it.
13:36papachanhi i am trying to use joda-time to get year-s date
13:36papachanbut cannot get string format
13:36papachanalways have a date object
13:38justin_smithpapachan: so you want to get the date as a string?
13:38papachani am trying this:
13:39papachana basic example: http://paste.awesom.eu/raw/papachan/BLnr
13:40R0B_RODNon-programmer here learning computer science (self-study)
13:40justin_smithpapachan: that will print the value of our-formatter followed by now
13:40justin_smithpapachan: you need to use joda/unparse
13:40papachanah
13:40justin_smith(if clj-time.format is mapped to joda)
13:42justin_smithadmittedly, "unparse" is a weird name for format
13:42papachanjoda/print is not equivalent?
13:43papachanor joda/parse-date-time
13:43justin_smithwell, the parse functions take a string and give you a date-time thing
13:43justin_smithI had assumed print in your paste was clojure.core/print
13:47TimMcjustin_smith: <3 unparse (as a name)
13:47AtarianIs there any way to save the changes you make in the REPL back to the source, or do you just copy and paste it back into emacs?
13:48TimMcI'd never thought of unformat but I like it now.
13:48justin_smithhaha
13:48justin_smith(def undivide *)
13:48justin_smith(def unmultiply /)
13:50justin_smithAtarian: another option is to write your definitions in the source file and use C-M-x to send those definitions to the repl
13:51Atarianjustin_smith: That's what I've been doing, it just seems too similar to the edit/compile
13:51Atarianthen swear cycle of C
13:51Atarian:D
13:51justin_smithAtarian: M-h / M-w makes it easy to select and copy a balanced form all the way out to the top level
13:52llasramAtarian: Are you not using CIDER?
13:52justin_smith(M-h selects the whole form out to the top level, M-w copies the selection)
13:52AtarianYes, I'm using Cider - I tend to use C-k to update the REPL
13:53Glenjamini've found it tricky to balance writing code in the editor for saving, with interacting with that code quickly in the repl to try it out
13:53AtarianI wasn't familiar with M-w/M-h, I'll have a play with those thanks
13:54AtarianGlenjamin: Me too, that's why I thought I might be missing something
13:54Glenjaminlike, i'll send a defn to the repl
13:54Glenjaminthen call it a bit
13:55Glenjaminmaybe try some snippets
13:55Glenjaminit feels weird to write the calls/snippets in the editor, but if i do them in the repl its slightly more work to get them back into the editor
13:56AtarianGlenjamin: Yeah, the REPL seems to have more potential than what I'm using it for
13:56AtarianIf that makes sense
14:23sgg-Hey, all. I'm going through the Seven Concurrency Models book and am a little hung up on the section dealing with reducers and protocols. I can't figure out how to determine which function gets called in a reify block. More specifically, why the three-arity gets called instead of the two-arity here: https://www.refheap.com/0b0d107ef29973a54fae68ad9
14:26amalloysgg-: have you looked at the source for into?
14:26amalloy$source into
14:26lazybotinto is http://is.gd/caQYZB
14:26amalloyspecifically https://github.com/clojure/clojure/blob/clojure-1.7.0-alpha1/src/clj/clojure/core.clj#L6471 which reads (reduce conj to from)
14:29sgg-ha, that explains it. I was looking at the protocols source and was just baffled.
14:39hiredmanis there a clojure library for printin trees / graphs as ascii art?
14:42amalloyhiredman: you need ascii art, can't use eg rhizome?
14:44hiredmanI dunno, I am just sort of brain storming about this thing I want, part of which will be a randomly generated tree, and it would be nice to print it out
14:44lgrapenthinhiredman: may want to try this https://github.com/drcode/vijual
14:44hiredmanI was thinking a console type thing, but I guess I might as well give it a web interface
14:45lgrapenthinsome example screenshots here http://lisperati.com/vijual/
14:45hiredmanthat name kind of hurts me
14:45hiredmanI mean, that is neat
14:46hiredmanthat does look exactly like what I was looking for though
14:46lgrapenthinit seems pretty unmaintained. would love to hear about your experience with it.
14:48amalloywow, that project.clj is like a time capsule
14:49hiredmanoh, gplv3, that may be a hard sell
14:54lgrapenthinmaybe you can take it as inspiration for a lgpl3 based project?
14:55lgrapenthinhiredman: or Conrad might be willing to release it under lgpl3
14:56hiredmancould be, I am just sort thinking for the future
14:58arohnerare there any good libraries for working w/ BDB?
15:01justin_smithhttp://www.oracle.com/technetwork/database/berkeleydb/overview/index-093405.html this bdb?
15:06arohnerjustin_smith: yeah
15:07arohnerI'm still evaluating options though
15:07arohnerlooking for an embedded DB that can store somewhat arbitrary clojure maps
15:07justin_smiththe licensing on that seems a bit onerous, I would expect that to reduce the chances that there is any clojure specific wrapper or util lib
15:07arohnerso I'm hesitant to use SQL
15:07arohnermapdb is looking good
15:08justin_smithdatomic is good at that :)
15:08arohnerjustin_smith: this doesn't seem that onerous? http://www.oracle.com/technetwork/database/berkeleydb/downloads/jeoslicense-086837.html
15:08arohnerdatomic doesn't support embedded operation
15:10justin_smitharohner: interesting, maybe I was finding out of date info about bdb licensing
15:10arohneryeah, I think a lot of the (reasonable) FUD came about after Oracle acquired SleepyCat, and then oracle didn't release any info about what they were going to do, so people got paranoid
15:11gzmaskheya folks, if I use (take x (repeat (chan))) to generate x channels, are they x different channels, or are they x same channels? what if I do (for [a (range x)] (chan))?
15:11justin_smithgzmask: (repeat (chan)) returns the same chan over and over
15:11justin_smithtry (repeatedly chan)
15:12justin_smith,(take 10 (repeatedly rand))
15:12gzmaskah, thanks ... how about the for version?
15:12clojurebot(0.3777431544040436 0.8949146539323458 0.6030477173980103 0.13408026637948045 0.9454645144975672 ...)
15:12hiredman,(doc repeatedly)
15:12clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
15:12justin_smithgzmask: it would work, but I think (take x (repeatedly chan)) is much clearer
15:13justin_smiththat's like, precisely the use case repeatedly was designed for
15:16justin_smithoh, of course (repeatedly n chan) would be even better (thanks for making me look at the doc string again)
15:16justin_smith(inc hiredman)
15:16lazybot⇒ 67
15:22moquistreiddraper: Right now I'm using 'fmap to truncate items (strings, vectors, etc.) that are too large, but I assume 'clojure.test.check.generators is doing lots of work generating larger things that I then butcher. Is there a way to tell the generators something about the target size range?
15:23moquistreiddraper: I looked at all the 'size' related things, but it all seemed to be related to shrinking, and not user-specified target sizes. Maybe I'm missing something that should have been obvious...
15:24muhukWhat's the most succinct way to do: (fn [f x _] (f x)) ?
15:24muhuk#(f %) throw arity error, since outer function is called with 2 params.
15:25Bronsa#(% (do %& %2))
15:25justin_smithmuhuk: wouldn't you want #(% %2) anyway?
15:25justin_smith(inc Bronsa)
15:25lazybot⇒ 88
15:26muhukjustin_smith: you are right. Anonymous function is closing over f, my first form should've been: (fn [x _] (f x))
15:26Bronsamuhuk: then #(f (do %& %))
15:27amalloymuhuk: why is most-succinct important?
15:27reiddrapermoquist: sizing is related to generation as much as shrinking, for many generators its use to cap the size of a collection, or at least serve as a linear-correlation to size, so i'd recommend defining a max-size function, something like: (defn max-size [g n] (gen/sized (fn [s] (gen/resize (min s n) g))))
15:28muhukBronsa: ha! I didn't know about %&, neat
15:28muhukamalloy: better than verbose
15:29llasrammuhuk: I think what you had to start with is more legible; much more clearly describes your intent
15:29amalloymuhuk: #(f (do %& %)) is atrociously unreadable. just use a (fn ...)
15:29amalloydensity is not the utmost goal
15:30muhukamalloy: yes, I'll go with the fn one
15:30moquistreiddraper: OK. Sounds like I just didn't grok it and need to re-read the code. Thanks for the fn suggestion; I'll try it out.
15:31gfredericksmoquist: reiddraper: I think I have a cap-size in test.chuck
15:31moquistreiddraper: The more I think about that, the more it makes sense... shrinking involves targeting generation sizes, so... yeah. I should've realized.
15:32moquistgfredericks: cool. I will check that right now. :)
15:34reiddrapergfredericks: yeah cap-size is probably what you want, and actually, shrinking doens't adjust the size parameter, it's a separate process
15:34reiddrapercc moquist ^
15:34gfredericksI was wondering about that
15:34moquistreiddraper: [nod]
15:34samiswellcoolI've tried writing a macro (my first) but have hit a bit of a wall...http://pastebin.com/YJ2td5EC
15:35gfrederickssamiswellcool: you want ` instead of '
15:35justin_smithsamiswellcool: ~ needs to be inside `
15:35amalloysamiswellcool: also why is this a macro instead of a function
15:36samiswellcoolI've tried to write a macro (my first) and have run into a bit of a wall... my code: http://pastebin.com/YJ2td5EC
15:37samiswellcoolah
15:37eriktjacobsenI think I’m going to print “Why is this a macro instead of a function” out and frame it near my desk
15:37samiswellcoolmy connection is bad so apologies for posting that twice haha
15:37samiswellcoolI'm not sure - I'm really trying to figure out where I'd write a macro for
15:38muhuksamiswellcool: perhaps quote with ` instead of '
15:38gfrederickssamiswellcool: there's nothing wrong with not writing any macros
15:38samiswellcoolbut I wanted to write (tile :name "name" :property 5 ...) rather than (tile {:name "name" :property 5}) just to give it a go
15:38justin_smithsamiswellcool: macros are good for when you need to create a unique syntax (or wrap / parameterize another macro)
15:39muhuksamiswellcool: when you call tile in some other namespace, it's trying to find a tile-validate in that ns, instead of what tile-validate refers to in tile's ns.
15:39samiswellcoolgfredericks: I guess there's nowhere that I've seen that explains what they're useful for, mainly just places going 'woah, macros are so powerful'
15:39justin_smithmuhuk: more fundamentally, ~ is illegal outside of `
15:40samiswellcoolah, I'll probably revise that decision then
15:40muhukjustin_smith: eh, I didn't see ' is quoting the list, not the symbol. right
15:41gfrederickssamiswellcool: http://www.infoq.com/presentations/macros-clojure-west-2013
15:41samiswellcoolcheers, I'll give that a watch
15:43muhukAtomEditableWorld here https://github.com/muhuk/clecs/blob/master/src/clecs/backend/atom_world/editable_world.clj When I delegate like this, it's quite convenient when testing with Midje. You can't mock protocol methods, but you can fn's. Do you guys think this is *weird* code like this?
15:44samiswellcooland for now I've removed the macro and I'll just deal with passing a hash-map
15:44muhukI'm considering inlining them.
15:44samiswellcooland suddenly my tests pass :)
15:44samiswellcoolthanks guys
15:58timvisheris there a function that lets me filter a map for values/keys that pass a predicate that returns the filtered map rather than a seq?
15:58timvisheri'm aware i can easily write one but i have some vague memory of a function like that but i can't find it
15:58justin_smithtimvisher: seems you could do it with reduce-kv
15:59timvisherjustin_smith: that's just about it. :)
15:59timvisherthanks
15:59justin_smiththat would work by associating the keys you want, rather than filtering of course
15:59R0B_RODHello justin_smith :>
15:59justin_smithbut should be pretty straightforward
15:59justin_smithR0B_ROD: hello
16:02timvisherso all that reduce-kv wins you is the avoidance of a single destructure…
16:03timvisher`(fn [acc k v]…)` vs `(fn [acc [k v]]…)`
16:03nic77what are you making?
16:03tbaldridgeand the allocation of a structure to hold the kv pair
16:03tbaldridgeso it's probably a tad faster
16:06timvishernic77: i'm trying to write a graph traversal that's some approximation of A*. so i'm keeping my shortest known path from start to n in a map which is {[start n] shortest-known-path}. i'm then calculating the path from start to n' (a neighbor of n) by conjing on to the shortest known path [start n]. i'd then like to merge the new paths from n to n' but only if the new path is shorter than the current shortest path
16:08timvisherso i calculate the new-path from n to n' and shove it all in a map {n' new-path}, and then i'd like to filter that map so that the paths that are longer than the current known shortest path are removed, and thus can i can just (merge known-shortest-paths new-paths)
16:08timvisherwhich might all be the wrong approach. this is the first time i'm working with graph data structures directly at all so… :)
16:09timvishertbaldridge: i did think i noticed that
16:10justin_smithtimvisher: you could consider using an adjacency list (not that it is hugely different from what you describe, but it is a well researched and documented graph representation that is friendly to immutable datatypes)
16:10nic77ok i dont know what all of that means yet but thankyou its gonna help someday
16:11justin_smith:)
16:11nic77whats it for essentially
16:11justin_smithnic77: you can learn a lot just by looking at the wikipedia pages for things people mention here - A* is quite well described
16:11nic77yeah i like wikipedia
16:12justin_smithnic77: A* is a graph algorithm for finding paths, it is used for monster movement in video games if the monster should be chasing the player, for example
16:13nic77theres not enough time or neurotransmitters for wikipedia the way i do it
16:13timvisherjustin_smith: interesting. it looks like i accidentally stumbled on guido's suggested implementation of this. my graph is represented as {n1 [n1'…] n2 [n2'…]}
16:14nic77interesting, monster movements
16:14justin_smithtimvisher: as in the python guy?
16:14timvisherand in this case, distance is a constant so i don't need to worry about that in the equation
16:14timvisherjustin_smith: indeed
16:14celwellHi, regarding Compojure routes, how can I get both the uri segment and the entire POST body? How should I modify this: (POST "/reset-password/:key" {body :body}
16:14timvishereffort to traverse an edge is always 1
16:14nic77distance is a constant whats that saying
16:15nic77you dont have to set one?
16:15timvishernic77: so in generalized graph theory (as i understand it), edges can either be constant or they can have weight
16:15justin_smithtimvisher: yeah, the assoc of node to an array of adjacents is a natural choice I think :) It is good to know the name of the representation and know it is well researched
16:15timvisherso two nodes can be connected by an edge, and in the case of an unweighted graph you treat the edge as free
16:16justin_smithnic77: for a concrete example: what if one part of the area had a swamp (slow locomotion) and another was a paved path (fast locomotion) - that would effect what turns out to be the fastest route
16:16timvisherin the case of a weighted graph however, the edge can be of varying weights, and thus it has to come into play in your calculations as for as what the shortest path is
16:16timvishernic77: lol. what justin_smith said :)
16:16nic77oh sweet generalized graph theory, its got a name and all.
16:17justin_smithnic77: it's a huge and fascinating subject
16:17timvishernic77: i enjoyed reading this http://theory.stanford.edu/~amitp/GameProgramming/index.html
16:17nic77ok,
16:17nic77weights? thats another explanation?
16:17nic77like a theory lol
16:18nic77cool, i dont want to pester too long i got some stuff to look at now thanks :D
16:18justin_smiththey use "weight" as the generic name for the cost of each node - since there are many problems solvable with the same algorithm
16:18hiredmantimvisher: have you looked at loom?
16:18nic77hmm
16:19nic77this is gonna be great
16:19timvisherso in the interest of my own brain i'm simplifying a* (i think) because my own problem is constrained in relation to the general problem of shortest-path graph traversal
16:19timvisherhiredman: nope.
16:19timvisher$google loom
16:19lazybot[Loom - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Loom
16:19nic77im gonna go from one tab to the next and run out of memor
16:19timvisher$google loom clojure
16:19lazybot[aysylu/loom · GitHub] https://github.com/aysylu/loom
16:20hiredmanloom is a graph library, the default graph implementation it has sounds similar to yours, and it has an A* implementation
16:20hiredmanhttps://github.com/aysylu/loom
16:21timvisherhiredman: ooo! that looks cool. all the other ones i found were jvm implementations and i'm on clojurescript here
16:21nic77like the time i looked at some element and it informed me of a thing that required me to learn another thing to understand it
16:21nic77then the next thing was the same way, i had to learn another thing to understand it
16:21justin_smithnice, I had forgotten about loom, and I think it might help me solve this issue that has had me stumped for a little while...
16:22hiredmanah, that still may require some porting work (I dunno if loom works in clojurescript)
16:22nic77untill the end of it all i knew everything there was to know about everything
16:22timvishernic77: just push onto the stack ;)
16:22nic77then i went to bed, and heres today
16:22justin_smithnic77: pre-requisites will happen - but once you master a sufficient percentage amazing things can start to happen
16:22nic77yeah, its not daunting at all
16:22timvisherhiredman: not seeing anything so far that explicitly reaches for the jvm
16:22nic77not my first mountain climb hehe
16:22timvisherbah!
16:23timvisherexcept they use clojure.data.priority-map
16:23timvisherhrm…
16:23tbaldridgeport it!
16:23{blake}I'm loading in two csses (hiccup.page/include-css), bootstrap and a custom one. When I load bootstrap, the response header contains a content-type while the local css does not.
16:23timvisherwell, back to square one then :)
16:23timvishertbaldridge: but but but, there's _so much jvm_ in clojure.data.priority-map!
16:23tbaldridge:-D
16:23celwellHi, regarding Compojure routes, how can I get both
16:23celwell the uri segment and the entire POST body? How
16:23celwell should I modify this: (POST "/reset-password/:key"
16:23celwell {body :body}
16:24timvisheri mean yeah, closure's got goog.structs.PriorityQueue but…
16:27{blake}celwell: I don't know but I usually put in some middleware and dump the entire request to figure that stuff out.
16:30timvishertbaldridge: so what's the deal with porting clojure libraries at this point between clj and cljs?
16:30timvisheris cljx still the state of the art?
16:30timvisherthis is twice now that i've not been able to do something because priority-map isn't in on cljs
16:30timvisherit'd be nice to rectify that
16:32timvisherdoes mark engelberg hang out in here?
16:32nic77that sounds familier whos that
16:33arohnerinstaparse guy
16:34timvishernic77: he's implemented a bunch of stuff, but he's i believe the maintainer of priority-map
16:34nic77how the hell did i hear about him i wonder :|
16:36{blake}OK, none of my local js comes back with a "Content-type" tag either. Remote jquery, bootstrap both have the appropritae content-type settings, but local ones do not. I don't even get how that's possible.
16:37{blake}Unless the response is coming from the remote server rather than ring.
16:40moquistreiddraper, gfredericks: My tests are faster now. A 14x improvement. Thanks!
16:45{blake}Aaand that's the answer. It's always middleware. That's my new motto.
16:50cflemingtimvisher: I believe (but would be happy to be corrected) that cljx cannot be used for core libraries, since it's a non-core dependency.
16:57atratussoo if I build clojurescript locally does it automatically configure itself with leiningen?
16:58texydot
17:01dnolenatratus: if you install locally into your Maven uses pom.xml, for boostrapping it uses some bash scripts
17:01amalloytimvisher: i don't think mark hangs out in irc. i've seen him once or twice maybe, but not regularly
17:06atratusahh i needed to up my version in the project.clj. TY
17:06groux!
17:06levabalkinhi, I use a startup/user.clj file in a lein project to declare a function to reload the project (using clojure.tools.namespace). After reload I loose the function doc from the repl. How can I keep the original repl env everytime after reloading my project ?
17:07justin_smithlevabalkin: to get doc back (among other useful functions) you can run (use 'clojure.repl)
17:08levabalkinjustin_smith: can I automate that from my reload function ?
17:08justin_smithI assume tools.namespace is resetting the ns thouroghly, so you lose the implicit usage of clojure.repl for your starting ns in the repl
17:08justin_smithlevabalkin: well, you can add that call to be run while inside the ns being redefined I guess?
17:09justin_smithI'm not sure of the finer details of how it's being reloaded
17:09gfredericksyet another reason to use lein-shorthand instead of preparing a special repl namespace
17:11levabalkinjustin_smith: it works by calling (use 'clojure.repl) after ns reload, thanks
17:11stuartsierralevabalkin: You can add :require [clojure.repl :refer [doc]] to the 'ns' declaration of your user namespace.
17:12dsbCan anyone tell me why this doesn't work? http://pastebin.com/AgUnBceL
17:12stuartsierraUsually clojure.repl gets referred in by whatever launches your REPL, but tools.namespace will remove those on reload.
17:12stuartsierraE.g. clojure.main does it https://github.com/clojure/clojure/blob/05af4b52a474bc60d2eb931e388b302c14edc884/src/clj/clojure/main.clj#L162
17:13dsbIt's telling me n is not a namespace and the app won't run :/
17:13justin_smithdsb: so you would expect (show 'foo) to run (display-module foo/info) ?
17:13justin_smithyeah, namespaces don't work that way
17:15justin_smithdsb: maybe something like this ##(get (.getMappings (find-ns 'clojure.core)) '+)
17:15lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Namespace is bad!
17:15justin_smith:P well it works in a real repl
17:16elarsondoes anyone know if circle ci supports badges like travis?
17:16amalloyjustin_smith: notice you just looked up a symbol in a map, like you were saying yesterday nobody does
17:16dsbjustin_smith: when I call (display-module foo/info) with foo being the namespace name it works
17:16justin_smithamalloy: indeed! good point
17:16amalloy('+ (.getMappings (find-ns 'clojure.core)))
17:17justin_smithdsb: yeah, because x/y is a reader thing
17:17justin_smithdsb: putting a variable in place of x is different, and will fail
17:17justin_smithso you need to manually do the lookup
17:17dsbah makes sense
17:18dsbthanks
17:19justin_smith,('+ (ns-publics 'clojure.core))
17:19clojurebot#'clojure.core/+
17:19justin_smithdsb: that's probably the best way to do it ^
17:21stuartsierra(resolve-ns (the-ns 'clojure.core) 'conj)
17:21stuartsierra,(resolve-ns (the-ns 'clojure.core) 'conj)
17:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: resolve-ns in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:21stuartsierra,(ns-resolve (the-ns 'clojure.core) 'conj)
17:21clojurebot#'clojure.core/conj
17:21stuartsierrathere we go
17:21justin_smithahh, that's a good way too
17:37kaiyinhttps://gist.github.com/kindlychung/1b71b14e61ceed2ec869
17:38kaiyinsorry, wrong channel.
17:38amalloyholy cow kaiyin, ====? what language is this?
17:39kaiyinjava.
17:39amalloywell it looked like java, but java doesn't have a ==== operator
17:39kaiyinok. then it must be a typo in this book.
17:39gfredericks,(defn ==== [x y] (and (= x y) (identical? x y) (== x y) (= (str x) (str y))))
17:39clojurebot#'sandbox/====
17:40gfredericks,(==== 42 42)
17:40clojurebottrue
17:40kaiyingfredericks: very cool. :-)
17:40gfredericks,(==== 42.0 42.0)
17:40clojurebotfalse
17:40gfredericks^ protip
17:40stuartsierra,(==== nil nil)
17:40clojurebot#<NullPointerException java.lang.NullPointerException>
17:40stuartsierraheh
17:41gfredericksseems poetically appropriate somehow
17:42kaiyingfredericks: care to introduce this in clojure 1.7?
17:45mikerodwhen doing something like `(reduce-kv (fn [m k v] (assoc m (something k) (something v)) {} my-associative)`
17:45mikerodshould you use a (transient {}) as the seed
17:45mikerodor does reduce-kv already do this efficiently
17:45thiagowfxwhy it is false? Round error?
17:46justin_smiththiagowfx: they are not identical? because they are not the same object
17:46justin_smiththey are two different boxed doubles
17:46amalloyjustin_smith: rather, two boxes around the same double
17:46mikerodI missed a paren too
17:46justin_smithamalloy: aha, thanks
17:46mikerodI meant `(reduce-kv (fn [m k v] (assoc m (something k) (something v))) {} my-associative)`
17:47justin_smithmikerod: I don't think it would be able to automatically insert a transient for you
17:47gfredericksI was reading about doubles last night and was surprised they were more complicated than I was expecting; I probably shouldn't have been
17:47thiagowfxjustin_smith: ...this implies that 42 and 42 are the same object. Does clojure cache small integers, like python? (newbie here)
17:48amalloythiagowfx: yes
17:48amalloywell, java does. but i don't think it *promises* to - it's just an implementation detail
17:48mikerodjustin_smith: oh yeah, then your reduce-step fn would have to be transient awar
17:48mikerodThat was a dumb question then I think :P
17:48den1kgenerating mock db result map using test.check. Randomness is great, however I need unique vals as ids. How?
17:48amalloyeg, (identical? 42 (Long. 42)) is false, because you're explicitly making a new box
17:50gfredericksden1k: I've actually done okay just relying on a huge ID-space, combined with no-shrink
17:50gfredericksden1k: another option that could work for you is fmapping with distinct-by
17:50gfredericksi.e., you just delete things with duplicate ids
17:51den1k@gfredericks okay, I will do that. Thanks!
17:51gfredericksdistinct-by can be had via prismatic/plumbing
17:51gfredericksand elsewheres I'm sure
17:53den1kcool
18:27tomjack_I'm guessing #? can't be implemented as a tagged literal, say in the style `#?[:clj foo :cljs bar]` ?
18:28justin_smithtomjack_: why wouldn't that be possible?
18:28amalloywell tagged literals can't return 0 forms, or multiple forms
18:28tomjack_that's basically my question
18:28tomjack_ah
18:40justin_smithtomjack_: ahh, so you meant a particular implementation of #?, not just #? as a valid tag for a tagged reader in general
18:40justin_smithnever mind then
18:44tomjack_I meant #? as in read-cond
18:46tomjack_I guess you don't need to return multiple forms?
18:46tomjack_but zero, in case no features match
18:47tomjack_oh and there's #?@
18:47tomjack_ok, thanks :)
19:20alandiperttomjack_, thanks for the expansion-passing style paper btw, read and enjoyed
19:21tomjack_I'm still not sure whether it's relevant
19:27timvishercfleming: so is there any way to have a dual targeting library in core at this point?
19:27timvisheri suppose there's core.async but they're two completely separate implementations?
19:28hiredmantimvisher: outside of clojure core people can use cljx
19:28hiredmaninside of clojure core it seems like a pain to use anything outside of clojure core
19:30hiredmanhttps://www.youtube.com/watch?v=Ah9p8cqkTOg chas gave a talk about it
19:30timvisher(inc cemerick)
19:30lazybot⇒ 17
19:33timvisherhiredman: is there a blog post version of that anywhere?
19:33hiredmanno idea
19:43retrogradeorbithi there peeps, I need help with advanced compilation
19:43retrogradeorbitIm using audio, and including the w3c_audio.js externs from here: http://closureplease.com/externs/
19:44retrogradeorbitand "AudioContext" is not munged
19:44retrogradeorbitbut... .decodeAudioData is
19:44retrogradeorbiteven though its defined on the object as a function in the externs!
19:44retrogradeorbitexample code is suuuper simple
19:44retrogradeorbit(def audio-context (js/AudioContext.))
19:44retrogradeorbit(.decodeAudioData audio-context "data" #(println %))
19:45retrogradeorbitcompiles to:
19:45retrogradeorbit;var zv = new AudioContext;
19:45retrogradeorbitzv.Rd("data", function(a) { return fo.c(mh([a], 0));
19:45retrogradeorbit});
19:45retrogradeorbitzv.Rd is wrong
19:46retrogradeorbitit should be zv.decodeAudioData
19:46retrogradeorbitany ideas why the externs file is only HALF working?
19:48hiredmanretrogradeorbit: my guess is you are not passing the right number of arguments
19:48hiredmanbut I dunno
19:49retrogradeorbitok so google closure compiler is aware of arity?
19:49retrogradeorbitlet me check
19:49hiredmanI don't do much clojurescript, and have never had resounding success fighting with externs
19:49retrogradeorbitah it does have wrong arity.
19:49retrogradeorbitlet me try
19:50retrogradeorbitnope. didn't work
19:51retrogradeorbitI mean its wierd, cause without the w3c_audio externs, AudioCOntext is munged
19:51retrogradeorbitso the externs is working
19:51retrogradeorbitbut only partly
20:12dnolenretrogradeorbit: this might be a Closure type inference issue?
20:12dnolenretrogradeorbit: what happens if you do that in a let binding or inside of a function?
20:13dnolenretrogradeorbit: Closure needs a type annotation when at the top level it might be easy place for us to help out
20:13dnolenretrogradeorbit: also probably something us to support via type hints
20:13dnolen"If Closure needs a type annotation"
21:12devnHalp!
21:12devnI upgraded cider and cider-jack-in is broken for me
21:12devnIt seems to connect successfully
21:12devnbut the interaction buffer is missing
21:13justin_smithdevn: did you delete all the elc files and restart? someone else had the same problem today and that fixed it
21:13devnlemme try that
21:14devn:(
21:14devnerror in process filter: let: Symbol's function definition is void: clojure-mode-variables
21:14devnerror in process filter: Symbol's function definition is void: clojure-mode-variables
21:14devnmaybe my clojure-mode is out of date
21:15justin_smithcouldn't hurt to update that too
21:15devnand company, hey -- why not?! :)
21:18devnjustin_smith: well, it works now
21:18justin_smithcool
21:18devnbut i keep getting this message that "the follow required nREPL ops are not supported: apropos classpath complete eldoc ..........."
21:18devn"please install or update cider-nrepl 0.9.0-SNAPSHOT
21:19devnbut AFAICT im on latest
21:20justin_smithdevn: maybe you need to force the snapshot update?
21:25dnolenjust released Om 0.8.7 w/ new cljsjs.react dep
21:25devnjustin_smith: i didn't have a 0.9.0-SNAPSHOT before this, so it definitely got pulled
21:25devndnolen: nice!
21:26gfredericks,(set! *allow-unresolved-vars* true)
21:26clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *allow-unresolved-vars* with set>
21:26devn,*clojure-version*
21:26clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
21:40munderwoHi all. I have a number of concurrent threads that all accept events, I would like to be able to get an ordering of which events happen, so I can tag them and later reconstruct the ordering, I think like a vector clock. I just need an incrementing integer really. Should I be using atoms or agents or refs for this? or something else?
21:41stuartsierramunderwo: An atom should be sufficient, or a java.util.concurrent.atomic.AtomicLong if you want.
21:42munderwoso I should just be able to do (swap! atom inc)? I thought that might be able to do it, but wasnt sure if I was mixing up atoms an agents
21:43rhg135munderwo, ya that'll work
21:43munderwoIs there something about atoms that the function can be possible run twice? so you could double inc?
21:43rhg135also see clojure.lang.RT/nextID i think it was
21:43justin_smithmunderwo: if it has side effects, the side effects can happen twice
21:44justin_smithmunderwo: but it will happen such that the resulting value reflects each inc only happening once
21:44justin_smithmunderwo: the retries are not an issue as long as the effects of the function run are fully reflected in the value of the atom, and not as side effects
21:45munderworight, so for every event I get in I inc the counter. My counter isnt guaranteed to be 10 but it is gaurenteed to only hand out 10 numbers?
21:45justin_smithmunderwo: if it has been swap! ed via inc 10 times, it is guaranteed to be 10 if it started as 0
21:45justin_smithif two of the incs happened at the same time, one would have to retry, that is what makes it atomic
21:46justin_smithotherwise an inc could be lost (this is more realistic with a more cpu heavy calculation than an increment, of course)
21:46kenrestivoas anyone ever done a count of exactly how many clojure SQL DSL's there are.
21:46munderwoahh, so say 7 and 8 came in at the same time, 8 would retry and still get 8, as would 7?
21:46munderwowell I mean 7 wouldnt retry
21:46justin_smithmunderwo: 7 or 8 do not come in
21:46justin_smithmunderwo: inc and inc come in
21:47munderworight, sorry I meant the 7th and 8th event come in.
21:47justin_smithand swap! incs, then ensures no other operation happened in the meantime
21:47munderwocool. I think that gets as close as I can get to what I want while still having multiple threads :) Thanks for the help!
21:47justin_smithso if the 8th inc happens before the 7th inc commits, the eighth would retry, yes
22:06Jaooddnolen: where are cljsjs jars hosted?
22:14dnolenJaood: Clojars
22:15zactshellofunk: I found a good book for me to study http://mitpress.mit.edu/books/computability
22:17zactsand http://mitpress.mit.edu/books/outer-limits-reason
22:28zactshttp://mitpress.mit.edu/books/musimathics
22:28zacts^ and volume two of this book looks cool for representing audio in clojure
22:28tomjackdnölen: I presume it is unreasonable to expect this to complete quickly? https://www.refheap.com/fde7e947be7437979924d239f/raw (note, looks like noms and ties, but it's not, I took the noms and ties out while trying to understand the slowness)
22:30amalloytomjack: when did dnolen acquire a diaeresis?
22:30tomjackwhen I didn't want to ping them :/
22:31sujeetdidn't work too well
22:31kbptomjack: what does that script do?
22:31tomjackit does reification of a tree with lvars in it
22:33tomjackthe present purpose merely being to replace "<lvar:26647>" in the printed representation with "_0" etc
22:36tomjacknothing jumped out after sampling with yourkit
22:37kbptomjack: thanks for explanation
22:59tomjackhmm, I guess nrepl-ritz is not easy to set up these days?
23:01kbpI am playing with cider-nrepl. just a rookie tho
23:04tomjackI use cider-nrepl, but am looking for a debugger
23:57tomjackhmm, I notice that, stopping at a random point, one of the lvars which only occurs once in the term has been clojure.core.logic/walk*'d 624 times
23:57tomjackI guess it has to recur into subterms over and over