#clojure logs

2014-11-24

01:18daniel_can anyone recommend any talks from the conj?
01:25amalloyyes, i recommend any talks from the conj
01:25daniel_none stand out?
01:30amalloyi haven't actually watched any of them this year. but as a general rule, there aren't many you'll be sad to have watched
02:03andyfdaniel_: I have only watched a couple. Brian Goetz?s talk was a nice perspective on how to evolve a language while maintaining compatibility (Java), and some new cool things in Java 8 already, and value types coming in Java 9.
02:04daniel_thanks andyf
02:04andyfdaniel_: I liked Colin Fleming?s talk on Cursive just because what Cursive looks like it can do is impressive.
02:04daniel_started watching the realtime data pipeline (kafka) one as its sounded relavent to my work
02:05andyfvalue types are in particular something I wished for a few days ago, realizing that something like them should be able to help implement many data structures in Java more efficiently in time and/or memory use.
02:24littleliI wonder how will they make them play nice with current implementation of generics
02:59tephrajustin_smith: theses: iirc javafx is oracles swing replacement http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/
03:01tephraoh and that link is to the default look of javafx applications
04:25pellishi all.. anyone using scala with lein?
04:49gumghoulsanyone familiar with using lein repl :headless in a VM while having a nrepl session in the host ?
04:56clgv~anybody
04:56clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
05:00gumghoulsUsing lein repl :headless in a VM running a nrepl session on port 50505. I can't connect from the host (using emacs and cider [nrepl client]). So I'm looking for docs or references
05:01gumghouls(ports are forwarded properly, I tested an http server inside the VM and could `curl`, so I expect the port 50505 redirection to be OK)
05:06clgvgumghouls: did you try connecting via lein from the host already?
05:06clgvgumghouls: just to make sure it is a connection problem and not a cider problem
05:10gumghoulsclgv: I ran emacs/cider in the VM and connected to the running lein repl session
05:15clgvgumghouls: run "lein :connect ..." on the host, since you said you have problems conencting from the host with cider
05:15clgvah no "lein repl :connect ..."
05:16clgv;)
05:16gumghoulsworking on it
05:17bars0Hi all! I am a beginner in clojure and try to setup CIDER. I think I partially
05:17bars0succeed. But after conneccting with (C-C M-j) I've got message: "; CIDER 0.8.1
05:17bars0(package: 20141123.1045) (Java nil, Clojure 1.6.0, nREPL 0.2.3). WARNING: The
05:17bars0following required nREPL ops are not supported: ns-list ns-vars undef. Please,
05:17bars0install (or update) cider-nrepl 0.8.1 and restart CIDER". But the problem is I
05:17bars0don't see in melpa or marmelade any newer cider packages. In my project.clj I've
05:17gumghoulstakes a while to connect but lein repl :connect 50505 works
05:17bars0defined [cider/cider-nrepl "0.8.1"] as well as in leiningen profiles.clj. Could
05:17bars0anybody can point me to any docs how to properly configure cider. BTW I am on
05:17bars0Win32, Emacs 24.4.
05:17clgvbars0: please do use e.g. refheap.com for multiline pastes
05:18bars0clgv: OK, sorry for that
05:18clgvgumghouls: now you know it is a cider problem
05:20gumghoulsclgv: I'm still betting on a gumghouls problem, everything works locally inside the VM. I did (or forgot to do) something between the guest VM, the host and networking
05:21clgvgumghouls: well, one nrepl client, the one of leiningen, is working
05:22clgvgumghouls: but yeah, could still be missing configuration for cider instead of a cider bug ;)
05:22szymanowskihello, how can I see all class that implement a given interface or protocol?
05:22clgvszymanowski: afaik you can't.
05:23szymanowskiok :(
05:23clgvszymanowski: you could enumerate through the classpath and find out about all class names and then derive that data from these classes
05:23szymanowskiyes it seems reasonable
05:24clgvjavadoc can also only do that because it collects the whole information about all classes
05:24gumghoulsyeah, blame it on the monkey, not the tools
05:24szymanowskiHow can I enumerate the classpath? :)
05:25clgvszymanowski: it is not trivial - so I ask the question: do you really need that?
05:25szymanowskiI suppose no
05:25szymanowski:)
05:25szymanowskiI will try to find do without
05:26szymanowskithank you
05:26szymanowskiI will try to do without *
05:39honzajava interop question: how can i use a class that mutates? create an instance, call a method that mutates the instance and returns void; and then i'm required to use a getter method to obtain the result
05:40ddellacostahonza: you mean, like, how you do you do standard Java interop with a regular Java object?
05:40ddellacostahonza: are your questions not answered here? http://clojure.org/java_interop
05:42honzaddellacosta: it doesn't seem to work the way i understand it; i create a binding for the instance in a let, call the void method but then when i call the getter, the instance appears unchanged
05:43ddellacostahonza: paste the code into a refheap/gist etc. and let us take a look
05:44honzaddellacosta: here https://gist.github.com/honza/df6b08e8987608c5c898
05:44honzaddellacosta: processDocument returns void
05:45ddellacostahonza: I mean, that looks right to me. I suspect this is unrelated to Clojure--can you get the same code to work in Java?
05:46honzaddellacosta: k, cool, thanks for the sanity check, i'll investigate in java land
05:46ddellacostahonza: got the javadocs for this API available publicly?
05:46ddellacostahonza: sure thing
05:46honzaddellacosta: it's straight from the example - http://cssbox.sourceforge.net/pdf2dom/documentation.php
05:46honzaddellacosta: javadoc here http://cssbox.sourceforge.net/pdf2dom/api/index.html
05:48ddellacostahonza: yeah, that looks like a one-to-one translation from the Java example to me, should work. Maybe check dumb things, like file location and whatnot? Otherwise definitely doesn't seem Clojure-specific. Sorry I can't help more, don't know this lib. :-/
05:48honzaddellacosta: np, no need to waste more time :)
05:49ddellacostahonza: good luck. ;-)
06:10clgvhonza: `doto` is helpful for those interop scenarios
07:03justin_smithhonza: btw, every let has an implicit do block in it, you don't need do there
07:03honzajustin_smith: welp, thanks
07:04justin_smithnot a bug, of course, just a bit of verbocity / extra parens you don't need
07:45honzadoes anyone have any ideas why lein repl and the like use very different amounts of memory for different people? (independent of middleware and plugins)
07:46honzasome details here https://github.com/plexus/chestnut/issues/49
07:46jaaqoYay, by trying to form my problem into a question to be asked here I solved my problem. Thank you!
07:47justin_smithjaaqo: rubber duck effect strikes again
07:49honzajaaqo: my favorite programmer phenomenon
08:08honzai guess i should open an issue with lein
08:10andyf_honza: There is a leiningen email list, too
08:14clgvand a #leiningen irc channel
08:25grandyhello, i was reading the clojars web source and have a question about this file: https://github.com/ato/clojars-web/blob/master/src/clojars/auth.clj
08:25grandywhy is try-account a macro?
08:25grandyjustin_smith: do you happen to be around?
08:26grandywondering if it's a macro b/c it's more concise or if there is something more fancy going on
08:35grandyanyone feel like answering that question -- just switched to a different connection -- still here
08:37dnolen_grandy: could be a function but would be uglier would have to take the series of statements to execute as a thunk. this macro is typical boilerplate removal.
08:39grandydnolen_: ahh ok... it would be a thunk just to be lazy or does it have to be a thunk? not sure i understand that aspect fully
08:40dnolen_grandy: probably better to think through why it won't work since authentication must come first before anything else.
08:43grandydnolen_: ahh ok, i'll do that :) appreciate the help
08:55squeedeeconj was ace!
08:55squeedeejust putting that out there
09:02grandywish i could have made it -- planning to watch the videos soon.
09:02sooheonsqueedee: going through some of the talks now; so much goes over my head but the energy seems great
09:03squeedeesooheon the ones that go over my head just get filed in the back of my mind for when they make sense :D
09:03squeedeeI was lucky, I live in VA, just outside of DC
09:06clgvsqueedee: did you see the "Clo" talk?
09:06clgvsqueedee: is there a corresponding release?
09:06squeedeeI saw the talk
09:07squeedeeclgv: it's still in its infancy, I think he's holding it to his chest, probably because it's a personal education piece for him
09:07clgv:(
09:07squeedeeholy-moly sized project
09:13grandywhose project is that?
09:28mavbozoe
09:35KnightsWhoSayHikeeds: you don't work in leeds by any chance, do you? :-)
09:43keedsKnightsWhoSayHi: Wot! keeds from leeds? Nah.
10:15mikosyou in the UK, KnightsWhoSayHi?
10:15KnightsWhoSayHimikos: Yes.
10:15mikoscool, where?
10:16KnightsWhoSayHiNear Leeds - I was just curious if there were any companies using Clojure in and around Yorkshire.
10:16mikosi am a couple of hours north of Leeds
10:16mikosslowly trying to work it into my projects :)
10:17KnightsWhoSayHiI'm a sysadmin so there's not much hope for me to weasel it in... I have been using Amazonica though with great success :D
10:17mikosah, cool
10:17mikosi'd not heard of that
10:18mikosback soon - gotta walk the dog!
11:26mikerodI often run into trouble with leiningen of the form "Could not transfer artifact <artitfact-name-here>from/to <repo-name> <etc> Return code is: 409 , ReasonPhrase:Conflict." then something like "If you are behind a proxy, try setting the 'http_proxy' environment variable."
11:26mikerodHowever, these projects are also Maven configured and they have no problems with the same dependencies
11:28mikerodI've seen this sort of issue pop up often. I'm not sure where lein differs from Maven in how it searches for dependencies
11:29mikerodI also do not think there is any sort of proxy in place here
11:30mikerodI'm thinking there is something more restrictive in leiningen or than in Maven when it comes to fetching dependencies. Perhaps Maven has some defaults that lein has chosen not to include.
11:31sverimikerod: sounds like a network issue to me, I never saw this error before, you have some sort of a firewall in place?
11:31jmontleonjustin_smith, so I hit one more issue, which I commented on on that page. Apparently if you have clj files with the same or later date as class files they don't run AOT. Unfortunately maven-shade-plugin sets all the timestamps the same, so you have to fix it with maven-exec-plugin, but after that it works.
11:31mikerodsveri: I've used different networks both with and without firewalls
11:32jmontleoni can actually run it now, which is a bonus
11:32mikerodI know this is a vague question, so I'm probably shooting in the dark to get any useful feedback. I guess I need to understand some more details on how lein fetches dependencies
11:33mikerodI haven't seen these issues as frequently in Maven and often I can build the project in Maven, but not with lein
11:33mikerodWith the same dependency names+versions and the same repositories defined
11:33sverimikerod: any specific dependency that this occurs with regularly?
11:34xemdetiaIt almost reads to me that you might be accidentally including the same thing twice because of the 'Conflict' message, not sure how you would check that though
11:44mikerodsveri: It seems to always be from globally accessible repos
11:44mikerodThe current one I'm seeing is a dependency from cloudera
11:45mikerodxemdetia: that is interesting. so maybe I'm brining in some conflicting versions here I think you're saying?
11:46sdegutisThis kind of thing looks like it could be useful in Clojure too, but as a macro: http://robots.thoughtbot.com/efficient-json-in-swift-with-functional-concepts-and-generics
11:46mikerod when I do `lein deps :tree` it fails before showing me a tree
11:46mikerod:(
11:46xemdetiamikerod, it's only a guess. It is saying "ReasonPhrase:Conflict," not "ReasonPhrase:Can'tDownload"
11:47xemdetiaI'm almost thinking the http_proxy bit is just sort of a catchall failure message that is triggering
12:09mikerodWhen I have dependency problems in lein, I never know how to look for them easily since the :tree command also is out-of-service hah. I'll do some digging though. Thanks for the advice and responses to my vague questions though.
12:15no7hinghey, shouldn’t this work? https://www.refheap.com/93886
12:18bocaj_ Have you implemented Access Control Lists (ACL) with cemerick.friend ?
12:20mavbozo&(clojure.string/replace "sheet.name" #"\." "\\")
12:20lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 1
12:20clgvno7hing: typical escape pitfall ;)
12:20clgv,(clojure.string/replace "sheet.name" #"\." "\\\\")
12:20clojurebot"sheet\\name"
12:20clgv,(print (clojure.string/replace "sheet.name" #"\." "\\\\"))
12:20clojurebotsheet\name
12:20no7hingoh my. thanks @clgv
12:21clgvno7hing: you need an insane amount of backslashes as shown above ;)
12:21clgv,(print (clojure.string/replace "sheet.name" #"\." \\))
12:21clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn>
12:21no7hingi ran out of backslashes after the first two ;)
12:21clgv,(print (clojure.string/replace "sheet.name" #"\." (constantly \\)))
12:21clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String>
12:21Empperiyou have to escape both for strings and regexps and whatnot
12:21clgv,(print (clojure.string/replace "sheet.name" #"\." (str \\)))
12:21Empperihorrible world
12:21clojurebot#<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 1>
12:21no7hinglooks like my repl session
12:22clgv,(str \\)
12:22clojurebot"\\"
12:22clgvah right. no shortcut in that direction
12:23clgvno7hing: Clojure's regexps are optimized in that regard
12:23mavbozo,(re-pattern "\")
12:23clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
12:23mavbozo,(re-pattern "\\")
12:23clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
12:23clgv,(str #"\.")
12:23clojurebot"\\."
12:24mavbozo,(re-pattern "\\\\")
12:24clojurebot#"\\"
12:24mearnshlooking for workflow advice: using a library in my project but i've made a fork of the library now. how can i deal with this using lein efficiently
12:24technomancymearnsh: there's a FAQ about that
12:24mearnshah, i'll take a look thanks
12:28clgvmearnsh: short answer - usually you just change the group of the artifact, e.g. to "org.clojars.mearnsh"
12:28clgvmearnsh: if the changes don't get merged into the original library and you diverge farther, you should probably rename the library
12:40mearnshsounds like a plan, will try that
13:00riley526Why are multimethods not considered functions by `fn?`?
13:00technomancyriley526: you're looking for ifn? probably
13:02riley526technomancy: so fn? only returns true for functions defined with (fn [] ...), etc, not just any callable?
13:02clgv,(defmulti bla type)
13:02clojurebot#'sandbox/bla
13:02clgv,(ancestors (type bla))
13:02technomancycorrecto
13:02clojurebot#{java.lang.Runnable clojure.lang.AFn java.lang.Object clojure.lang.IFn java.util.concurrent.Callable}
13:02technomancyprefer abstractions to concretions
13:03riley526polaris (a routing lib) doesn't let you provide a multimethod as a request handler
13:03riley526because it uses fn? to check its type https://github.com/caribou/polaris/blob/master/src/polaris/core.clj#L28
13:04technomancythat's a bug
13:04riley526yeah I figured
13:04justin_smithriley526: I can get that fixed
13:04justin_smithriley526: did you make a ticket for it?
13:04riley526justin_smith: oh cool
13:04riley526justin_smith: no I just discovered it last night
13:04riley526justin_smith: I can though
13:04riley526justin_smith: what's the solution, ifn? perhaps?
13:05riley526I can pull-request it if it's that simple
13:05justin_smithyeah, I see it now ##(ifn? :f)
13:05lazybot⇒ true
13:05justin_smithyeah, ifn? is the simple fix
13:05riley526cool
13:05clgvthough a lot of stuff satisfies `ifn?`
13:06sdegutisgit diff -w --color-words HEAD^ # this is amazing for Clojure code
13:06riley526true
13:06riley526does it make sense to accept a keyword as a handler, for instance?
13:06justin_smithclgv: our options in that context are: callable, var, or symbol (which gets resolved), so I will move var up in the cond (since vars implement ifn) and all should be good
13:07justin_smithactually, I can eliminate the var clause!
13:07justin_smithturn the cond into an if, nice
13:07justin_smithwait - symbols also implement ifn - so I just check for symbool, and error if not callable
13:07sdegutisjustin_smith: what do you have against cond?
13:07sdegutisjustin_smith: you know, there wouldnt even /be/ an if, if it werent for cond
13:08justin_smithsdegutis: if you only have two clauses, it's more complex than what is needed
13:08justin_smithI like to use the simplest and least powerful construct available
13:08clgvjustin_smith: sure, depends what is done with that value. I once caused an error in one of my libs by switching from `fn?` to `ifn?`
13:08justin_smithand it always feels nice to bump down a notch of power
13:08clgvso I wanted to mention it ;)
13:08justin_smithclgv: I can see that
13:08sdegutisjustin_smith: +1
13:08justin_smithclgv: and if you handn't mentioned that, I might have missed the symbols implementing ifn case
13:09clgvsdegutis: `cond` sucks for unboxed longs and doubles because of its last case that returns nil
13:09justin_smithriley526: so it isn't as simple as just checking for ifn?, I will work on a fix
13:09riley526alright cool
13:09clgv,(set! *warn-on-reflection* true)
13:09clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>
13:09riley526justin_smith: love polaris, fwiw
13:09llasramjustin_smith: Not knowing the context of this library, but what's the use-case for resolving symbols to vars?
13:09clgvawww :(
13:09sdegutisclgv: I never think about that kind of optimization. Should I be?
13:10clgvsdegutis: seems like you had nothing performance critical wrt this - so no you shouldnt
13:10clgvsdegutis: I just fixed a reflection warning corresponding to that this morning
13:11sdegutisok :)
13:11clgvon first sight I couldn't explain were the autoboxing came from
13:11sdegutisclgv: Well, we run our Clojure web (ring/jetty) server on the smallest/cheapest usable EC2 server possible -- does that count as needing critical performance?
13:11clgvsdegutis: depends on the operations ;)
13:12sdegutisclgv: Uhh, it's a website.
13:12clgvand whether you do a lot of numeric calculations
13:12clgvfor the above case, I mean
13:12sdegutisGit is so cool. I was able to see how I used a function just before my last commit by doing: git grep -C2 with-eula-sig HEAD^
13:19justin_smithllasram: specifying a routing table as a vanilla data structure - symbols, maps, strings, keywords, vectors
13:19justin_smithllasram: ie. something that is edn-clean
13:19justin_smithin that case, a symbol for the handler's action is resolved to a namespaced var
13:20justin_smithllasram: hopefully the advantages of specifying things as pure edn are clear
13:22EvanR,(chr 31)
13:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: chr in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:22EvanR,(str \x1f)
13:22clojurebot#<RuntimeException java.lang.RuntimeException: Unsupported character: \x1f>
13:22justin_smith,(char 31)
13:22clojurebot\
13:22justin_smith,(str 0x1f)
13:22clojurebot"31"
13:22justin_smith,(char 0x1f)
13:22clojurebot\
13:23justin_smithEvanR: ^^^
13:23EvanRok
13:23justin_smith,(str (char 31))
13:23clojurebot""
14:05amalloygfredericks: how many libs have you named (format "lib-%04d" (rand-int 10000))? i thought it was like a one-time joke, but i see there are a fair number of such things
14:07danielcomptondnolen_: ping
14:09clgvamalloy: 5 according to github ;)
14:10gfredericksamalloy: yeah 5 sounds right; only like one or two of them would I use today
14:10kenrestivowait, the last case of cond always returns nil? really? i could swear i've used it and if you catch all the possible input it doesn't return nil
14:10gfredericksI tend to wuss out on the joke because I like to fantasize that a lib might get populare and that in real life this only happens if it has a traditionally clever name
14:11amalloykenrestivo: uhhhh, it's not totally clear what you mean but you are probably mistaken
14:11amalloyeg, ##(cond true 1) ;; returns 1, not nil
14:11lazybot⇒ 1
14:11kenrestivo < clgv> [13:08:05] sdegutis: `cond` sucks for unboxed longs and doubles because of its last case that returns nil <-- this confused me
14:12kenrestivoi thought that sounded wrong
14:12dnolen_danielcompton: pong
14:12amalloykenrestivo: the compiler can't prove that you actually make it through all the cases
14:12amalloyso it is probably worried that you might return nil, and thus can't unbox the primitives
14:12danielcomptondnolen_: is there anything I can do to help with http://dev.clojure.org/jira/browse/LOGIC-118 ?
14:12kenrestivoooh
14:13reflectionshey
14:13sdegutisdnolen_: how do you find all this time for all this apparently non-stop open source work?
14:14hiredman,(macroexpand '(cond a b c d))
14:14clojurebot(if a b (clojure.core/cond c d))
14:14hiredman,(macroexpand '(cond c d))
14:14clojurebot(if c d (clojure.core/cond))
14:14hiredman,(macroexpand '(cond))
14:14clojurebotnil
14:15reflectionsI have some edn which was read out of an H2 DB which I am now trying to use as a basis to populate a DB. I notice that timestamps have been represented as byte arrays (#<byte[]...) but I am not sure how to read these in. Any ideas much appreciated
14:15hiredmanwhy do you say it is edn data?
14:16weavejesterreflections: It sounds like your data has some unreadable forms in it. Byte arrays don't serialise by default.
14:16reflectionswell i assumed i could provide some sort of handler function to the reader to intepret these
14:17hiredmanso you are serializing via pr-str or simliar, writing to the database, and getting form you can't read out the otherside?
14:18justin_smithreflections: you can get a byte-array as a string with the string constructor (String.) or via slurp. But yeah, something seems wrong that you are getting that back, and I don't know if either of those would really give you the original back.
14:18amalloyreflections: if it has actually been written as the string "#<byte[] ...>" then you are out of luck, those are totally unusable. you need to write things in a way that doesn't lose the information
14:18weavejesterreflections: It's the writer that's wrong. You don't have enough information to reconstruct the array.
14:18reflectionsive read from one db, written to a file, and hoping to read back into a db
14:18justin_smithI have had the issue with jdbc sometimes that for certain text data types I get a byte array I need to slurp or construct a string from
14:18reflectionsoh, I see. Sounds like I have serialised incorrectly then
14:19Bronsacond could actually be smarter and short-circuit on truthy literal tests
14:19weavejesterreflections: You might want to try a serialisation library that can handle arrays, like Nippy, or add a custom serialiser for arrays.
14:19weavejesterNippy is probably the easiest solution.
14:19sdegutis,(defn call-macro [m & args] (eval (apply (resolve m) nil nil args)))
14:19clojurebot#'sandbox/call-macro
14:19sdegutis,(call-macro 'when true 123)
14:19clojurebot123
14:20dnolen_danielcompton: does that second patch work for you?
14:20reflectionsthese are fields of type 'timestamp' in the db
14:20amalloyBronsa: that seems like a reasonable enhancement to me
14:20danielcomptonYes, it works for me in kibit
14:20Bronsasomething like http://sprunge.us/DfUO?clj
14:20danielcomptondnolen_: but kibit doesn't use all of core.logic
14:20justin_smithreflections: what does the resulting string look like if you slurp one?
14:20sdegutis,(let [macro 'if] (call-macro macro false 123 456))
14:20clojurebot#<NullPointerException java.lang.NullPointerException>
14:20sdegutisAww.
14:20Bronsasdegutis: if is not a macro
14:21sdegutisOh.
14:21sdegutis,(let [macro 'cond] (call-macro macro false 123 :else 456))
14:21clojurebot456
14:21sdegutisYay.
14:22Bronsaor a little better, http://sprunge.us/edii?clj
14:23Bronsaamalloy: meh, this wouldn't be necessary if the compiler did this automatically for if forms
14:24dnolen_danielcompton: applied, tested, pushed
14:25danielcomptondnolen_: awesome, thanks!
14:25dnolen_danielcompton: will have to await another bug before I cut a release
14:25danielcomptondnolen_: np
14:27morfeenanyone read this article: http://www.lambdassociates.org/blog/bipolar.htm
14:30augustlhyPiRion: (off topic) are you aware of any Rust bindings for c-rrb?
14:32hyPiRionaugustl: I noticed you asking the question in #rust :)
14:33hyPiRionnot afaik
14:33augustl:)
14:33augustlstepping away from the JVM is scary, so few communities other than the Clojure community has embraced persistent data structures
14:35danielcomptonis it idiomatic to replace all :use's with :require :refer :all, on the way to requiring specific vars?
14:35danielcomptonI mean referring specific vars
14:35technomancydanielcompton: :require/:as is better
14:35technomancybut getting rid of :use is a step in the right direction
14:35llasram(inc technomancy)
14:35lazybot⇒ 161
14:35danielcomptontechnomancy: yeah, that's the long term goal, but as an interim step
14:36augustlyou can't type confuse without :use
14:37hyPiRionaugustl: yeah, it's a bit sad. Only OCaml and Haskell is out there non-JVM, Rust only provides immutable but not persistent variants
14:38llasramaugustl: you can't type "confusion" without "nfusi"
14:39afhammadwhats the most efficient way to convert a lazy seq into a vector? vec, into [] ?
14:39justin_smithafhammad: use an algo that outputs a vector in the first place! (being a bit glib there, but really, if it exists it is likely the better option)
14:40amalloyafhammad: you'd have to be in a pretty unusual scenario for the conversion from seq to vector to be your bottleneck
14:40joegalloiirc (into [] ...) is the fastest, because it takes advantage of transients... but that's just something i think i heard once -- and yeah, amalloy is right, i think this is a somewhat silly exercise
14:40amalloyi certainly never worry about whether vec or into[] is faster
14:40afhammadamalloy: its not, just wondering
14:40amalloyas it happens, into is faster because vec is so old
14:41danielcomptonis :use deprecated anywhere official or is it just convention?
14:41afhammadjustin_smith: the lib i'm using returns a lazy-seq, and I'd like to repond to client with a vector. Transit defaults to a list if its a seq
14:42technomancydanielcompton: rich told me he didn't like it; not sure how to make it any more official than that =D
14:43danielcomptontechnomancy: haha
14:43danielcomptontechnomancy: putting it in the docstring could be a good place to mark it
14:43technomancyeh the docs for ns are a lost cause
14:45EvanR,(re-pattern (str (char 31)))
14:45clojurebot#""
14:45Bronsaamalloy: well this was easier than expected http://dev.clojure.org/jira/browse/CLJ-1598
14:46EvanR,(re-pattern (str (char 31) "+"))
14:46clojurebot#"+"
14:48llasramEvanR: Looks like clojurebot is printing strings with control characters rather oddly
14:48amalloyllasram: you think it's clojurebot, not your irc client?
14:48EvanRmight be "raw"
14:49llasramamalloy: Oh. You are almost certainly correct.
14:49EvanRif theres no way to escape control chars, then there no choice
14:49llasramWell, maybe. I see very different things in my emacs ERC client output vs my emacs CIDR REPL output
14:50EvanRbut you cant type non printable chars into a literal so it doesnt make much sense to show non printables as nothing
14:50llasramBut IRC/client does seem the more likely culprit
14:50EvanRor "raw"
14:50llasramEvanR: In my local REPL I see the non-printables as still being part of the resulting string and Pattern
14:51EvanRin a terminal?
14:51llasram,(-> 31 char re-pattern str first int)
14:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String>
14:51llasram,(-> 31 char str re-pattern str first int)
14:51clojurebot31
14:51llasramIt's definitely there
14:52llasramEvanR: In CIDER, in an Emacs buffer
14:52EvanRyes they are there
14:55gfredericksllasram: oh hey
14:55justin_smith&(char 31)
14:55lazybot⇒ \
14:55danielcomptontechnomancy: the docs for Clojure are fine once you no longer need them
14:55justin_smithjust checking if lazybot handled it differently
14:55amalloyBronsa: interestingly, it looks like regular expressions don't implement LiteralExpr
14:56Bronsaamalloy: uh? don't they get routerd through ConstantExpr?
14:56technomancydanielcompton: pretty much
14:56amalloyBronsa: maybe? it was hard for me to find out for sure, but it doesn't look like it
14:58Bronsaamalloy: yeah they do in the analyze method no clause matches for regexes so they get to line 6514 and wrapped in a ConstantExpr
14:58amalloyi see
14:58amalloyi was looking for references to Pattern specifically, not for lack of references to Pattern
15:00BronsaIIRC all literals + quoted forms are ConstantExprs, except from non-constant map/set/vectors
15:04sdegutisouch, the clean coder took a shot at FP here http://blog.cleancoder.com/uncle-bob/2014/11/24/FPvsOO.html
15:04llasramgfredericks: is for horses?
15:07justin_smithsdegutis: I don't see any shots there at all
15:07justin_smithsdegutis: just a criticism of facile descriptions of the advantages
15:07sdegutisit's near the top
15:08justin_smithsdegutis: yes, like I said, those are facile descriptions of the advantages
15:08sdegutisgreat
15:08justin_smithsdegutis: he doesn't say fp is bad, he says those descriptions are bullshit
15:08justin_smithwhich is true
15:08sdegutisi dont understand your words
15:08justin_smithsdegutis: superficial
15:09justin_smith$dict facile
15:09lazybotjustin_smith: adjective: Done or achieved with little effort or difficulty; easy. See Synonyms at easy.
15:09dbaschI stopped reading at “Objects are bags of functions, not bags of data.”
15:09sdegutisok
15:09sdegutismy tests fail even though they should be passing
15:10justin_smithdbasch: he's playing no true scotsman about objects, but I actually like the version of OO he advocates for, at least
15:10sdegutisso im gonna go spend some time on reddit
15:10danielcomptonpolymorphism isn't inherent to OO
15:11sdegutisdanielcompton: its harder to do in FP without some OO-style constructs
15:11justin_smithI'm actually disappointed to lazybot's definition response from dict - it didn't choose the meaning I had in mind, and did not indicate that other meanings exist :(
15:11sdegutisdanielcompton: hence we have defmulti and defmethod, which have their own limitations/flaws
15:11danielcomptonsdegutis: fair point
15:12sdegutisjustin_smith: perhaps theres a reason im just finding out about $dict for the first time
15:12justin_smithheh
15:12sdegutis(hint: its because it sucks)
15:12justin_smithsdegutis: I gained a good overview of the available plugins when I updated lazybot and had to ensure I didn't break them
15:12sdegutis(no offense to whoever wrote it; im sure the limitations are because of the third party api it uses, not the clojure coder's job)
15:12justin_smith$phrases facile
15:12lazybotjustin_smith: No phrases found for facile.
15:13sdegutisjustin_smith: oh wait ur in charge of lazybot?
15:13sdegutis(inc justin_smith)
15:13lazybot⇒ 147
15:13sdegutis$karma sdegutis
15:13lazybotsdegutis has karma 6.
15:13sdegutisaww
15:13justin_smithsdegutis: not in charge, I just did a big upgrade of the irc client version and clojure version
15:13sdegutis(dec justin_smith)
15:13lazybot⇒ 146
15:13justin_smithsdegutis: because I whined at Raynes that lazybot went off line too much, and he was like "well, you can fix that"
15:14dbaschlazybot is in charge of lazybot obviously
15:15justin_smith$wotd
15:15lazybotjustin_smith: dingle: A small wooded valley; a dell.
15:15justin_smithoh, what an excellent word for today
15:15justin_smithhaha, off to tell the world that a synonym for Dell is Dingle
15:19sdegutisok
15:19sdegutisDude, you're getting a Dell!!
15:21sdegutisok closing reddit; looks like my tests are still failing :(
15:26cflemingMy award for coolest project I discovered at the conj: Graal & Truffle: http://www.chrisseaton.com/rubytruffle/cext/
15:26cfleming*mind blown*
15:29sooheonHow does it relate to clojure?
15:29sooheonthe java/jvm part?
15:30sdegutiscfleming: im also curious
15:31cflemingYou could implement Clojure using Truffle and run it on Graal. Your Clojure implementation is a simple AST interpreter, you don't have to write bytecode or anything.
15:31sdegutis!
15:31sdegutisThis could revolutionize Clojure as we know it!
15:32cflemingGraal is like a standalone hotspot, so Truffle talks to it about the parts of the AST that are running hot, and Graal compiles them.
15:32hellofunkdoes anyone know what "lvar" refers to on this line in a dnolen's sudoku solver: https://gist.github.com/swannodette/3217582#file-gistfile1-clj-L23
15:32cflemingThe awesome thing is that it can perform all sorts of AST optimisations - inlining var derefs, HOF use, etc etc
15:33cflemingAlso the Truffle AST is cross language, so you can inline Java into Clojure, or Clojure into Java
15:33cflemingOr Scala or JRuby into Clojure etc
15:33cflemingThat blog post I pasted above is inlining C into Ruby :o
15:33alejandro2hellofunk: https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#Logic_Variables
15:34dnolen_hellofunk: that's programmatically constructing logic vars - the soduku example is fun but not a beginner core.logic thing
15:35hellofunkalejandro2 i read that but lvar is not in the core.logic api nor is it seen in actual code syntax in the primer. what does it actually point to in this code?
15:36alejandro2hellofunk: it's not https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L706
15:36alejandro2?
15:37xelxebarithub.com/swannodette/3217582#file-gistfile1-clj-L23 │ amano-
15:37xelxebar05:31 cfleming : The awesome thing is that it can perform all sorts of AST optimisations - inlining var derefs, HOF use, etc etc │ ambrosebs
15:38hellofunkalejandro2 awesome, thanks. it is not in the API spec, hence i did not know it existed. there is lvaro however: http://clojure.github.io/core.logic/#clojure.core.logic/lvaro
15:39hellofunkand LVar is listed as a type but if "lvar" is something worth calling, I'd have expected it in the API docs
15:49sdegutisWhy is there no cond-let?
15:51mi6x3m-altsdegutis: not needed very often :) time for macros!
15:51turbofailthere should be a zombo-let
15:51amalloysdegutis: because it's not obvious what it would do
15:51justin_smithturbofail: you can do anything, at zombo-let
15:51amalloythere was a cond-let in old-contrib, and ninjudd put one in useful, but they did different things
15:51turbofailwith zombo-let the only limit is you!
15:51amalloy(neither of which was particularly useful)
15:52dnolen_hellofunk: core.logic docstrings need a lot of work
15:52sdegutisamalloy: It would let me combine my (let...(cond...))
15:54dbaschsdegutis: maybe you want a cond-reduce-frequencies-println-let
15:54dbaschwhat with the price of parentheses being sky high these days
15:56danielcomptondbasch: they're stockpiled in these warehouses http://www.reuters.com/article/2011/07/29/us-lme-warehousing-idUSTRE76R3YZ20110729
15:56dbaschdanielcompton: (Reuters)… I see
15:58danielcomptoncfleming: the rubytruffle thing is bananas
15:58cflemingdanielcompton: Yeah, no doubt. Since Graal is basically hotspot, I came away thinking that's the future of JVM language design.
15:58danielcomptonYou may think of C as being a language that is natively compiled ahead of time to machine code, but that isn't an essential property of the language. As long as a C interpreter does the same thing with your C program as a C compiler would, it shouldn't make a difference to you.
15:59cflemingdanielcompton: One problem is that for performance you end up paying the warmup twice - once for Graal and once for Truffle.
16:00hellofunkdnolen_ agreed. I guess there are a number of functions lurking in the library that can only be learned about by actually looking at the source.
16:00cflemingdanielcompton: But Truffle could automatically turn your HOF uses into tight loops.
16:00dnolen_hellofunk: yep, docstring patches welcome
16:01cflemingdanielcompton: Or could inline your JS code running on Nashorn into your Clojure code or your Java code.
16:01danielcomptoncfleming: it looks like Jruby+Truffle+C extension is faster than MRI with the C extension?
16:02danielcomptoncfleming: yo dawg
16:02hyPiRioncfleming: how problematic is technomancy/leiningen#1768 for cursive? Just wondering how to prioritise issues the upcoming months
16:02lazybotmemoize makes reuse tricky -- https://github.com/technomancy/leiningen/issues/1768 is open
16:02cflemingdanielcompton: In that case they tested, yeah
16:02hellofunkdnolen_ gotta learn how it all works before i can summarize anything for a docstring
16:03cfleminghyPiRion: It's a real problem. Users get extremely confused when trying to figure out why their profiles don't update when they change them on disk.
16:03dnolen_hellofunk: core.logic is by the far the most experimental of the libraries I maintain, sudokufd is really not any kind of entrypoint at all
16:04dnolen_hellofunk: part of the reason lvar is not doc'ed is because normal code doesn't use it
16:04cfleminghyPiRion: #1378 is less of an issue since I can (and do) work around it with a gory hack.
16:04hellofunkdnolen_ i understand the sudoku decently now that i know what lvar actually points to.
16:04hellofunkdnolen_ but at first i thought it was a typo
16:04hyPiRioncfleming: alright, so the faster, the better then. I'll see if I can poke into it during December
16:05dnolen_hellofunk: yes but my point remains, sudokufd mixes FP/LP in way I would consider relatively advanced
16:05cfleminghyPiRion: I have some other related issues with CWD, since the CWD is always "wrong" when calling into lein.
16:05cfleminghyPiRion: Thanks, I appreciate it. Happy to help with it if required too.
16:06hellofunkdnolen_ well advanced is subject, i've been following all of byrd's youtube videos and it seems pretty straightforward to minikanren-style logic
16:06hellofunk*subjective
16:06cfleminghyPiRion: I'll have some questions about the *cwd* var which might allow some workarounds for the problematic projects, but I haven't investigated much yet.
16:06gfredericksllasram: I was your parser thing
16:06sdegutisdbasch: good idea
16:06cfleminghyPiRion: I actually meant to talk to you at the conj about profiles too but forgot to when I had you
16:07cfleminghyPiRion: I'll send a mail when I'm no longer in an airport.
16:07hyPiRioncfleming: sure – feel free to jump into #leiningen as well if you have some specific ones
16:08hyPiRionand re: profiles, urgh. They are really nasty now, we're going to clean them up for 3.0
16:08llasramgfredericks: I'm afraid I'm failing to connect that sentence to semantic referents :-)
16:08cfleminghyPiRion: Great, I will do, thanks - I'm going to work on this code soon.
16:08cfleminghyPiRion: My lips are sealed!
16:08cfleminghyPiRion: Is there a rough timeframe for 3.0?
16:08hellofunkdnolen_ it's a shame about your posterious page, was all that content ported to your github blog?
16:09hyPiRioncfleming: hahah, even I have problems understanding profiles and merging at times
16:10dnolen_hellofunk: nope, posterous erased it w/o ever giving me the backup I requested - never again.
16:11cflemingdnolen_: That sucks. Did wayback machine or something have a copy?
16:11dnolen_cfleming: maybe?
16:11hyPiRioncfleming: I think technomancy could give the 3.0 timeframe better, but from what I gather, we just need to figure out what's we need to break from 2.x and 3.x, and how we're going to solve it
16:11hellofunkdnolen_ damn that's sucky ducky
16:11hyPiRionprofiles will get freshed up as mentioned, but we still need to sort out how it's going to be done
16:13cfleminghyPiRion: Ok, so it's still a ways off then. I'll definitely need some kind of fix for the memoize issue before then. Everything else I have to do is somewhere on a scale of slightly ugly to really foul, but that I can't fix without fixing lein.
16:16llasramcfleming: You can't just load Leiningen all over again in another classloader?
16:16llasramI mean, that solution is obviously gross, but...
16:18cflemingllasram: Yeah, the problem is that I'm embedding lein in a long-running process. I could tear the namespaces down and re-load them every time I call in to lein, but that happens pretty frequently.
16:18cflemingllasram: That would be near the top of my lein-integration-grossness scale, but probably not right at the top.
16:19hyPiRioncfleming: alright. Feel free to submit (more) issues you think could benefit both Cursive and Lein. Should be no surprise that we'd love contributions as well, but there are only so many hours in a day :)
16:19llasramcfleming: I was suggesting something slightly different. If you look at how hugod does alembic, he uses classlojure to pull Leiningen and all deps (including Clojure) into their own isolated classloader stack
16:20llasramYou could monitor project.clj and profile.clj for changes, and comparatively-easily teardown+reload the whole assemblage when they change
16:20cfleminghyPiRion: Yeah, I was planning to do some analysis to try to figure out how many of the memoize calls are totally spurious these days - I suspect some to most probably are. Certainly the profile stuff is. I'll take a look and comment on the issue.
16:21cflemingllasram: Interesting idea, I'll take a look, thanks.
16:21hyPiRionthat'd be wonderful
16:21cflemingllasram: I'm not sure about loading another entire copy of Clojure in the same process, but I'll see if that's required or not.
16:21cflemingllasram: Thanks for the pointer!
16:21llasramnp!
16:31gfredericksllasram: oh wait it was a printer
16:31gfrederickssorry I keep dropping out
16:31gfredericksanyhow I've thought about this printing problem a lot because of certain pains I've had
16:31gfredericksand I was wondering about the case where you want to supply a printing for a custom collection
16:32gfrederickswhich means you want to be able to "recur" for each of the elements
16:32llasramRight
16:32gfredericksdoes your library allow for that?
16:32gfredericksI didn't think the print-method signature was very compatible with that structure
16:33llasramgfredericks: Yep. That's the magic+danger. It swaps the value of the `print-method` var for a MultiFn subclass which injects the dynamic behavior
16:34dmitrig01hey! one of my java dependencies requires a JAR on my classpath; how do I add something to the classpath? using leiningen
16:34llasramgfredericks: So you can recursively invoke it, and get the same new behavior for each level of recurrence
16:34gfredericksllasram: aah gotcha -- so the idea is I call clojure.core/print-method and it magically works
16:34llasramExactly
16:34gfredericksllasram: okay; what do you think of the idea of changing the signature so that the custom printer gets an extra arg for recuring?
16:35gfredericks(fn [x pw recur-fn] ...)
16:35gfredericksI've tried to solve this problem before and failed and I didn't think of that idea until I saw your lib
16:36llasramThat would definitely be a nice general functional solution, but I don't know how to do it without being a different mechanism than `print-method`
16:37llasramOr maybe I'm not quite understanding your idea?
16:37gfredericksare you trying to piggy-back on the existing print-method functionality and that's the part you're saying wouldn't work?
16:37llasramYes, exactly
16:38llasramI want all the code out there which already extends print-method to keep working
16:38llasramAnd not need to re-implement those printings to get the new behavior I want
16:38gfredericksyeah, probably in particular printing collections with the existing print-method wouldn't work anymore
16:38gfredericksyeah I think you're right.
16:39llasramAlas, the compromises of evolution
16:39gfredericksthis issue pops up for me when I want to do serialization in a library without imposing on the user's extensions
16:39gfredericksI've needed both json & edn in different contexts
16:40gfredericksand they both use the same global-only extension points :(
16:40aavis there a way to extend built in protocol (IDeref) in my case, with some other protocol?
16:40llasramWhelp, if you don't mind the conceptual kludge of monkey-patching `print-method`, I believe letterpress should have you covered for EDN
16:41llasramI'll be using it in the next release of Parkour for exactly the same reason
16:41sdegutisWht's parkour?
16:41sdegutisPetour Parkour?
16:41llasramsdegutis: https://github.com/damballa/parkour/
16:42sdegutisllasram: you wrote it?
16:42llasramyah
16:42dbaschaav: see https://groups.google.com/forum/#!topic/clojure/1PYQIItNxg8
16:42sdegutisimpressive
16:42amalloyaav: no, because it's an interface, not a protocol
16:43aavdbasch, amally: thanx
16:44jkjwhat are protocols to java actually?
16:44jkjare they anything?
16:44aavamalloy: sorry for misspelling your nick :)
16:44dnolen_jkj: they are not
16:44llasramjkj: In the JVM Clojure implementation they have a backing JVM interface
16:44aavi'm in ClojureScript, btw...
16:44llasramOh, nm
16:45jkjdnolen_, llasram: ok
16:45dnolen_aav: not possible
16:45amalloyaav: your client will tab-complete nicks
16:51gfredericksllasram: the monkey patching sets up a dynamic var to use for local extension?
16:52llasramgfredericks: Pretty much
16:53gfredericksyeah I think for putting in a library I'd rather hand-roll something more independent; actually just basing it on a class<->tag sort of thing could be better for that lib
16:54llasramgfredericks: Philosophically I agree with you, but in practice I already have `print-method` implementations spread across a number of small libraries, and don't want to revisit them all
16:54gfredericks[{:class Foo :tag "bar" :encode #(...) :decode #(...)} ...]
16:54gfredericksllasram: yeah I can't argue with pragmatism
16:55llasramThe monkey-patching is as safe as possible. It stores and stacks with the original value, so should compose with any other monkey-patchers. The replacing value is a MultiFn, and proxies all MultiFn-specific methods to the original value
16:56llasramIt'd certainly be better if the facility were done in core, but I'm not going to lose any sleep over it
16:56justin_smith dmitrig01: did someone address your question yet?
16:56dmitrig01justin_smith: no, but i was able to sort it out – thanks
16:56gfredericksllasram: thanks for the back&forth
16:57justin_smithdmitrig01: if the java lib is on maven it's easy, otherwise local install is an option
16:57llasramnp. Best of luck with your approach :-)
16:57justin_smithdmitrig01: glad to hear you worked it out
16:57dmitrig01justin_smith: yeah, first i figred out how to do a local install, and then i realizezd it’s on maven anyway
16:57justin_smithdmitrig01: so you covered the basic options, awesome!
16:57technomancyhttp://timb.net/popular-languages.html
16:58llasramtechnomancy: huh
16:58llasramWhat does that mean?
16:59llasramThe more people like solving toy problems in a language, the more popular it is in Rosetta Code?
16:59technomancyllasram: it means any page with numbers on it is a game you can play to win =)
16:59llasramheh
16:59llasram(not implying Racket is only good for toy problems)
17:00technomancyllasram: being right next to tcl is not that flattering; I get it =)
17:22{blake}REXX at #12!
17:22engblomIf anyone has a suggestion for how I get rid of needing to write trice (if eaten...) in this I would appreciate. I also take any other suggestion for how to make it better: http://pastebin.com/GqTaWJSN
17:24amalloyengblom: (let [[new-snake eaten-food ...] (if eaten [...] [...])] ...) would be one way
17:40FrozenlockIs there a plugin to update all project dependencies and run the tests?
17:40technomancywhy would you do that?
17:40gfredericksto get the freshest gems
17:41gfrederickser, eggs
17:41gfrederickser, ... hacks?
17:42dbaschgfredericks: while you’re at it, you might get all deps between t1 and t2, and test all combinations until one passes :P
17:43Frozenlocktechnomancy: Why I would want to get the newest dependencies? To get the all new and shiny things :-p
17:43gfredericksyeah search that exponential space for the largest passing sum of dependency versions
17:43technomancyin my experience newer things are less likely to work correctly
17:43gfredericksalso a plugin that detects dependency conflicts and auto-generates PRs to offending libs to update their deps
17:44Frozenlocktechnomancy: that was the 'tests' part.
17:44technomancyFrozenlock: that's the other thing; writing a plugin that updates dependencies *and* runs tests is silly; each plugin should do only one thing =)
17:45justin_smithFrozenlock: lein-ancient will tell you what has newer versions. But obviously there are philosophical differences with the idea of automatically upping versions
17:45justin_smith
17:45technomancybut yeah, in my experience the breakage caused by library upgrades are usually edge cases that generally have poor test coverage
17:46Frozenlockjustin_smith: thanks, at least I can quickly see which one is important.
17:46amalloygfredericks: largest passing sum? i'ma make sure my libraries increase version numbers by 10,000 each release
17:46gfredericksamalloy: #lifehack #protip
17:46FrozenlockLike when compojure/ring updated after the #_ drama.
17:46amalloythere was #_ drama?
17:46amalloyare you thinking of #=?
17:46FrozenlockAh, yes
17:47FrozenlockThe thing I use everyday, obviously
17:47gfredericksclojurebot: #_ is the safer version of #=
17:47clojurebotIn Ordnung
17:47weavejesterIt wasn't even #=, I don't think. The problem was that even *read-eval* false is unsafe.
17:47weavejesterThough maybe I'm not remembering right.
17:47FrozenlockWasn't that discovered when talking about #=?
17:48amalloyweavejester: no, you were right. because of the record syntax
17:48technomancyit was both
17:48amalloy#java.net.Socket["google.com" 80] or something like that
17:49weavejesterIt was limited to cookie sessions, I remember that.
17:57teslanickAre there any patterns out there for "calling back" when some core.async thing has been done? Like: "I hand you a message and let me know when you're done munching on it."
17:58justin_smithteslanick: that's why go returns a channel
17:58justin_smiththe channel will get the return value of the go block
17:59andyfamalloy: This link may have the details you were remembering http://clojuredocs.org/clojure.core/read
18:00amalloyhey, i guessed the socket one exactly right
18:01teslanickjustin_smith: I'm thinking more like, "I've put a message on a channel to parts unknown and I'm expecting a 'call back' at some point" - obviously this could be just a callback, but I don't know if there are any worn-in patterns here.
18:01andyfClojure 1.5 may have closed the hole of calling Java constructors when *read-eval* is false but I would think long and hard before relying on that.
18:01csd_I'm trying to do a nested loop/recur, and the inner loop's binding isn't resetting after the first iteration. Is this something I have to do on my own?
18:02hiredmancsd_: what do you mean?
18:02justin_smithteslanick: one way I have seen is to pass a channel with the message, such that a result or a "do something" trigger is expected on that channel
18:03hiredmanthe binding doesn't "reset" (I mean technically it does) but the mental model is a recursive function call, a recursive function call doesn't "reset" a binding, it is a new call
18:03andyfThe FileWriter example is a bit more eye-opening for those who are accustomed to thinking of constructors that only alloc mem
18:03csd_I have in the inner loop, begin at [x 0] and then stop recurring when x = 5. So then control transfers back to the outer loop, which then executes another iteration. But then when control comes back to the inner loop again, the binding is still at 5, and so the loop doesn't execute.
18:04hiredmancsd_: yeah, so if you replaced the loop with a call to a function, would you expect the value of x to change?
18:04csd_I would think so
18:04hiredmanx is an immutable binding, the value doesn't change, recur doesn't change the binding it is like a recursive function call
18:04teslanickjustin_smith: I can see value in that; I had considered going that road, but thought it might be insane somehow.
18:04csd_Shouldn't it be calling a new instance of loop effectively
18:04csd_which would rebind
18:05hiredman(defn f [x] (if (zero? x) x (do (f x) (g x))))
18:05hiredmancan f change the value of x that g sees?
18:06csd_i don't believe so
18:06hiredman(defn f [x] (if (zero? x) x (do (let [x 1] (f x)) (g x))))
18:06hiredmanwhat value of x does g see? does it see 1?
18:06csd_yes
18:07csd_no wait
18:07csd_no
18:07hiredman(defn f [x] (if (zero? x) x (do (loop [x 1] (f x)) (g x))))
18:07hiredmansame thing
18:07hiredmanthe x in the loop is a binding in a different scope form the x that is a function parameter
18:08hiredmaneven if x was a mutable binding, the new scope means it is different
18:08amalloycsd_: do you have a more specific code sample that's not working? your vague description has elicited an answer from hiredman which may be relevant but may be addressing a misunderstanding you don't actually have
18:08csd_I do although it's sort of complicated, one moment
18:08justin_smith&(loop [a 0] (loop [b 0] (print [a b]) (when (< b 3) (recur (inc b)))) (when (< a 3) (recur (inc a))))
18:08lazybot⇒ [0 0][0 1][0 2][0 3][1 0][1 1][1 2][1 3][2 0][2 1][2 2][2 3][3 0][3 1][3 2][3 3]nil
18:09justin_smithnested loops work just fine
18:09csd_https://www.refheap.com/93899
18:09hiredman(let [x 1] (let [x 2]) x) ; what is the value of x
18:09hiredman(loop [x 1] (loop [x 2]) x) ; what is the value of x
18:10amalloycsd_: more usefully trimmed: https://www.refheap.com/96c1de661ede454cd720ec531
18:11amalloyand in that code, of course x starts at 0 there, not at 5 or whatever
18:11csd_ama
18:11csd_ I realize that, but when I execute it, when y >= 1, x is always 5
18:11csd_or 4 i guess
18:11hiredmanwhat makes you think that?
18:12csd_hiredman: my results after running it
18:12amalloywell like, that is just obviously false. so we have to figure out why you think that
18:12dbaschcsd_: did you try the old (println x) in each iteration?
18:12hiredmancsd_: put a (println x) at the top of the loop
18:13hiredmanyou will either see 0, or some succession of numbers, either way you will be able to find the bug in your code
18:14hiredmanif you only see 0 it means the when around the recur is never happening, if you see a succession of values, something else is happening which ends up with oyu only seeing 5 on the way out
18:15sdegutisIs it possible to create an anonymous var, i.e. without def?
18:15amalloy&(doc with-local-vars)
18:15lazybot⇒ "Macro ([name-vals-vec & body]); varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set"
18:15csd_amalloy: I'm telling you it's what I'm getting after putting those printlns in
18:15justin_smithsdegutis: with-local-vars, but in practice it's mostly useless
18:15csd_just did it again
18:16sdegutisamalloy: Ha, I was just looking at that function out of curious too, assuming it was gonna be completely unrelated.
18:16danielcomptonFrozenlock: lein ancient can also run tests while upgrading and roll back breaking changes
18:16sdegutisjustin_smith: I want to run some tests on a function that takes a function var, but I don't want to do a ton of defn.
18:16hiredmanwhere did you put the println, and what exactly did it print?
18:16gfredericks(inc eastwood)
18:16lazybot⇒ 2
18:16dbaschsdegutis: also you can create regular variables without def
18:16csd_https://www.refheap.com/93903 and right above the inner if statement
18:17sdegutisdbasch: how?
18:17dbasche.g. with intern
18:17sdegutisOh right!
18:17sdegutisThanks :)
18:17justin_smithdbasch: that still creates namespace scope
18:18Frozenlockdanielcompton: Interesting! As a side note, lein-ancien dependencies are 'out-of-date' :-p
18:18dbaschjustin_smith: yes, that’s what I meant by regular :)
18:18amalloycsd_: right, and x is 0 every time. never 5
18:18danielcomptonteslanick: I think you want https://clojure.github.io/core.async/#clojure.core.async/put!
18:18hiredmanbecause the when is getting false and the recur is never happening
18:19teslanickdanielcompton: That would indeed be my preferred way of putting thing to the "lemme get back to you" channel
18:20csd_amalloy: I don't see why the loop wouldn't be resetting though
18:20Bronsa,(with-local-vars [x nil] x)
18:20clojurebot#<Var: --unnamed-->
18:20hiredmancsd_: put in a println for (and (< x *board-size*) (< (inc pos) *board-size*)) right before the when
18:20amalloycsd_: i don't have enough ?s on my keyboard for "huh???????????". the loop is obviously "resetting" to 0 every time. x is 0 every time you enter that loop
18:21csd_oh crap i see what's wrong now
18:21hiredman,(count (for [x (range 5) y (range 5)] nil))
18:21clojurebot25
18:21csd_:-/
18:22hiredmanso you are not seeing 25 lines there
18:25sdegutisThanks everyone for your time.
18:31teslanickjustin_smith, danielcompton: Thanks for you help -- it appears to be working well!
18:31danielcomptonteslanick: no problem, I take my payments in bitcoin
18:32teslanickI'm bitcoin-poor. I put all my real monies into dogecoin and gold.
18:33dbasch(tip teslanick 0.1 :verify)
18:41TimMcamalloy: Life hack: You can actually press a key multiple times, you don't need a separate key for each time you want to use a character in a sentence!
18:42TimMcI only have two "?" keys myself.
18:42amalloyTimMc: i am trying to support the hard-working americans in the keyboard-manufacturing sector
18:42amalloyi throw out my keyboard and switch to a new one every time a key is used five times
18:42amalloyexcept E. i'm not made of money
18:43TimMcamalloy: http://www.likecool.com/Home/Seating/Wolfgang%20Keyboard%20Bench%20Made%20from%202000%20Keys/Wolfgang-Keyboard-Bench-Made-from-2000-Keys.jpg
18:44technomancyamalloy: we should talk
18:45amalloytechnomancy: i can't buy an atreus. "Nothing quite matches the satisfaction of typing on a keyboard you've constructed with your own hands" just sounds too pretentious to me
18:46{blake},(map #(assoc {} (first %) (:c (second %))) {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}})
18:46clojurebot({:one 3} {:two 30})
18:47{blake}Does what I want but I still =dont= =like= =it=.
18:48llasram{blake}: what are you trying to do?
18:48amalloy{blake}: that is a weird way to write it, even if that is what you want
18:49amalloy,(let [m {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}}] (for [[k v] m] {k (:c v)}))
18:49clojurebot({:one 3} {:two 30})
18:49{blake}amalloy: Thanks.
18:49{blake}llasram: That's what I was trying to do. =P
18:50amalloy,(map (comp (partial apply hash-map) (juxt key (comp :c val))) {:one {:a 1 :b 2 :c 3} :two {:a 10 :b 20 :c 30}})
18:50clojurebot({:one 3} {:two 30})
18:50amalloyin case readability is not a concern
18:50{blake}lol
18:51{blake}(inc amalloy)
18:51lazybot⇒ 199
18:51{blake}holy cow...that's close
18:51turbofailpoint-free, as free as the wind blows
18:52{blake}Freedom's just another word for no points left to lose.
19:06dbasch(inc amalloy) because round numbers
19:07amalloydbasch: and then an automatic dec for a bad inc parser?
19:07dbasch(inc amalloy
19:08dbaschat least that didn’t work as expected
19:08amalloy)
19:08dbaschthat reminds me of some episode of a tv show I saw on a plane
19:10marcuscreohowdy all
19:10dbaschBig Bang Theory, episode named “Closure”
20:12gfredericksjust ran eastwood on a codebase I hadn't before; it found 1.5 legitimate problems, and dozens of illegitimate ones
20:12gfredericksthe latter coming from about 4 different classes of warnings
20:13gfredericksarguably one of those classes is a decent thing to warn about, but it's caused by a macro from a library
20:16justin_smithgfredericks: yeah, I don't think eastwood knows how to tell what came from a perfectly acceptable macroexpansion vs. sketchy code
20:18justin_smithgfredericks: andyf mentioned this when I suggested that fully namespace qualified symbols should get a warning (espeically if the namespace is not present anywhere in the require block)
20:18justin_smithturns out macros made with syntax quote do that all over, and eastwood can't tell the difference
20:21gfredericksyeah
20:21gfredericksin this case it's testing a constant
20:21gfrederickswhich could be avoided in the library's macro at the expense of extra complexity
20:27vermadoes clj-refactor require a running repl?
20:28vermaiow, can I use it with clojurescript etc. as well?
20:28weavejesterverma: Not for a lot of it
20:29vermaweavejester, nice, and works for cljs?
20:29weavejesterverma: I haven't tried, but I don't see why not.
20:29vermaweavejester, awesome, will give it a shot
20:29verma(inc weavejester)
20:29lazybot⇒ 9
20:30vermaze what?
20:30verma(inc weavejester)
20:30lazybot⇒ 10
20:30vermasince you answered two questions :P
20:30weavejesterOkay :)
20:33kenrestivoi think sitting in that wolfgang bench would make too much noise
20:37danielcomptondoes build.clojure.org publish snapshots anywhere?
20:38danielcomptonI can see they were built at http://build.clojure.org/job/core.logic/lastSuccessfulBuild/org.clojure$core.logic/
20:38danielcomptonbut I'm not sure how to specify them
20:40danielcomptongfredericks: you should try kibit as well while you're linting
20:55andyfgfredericks: What Eastwood version? And is it suspicious-expression warning ?
20:56andyfIf yes, and version 0.2.0, this is the (hopefully short lived) cost of no longer being fooled about things like (-> 1 (= 1)) by doing macro expansion
20:58andyfShort term improvement might be implementing something like "disable warning type x in macro expansions of my.name.space/bar"
20:59andyfOver weekend I was experimenting with adding tools.reader support to remember all comments and what forms they precede, in hopes of using specially formatted comments to annotate ASTs
21:24sdegutisJust found a new variation on "simple yet powerful", namely, "concise, powerful"! https://github.com/clojure/test.check
21:25turbofailsimperful, powcise!
21:28sdegutis(inc turbofail)
21:28lazybot⇒ 5
21:39gfredericksandyf: 0.2.0, yes
21:40gfredericksandyf: yeah I have a lot of suspicious-expressions from -> chains ending in (or x)
21:41andyfAnd they were originally created from something besides a 2-arg or, hopefully, since I should have silenced that case
21:43andyfWait, they were inside -> expressions, and thus should have had at least 2 args after macro expand?
21:44abakerwhat's the library du jour for logging -- timbre? tools.logging?
21:44danielcomptonabaker: clojure.tools.logging
21:46abakerthanks
21:50andyfgfredericks: If it is open source code base, would be interested in testing it myself. If not, and it uses core.match, I have plenty of similar examples already. In any case, some better form of warning suppression that can be limited to some macro expansions but not others is in order.
21:52andyfI may be worrying over something easy to solve, but syntax quote may be tricky to annotate at expression granularity, inside of the syntax quote expression.
21:53andyfBecause of how the reader transforms those. Makes me curious to know how cfleming does things in Cursive.
22:08gfredericksandyf: neither oss nor core.match
22:36sdegutisI should look into core.match more furtherly.
22:48sdegutisWhat does this do?
22:48sdegutishttps://github.com/weavejester/clofor/blob/master/src/clofor/core.clj
22:49justin_smithsdegutis: looks like it could be the beginnings of a source code reformatter
22:50sdegutisEarlier on, I had guessed it was some kind of ad-hoc language parser.
22:50sdegutisYour idea sounds legit.
22:55legittalon1,(= '' 'butts')
22:55clojurebottrue
22:55legittalon1why
22:55amalloylegittalon1: ' doesn't delimit strings
22:56legittalon1oh, dammit I keep getting bit by that
22:56amalloythat's the same as (= (quote (quote (quote butts')))), ie comparing one thing to nothing
22:59sdegutislegittalon1: haha
22:59sdegutis,~(= '' 'butts')
22:59clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
22:59sdegutis,'(= '' 'butts')
22:59clojurebot(= (quote (quote (quote butts'))))
22:59sdegutisWell there you go.
23:00sdegutis(dec amalloy)
23:00lazybot⇒ 198
23:00legittalon1usually the syntax highlighting warns me but I was on codewars and the highlighting is deifferent
23:00sdegutislegittalon1: same thing happened with me in Swift earlier today
23:00sdegutistried to use '', saw the syntax was weird, switched to ""
23:00sdegutis*saw the syntax highlighting was
23:01amalloythanks, sdegutis. i appreciate the extra entropy of your random inc/dec drivebys
23:01legittalon1(inc amalloy)
23:01lazybot⇒ 199
23:01legittalon1:)
23:01sdegutisamalloy: it was gonna be inc but you were getting too close to 200
23:02sdegutis(dec legittalon1)
23:02lazybot⇒ -1
23:02legittalon1,(inc legittalon)
23:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: legittalon in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:02legittalon1,(def legittalon 1000)
23:02clojurebot#'sandbox/legittalon
23:02legittalon1(inc legittalon)
23:02lazybot⇒ 1
23:03sdegutisLOL
23:03sdegutis,legittalon1
23:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: legittalon1 in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:03legittalon1well, I'm still pretty new to this lol
23:03sdegutisWell I've had some wine.
23:03legittalon1aha! I should have some wine
23:04amalloywe had a scotch tasting at work today
23:04insamniacare you hiring?
23:04sdegutislol
23:05amalloyi think so. factual is hiring like always
23:05insamniacmaybe i can sweep parentheses or something
23:05sdegutisI'm using compojure+clout and eschewing its GET-style macros.
23:05legittalon1sign me up for factual
23:05legittalon1I'll learn real quick
23:06legittalon10 to 100 real quick
23:06sdegutisIt's nice, I can define routes as functions like (defn ^:login show-products-page [params] ...)
23:06sdegutislegittalon1: What's factual?
23:06justin_smithsdegutis: what does compojure actually give you without those macros that you wouldn't get from ring/clout by themselves?
23:06legittalon1idk I'm guessing this http://www.factual.com/jobs/clojure
23:06insamniacsdegutis: http://factual.com/jobs
23:06insamniac(dec insamniac)
23:06lazybotYou can't adjust your own karma.
23:06insamniac:(
23:07legittalon1(inc insamniac)
23:07lazybot⇒ 3
23:07sdegutisjustin_smith: a function that takes handlers and turns them into a single handler that cascades requests among them until it finds one.
23:07legittalon1:)
23:07legittalon1 I'm trying to get a remote gig tbh not ready for a clojure job though. JS is my homeland
23:08sdegutisjustin_smith: I'm using compojure.core/make-route and /routes
23:08justin_smithOK
23:08sdegutisjustin_smith: And I'm eschewing let-request for something more like this: https://gist.github.com/sdegutis/b376cf100e337941d826
23:10sdegutisThe exact protocol is a bit in flux right now, but I think I'm settling on: if the first element of :argslist is 'req, pass the request there and precede to the next step omitting the first parameter; then use fancy-call on this with (:params req).
23:10sdegutisThis allows you to just specify the params, or if need be, to add the request as the first param too.
23:11justin_smithsdegutis: have you seen how similar your fancy-call is to prismatic's fnk by the way?Ehttps://github.com/Prismatic/plumbing/tree/master/src/plumbing/fnk#fnk-syntax
23:11sdegutisyou broke my autolink :)
23:11justin_smithhttps://github.com/Prismatic/plumbing/tree/master/src/plumbing/fnk#fnk-syntax
23:12sdegutisjustin_smith: Oh nice!
23:12sdegutisI feel validated :)
23:13justin_smithdifference is, instead of making a new kind of call, they make a new kind of defn
23:13sdegutisGranted, I'm not a fan of using other people's APIs, only their implementations, so that I have freedom to change my APIs as my own domain evolves.
23:14sdegutisAlso, I prefer to push it on the caller side, not the callee side, so that I can just use Plain Old Clojure Things™ like defn.
23:14sdegutisUsing metadata allows me to be creative while still maintaining flexibility and simplicity.
23:14sdegutisLike, I can do (defn ^:route ^:eula download-product [] ...) to specify that (1) this is definitely a route and not a typo, and (2) it requires the user to sign a EULA before continuing.
23:15sdegutisThat doesn't require any special requires or APIs.
23:36kenrestivoany ideas what those weird blue and green circles mean in crossclj? i.e. http://crossclj.info/ns/rewrite-clj/0.3.11/project.clj.html
23:37hiredmanUses 6 artifacts; transitively uses 110 artifacts