#clojure logs

2014-03-28

00:07MadFunkamalloy: aye, that sounds very reasonable. thank you. I was pretty sure I was trying to be cleverer than I need to be (or actually am lol).
00:08MadFunkI was basically trying to brute force it.
00:11Anderkentcan anyone explain this to me
00:11Anderkent,(bytes (byte-array [1 2 3]))
00:11clojurebot#<byte[] [B@13abee1>
00:11Anderkent,((do bytes) (byte-array [1 2 3]))
00:11clojurebot(. clojure.lang.Numbers clojure.core/bytes #<byte[] [B@6dd60e>)
00:11Anderkentbecause I'm lost
00:12Anderkentthe lostest
00:12beamsoi'm lost because (byte-array [1 2 3]) gives me a classcastexception
00:13Anderkentjust do (byte-array (map byte [1 2 3])) , i think that was relaxed in 1.6
00:14amalloy~def bytes
00:15beamsobytes appears to just cast the argument to byte[] by the looks
00:15Anderkentyeah I guess I don't understand inline fuctions, if that's expected behaviour?
00:16amalloyAnderkent: no, no way is that expected
00:16amalloyi just wanted a source link to try and figure it out
00:17beamsowhat is expected to happen?
00:17amalloydefinline is supposed to just allow (f x) to expand into a more efficient form
00:18amalloythan calling something like ((identity f) x)
00:18Anderkentbeamso: they should do the same
00:19Anderkenti think it must be a compiler bug?
00:19amalloyAnderkent: i kinda doubt that. the compiler isn't even involved in the behavior you don't like, just the macroexpander
00:20amalloyor, well, the uh...function defined by the macro definline
00:20Anderkentwell, what looks at the :inline meta?
00:21Anderkent,(pprint (macroexpand (read-string (with-out-str (source bytes)))))
00:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:21Anderkentblah
00:22amalloyAnderkent: :inline is looked at exclusively by Compiler/analyzeSeq
00:22amalloybut it won't be looked at in the case that's troubling you
00:22amalloyit's the non-inline version that's broken
00:25Anderkent,clojure.pprint/pprint
00:25clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.pprint, compiling:(NO_SOURCE_PATH:0:0)>
00:25amalloy&((identity bytes) (byte-array [1 2 3]))
00:25lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Byte
00:25amalloy&((identity bytes) (byte-array (map byte [1 2 3])))
00:25lazybot⇒ (. clojure.lang.Numbers clojure.core/bytes #<byte[] [B@2e03c8>)
00:25amalloyokay, so not a new problem in 1.6
00:26Anderkentyeah checked back to 1.2
00:26Anderkent,(macroexpand (read-string (with-out-str (source bytes))))
00:26clojurebot#<SecurityException java.lang.SecurityException: denied>
00:26Anderkentreaaly now
00:26Anderkentanyway
00:26Anderkentrunning that amcroexpanded defn manually seems to work, so it must be inline-related
00:27Anderkentor hm
00:28Anderkent(. clojure.lang.Numbers clojure.core/bytes xs)
00:28Anderkentthaht symbol being namespaced is suspicious
00:28amalloyAnderkent: nah, that happens all the time
00:28amalloyin (. foo bar/baz), the compiler ignores bar
00:30amalloyAnderkent: even if i run that definline in my repl, without macroexpanding it by hand first, bytes goes back to the "expected" behavior
00:30Anderkentyeah
00:31Anderkentjust found that out too
00:31amalloyso i posit that the source we're looking at for bytes is not actually the code that is running. something else redefines bytes
00:31amalloyand yet, clearly nothing does. a puzzler
00:32amalloydo the other inline functions have this problem? i don't think so
00:32Anderkentyes they do
00:32amalloy,((do +) 1 2)
00:32clojurebot3
00:32Anderkentoh not all
00:32Anderkentjust the `definline` ones
00:32Anderkent,(source +)
00:32clojurebotSource not found\n
00:38Anderkentbah, nodisassemble cant disassemble byte
00:38Anderkent*bytes
00:39Anderkentah nvm im doing it wrong
00:44Anderkenthm
00:45Anderkenthow does clojure decide whether to re-generate a .class file?
00:46amalloyi don't think it does that unless you call compile. but it may re-eval .clj files even if there's a .class file that supplies the functionality? i'm not sure
00:46AnderkentI edited core.clj within clojure.jar changing definline slightly then rolling that back
00:46Anderkentnow it works as expected
00:46Anderkenttheres a definline.class ...
00:47amalloyAnderkent: i'd be interested to see what happens if you just remove *.class from clojure.jar
00:47amalloyat that point i presume it recompiles everything
00:48amalloyi'm speculating that perhaps clojure/core$bytes.class was generated by some weird process and is stale at this point, since it contains list-manipulation code instead of the single static-method call it should have
00:52Anderkentamalloy: not that easy, because without clojure.main life is hard!
00:57Anderkentamalloy: oh. http://dev.clojure.org/jira/browse/CLJ-1227
01:01amalloyah. and caused by http://dev.clojure.org/jira/browse/CLJ-1330, Anderkent
01:01amalloyso that makes sense sorta
01:01AnderkentExcept that link says it's since 1.6.0-alpha2
01:02Anderkenti guess it's just a bad blame
01:04Anderkentoh nvm it's 1.2
01:04Anderkenti was misled by the tag
01:17avshalomanyone know if intellij cursive integrates with a debugger?
01:18beamsoi've struggled to run programs inside of cursive so i've no idea
01:25dbellsay I have '([:a 1] [:b 2] [:c 3] [:d 4] [:e 5]) and I want '([:a :b :c :d :e] [1 2 3 4 5]) Does anyone look at that and have an *intuitive feel* for how they'd do that with a minimum of boilerplate?
01:26dbellthe smiley is \:d
01:26dbell: d
01:27gunsdbell: (map vector [:a 1] [:b 2] …)
01:27dbelloooooooooh
01:28gunsblew my mind too when it was introduced to me
01:28dbellthat is pretty freaking slick
01:30rplacaif you really have it in a list as shown, you can
01:30rplaca,(apply (partial map vector) '([:a 1] [:b 2] [:c 3]))
01:30clojurebot([:a :b :c] [1 2 3])
01:44SegFaultAXrplaca: You don't need partial there, apply collects all arguments into the last arg ##(apply map vector [[:a 1] [:b 2] [:c 3]])
01:44lazybot⇒ ([:a :b :c] [1 2 3])
01:48rplacaoh yes, of course!
01:49rplacamy mental model wanted to glue the "map vector" into one magic thing, but really vector is just an argument like any other
02:35yuri_niyazovWhat's the status of clojureql?
02:35yuri_niyazovclojureql.org seems to be a hijacked website
02:41SegFaultAXyuri_niyazov: Awesome markovs.
02:52fro_what kind of music are you listen while you are coding? To those who likes metal and electronics I recommend to try https://www.facebook.com/TheAlg0r1thm - it's amazing mix of.
03:32charewhen I run lein repl how does lein know what jvm to run? Is there a way to control that?
03:33ivanchare: set JAVA_CMD or LEIN_JAVA_CMD
03:34ivanotherwise it uses the java in the PATH
04:58l3dxhow can I configure lein to use clj 1.6 when starting the repl outside a project?
05:18chareis anyone awake?
05:18charehave any of you done a speed comparision between clojure, python django, and ruby rails?
05:24winkchare: http://www.techempower.com/benchmarks/ might be worth alook
05:25charewink wtf how is go winning?
05:25winkask them, not me. you can clone all of the tests and run them for yourself
05:25winkthey started a benchmarking spree and a lot of folks contributed
05:26charewink when did the go runtime and optimizer get so fast?
05:26wink1.2 probably
06:11jph-im surprised by rack-jruby
06:15khaled_why dont you by jack ruby (sorry jokin)
06:17jph-it's interesting to see performance drop significantly on luminus... i wonder if that's to do with out of box defaults
06:19ddellacostajph-: what are you using rack-jruby w/clojure for? some rack-app interop stuff?
06:20jph-no no
06:20jph-im just looking at the benchmark site
06:20krasWhats wrong with this code: http://pastebin.com/WkWVY2sg
06:20ddellacostajruby-rack I should say
06:20jph-i came from ruby, i dont like it being faster than clojure
06:20jph-heheh
06:20krasI get a stackoverflow
06:20ddellacostajph-: ah, haha...
06:21jph-clojure was meant to be my step up in speed without having to learn Go
06:21jph-so i shake my fist at rack-jruby
06:21krasstackoverflow when I run (module_declarations zp) where zp is a zipper
06:21kras(module_declarations zp)
06:21ddellacostakras: try using loop rather than recursing without a accumulator
06:22krasddellacosta: As I see there is nothing to accumulate here, I just return the location in the zipper when it matches something
06:24ddellacostakras: okay, so sorry I mentioned using an accumulator. But clearly you are taking up a lot of space by recursing like that. So try using loop instead.
06:27yotsovkras: you might want to play with the stack size (-Xss option on hotspot) to see if there is a value which allows your code to complete, or if you get stackoverflow even when it is maxed
06:34kaw_The key being recur rather than loop there, I think, since a defn should already be a recursion point?
06:35krasChanging the code to use loop atleast got rid stackoverflow error but the code is still running since paste 5 mins http://pastebin.com/ugDxccAu
06:36ddellacostakaw_: I should have been more explicit...it's the end of the day and I'm tired. :-) But yeah, I meant loop/recur. Great explanation of that and other techniques here: http://stackoverflow.com/questions/1662336/clojure-simple-factorial-causes-stack-overflow
06:36krasyotsov: how do I check what the stack size is currently set to? Sorry noob here
06:37jph-i remember starting clojure, thinking "when am i going to do this recursive looping stuff?"
06:37jph-they hide most of that from you
06:37jph-bastards
06:37ddellacostakras: so, your if clause is failing? re: stack size, you can set that in your project.clj file.
06:37ddellacostakras: or just java args
06:38ddellacostakras: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L229-L230
06:38krasjph-: same here, this problem looked very trivial when I started, probably need to to get used to clojure's way of thinking
06:38krasddellacosta: thanks a lot, will take a look
06:39ddellacostakras: well, part of what's going on is that zipper is going to rebuild the data structure each time--it's returning immutable versions of the same thing, you know? So if you do recursion the way you're doing it, it's going to take up a lot of space fast.
06:39krasddellacosta: if my if clause if failing ..... oops forgot to check the end?
06:40ddellacostakras: I just mean, it seems like your code would be correct, but obviously it's not returning from the if condition, right?
06:40ddellacostakras: so not sure what else it would be
06:41krasddellacosta: indeed my if condition is failing but since I am not checking the end? here the z/next will keep the whole thing in an infinite loop I guess
06:41kraswill test it and confirm
06:45krashttp://pastebin.com/3EMP9L6p the following code seems to be working, atleast its returning nil
06:45krasneed to refactor it a more I guess
06:46ddellacostakras: ah, right, I didn't think about end either
07:12krascoming to the heap-size/stack size, how do I check these values interactively in the repl?
07:33gfredericksstack size could be done by creating an exception? but heap isn't easy to get a useful handle on
07:35gfredericks,(-> (Exception.) (.getStackTrace) (count))
07:35clojurebot37
07:36gfredericks,(defn stack-depth [] (-> (Exception.) .getStackTrace count))
07:36clojurebot#'sandbox/stack-depth
07:37beamso50% off clojure books at o'reilly using discount code WKCLJUR .
07:40gfredericks,(map (fn [_] (stack-depth)) (concat (repeat 3 3) (repeat 2 2)))
07:40clojurebot(49 51 51 51 51)
07:41gfredericks,(map (fn [_] (stack-depth)) (reduce concat (map list (range 5))))
07:41clojurebot(49 51 51 51 51)
07:42gfredericks,(map (fn [_] (stack-depth)) (reduce #(concat %2 %1) (map list (range 5))))
07:42clojurebot(49 51 51 51 51)
07:42gfrederickshuh. I figured it'd be easier to get different results
07:45gfredericksI guess the outermost map does all the stack-normalizing before it ever calls stack-depth?
07:56gfredericks,(->> (repeatedly 5 #(repeatedly 1 stack-depth)) (reduce concat))
07:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: stack-depth in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:56gfredericks,(defn stack-depth [] (-> (Exception.) .getStackTrace count))
07:56clojurebot#'sandbox/stack-depth
07:56gfredericks,(->> (repeatedly 5 #(repeatedly 1 stack-depth)) (reduce concat))
07:56clojurebot(72 69 64 59 54)
07:56gfredericksah HA.
07:56gfredericks,(->> (repeatedly 50 #(repeatedly 1 stack-depth)) (reduce concat))
07:56clojurebot(297 294 289 284 279 ...)
07:57gfredericks,(->> (repeatedly 150 #(repeatedly 1 stack-depth)) (reduce concat))
07:57clojurebot(797 794 789 784 779 ...)
08:47yotsovgfredericks: stack size is governed by quantum physics: the only way to look at it changes it :)
09:04cYmenHow do I activate "lisp mode" for cljs files in emacs?
09:10beamsoadding clojure-mode seems to give me lisp recognition for .cljs files
09:10beamsobut i use emacs prelude
09:11cYmenSo uh..what is emacs prelude and what is is clojure-mode and how do I add it?
09:12beamsohttp://batsov.com/prelude/
09:12beamsoclojure-mode is in elpa
09:12cYmenelpa?
09:12clojurebotelpa is a package manager for Emacs: http://tromey.com/elpa
09:13cYmenHm...so assuming I already have clojure-mode (since everything works for clj files) how do I activate it for cljs?
09:13beamsoi'm not familiar enough with the mode to give you that answer
09:14beamsohave you tried making sure you're running the most up to date version of the mode?
09:14cYmenNo...
09:18cYmenI seem to have clojure-mode installed using marmalade...
09:18tmcivercYmen: generally, you add a mode hook in your ~/.emacs: http://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Hooks.html:
09:19tmcivercYmen: no wait
09:21tmcivercYmen: you add to the auto-mode-alist to have the mode turn on when you open a certain file type: (add-to-list 'auto-mode-alist '("\\.cljs$", . cljs-mode))
09:21tmcivercYmen: http://www.emacswiki.org/emacs/AutoModeAlist
09:26cYmen(add-to-list 'auto-mode-alist '("\\.cljs$" . clojure-mode)) this did the trick
09:27cYmentmciver: thank you very much!
09:29tmcivercYmen: ah, that makes sense. You're welcome.
09:46bontucodeI am new to clojure and struggling to write a construct, where in a loop a result is populated by result of a recursive call
09:46jcromartiebontucode: I'd be glad to help
09:46cYmenbontucode: Show us what you've got! :)
09:47jcromartiecan you paste a snippet of code to Gist or something?
09:47jcromartiepeople like refheap too
09:47bontucodejcromartie: thanks
09:50bontucodehttps://www.refheap.com/67376
09:51jcromartiefirst thing: `loop` is meant to be used with `recur`
09:51bontucodejcromartie, cYmen: I would like to concat the return value of count-tuples with result vector
09:52bontucodejcromartie: realised that, but not sure the best place to use recur, as it should be the last line, I tried to put a (recur result) at the end
09:52jcromartie~for
09:52clojurebotfor is not used enough
09:52jcromartieoh, that's not what I thought clojurebot would say :)
09:52augustlhaha
09:52jcromartiefor is not a loop!
09:52augustlI concur, I use loop/recur too much..
09:53jcromartiebontucode: `for` is a comprehension which returns a seq, not a looping construct like in java/C
09:53bontucodejcromartie: so I will replace it with a map and range
09:53jcromartiebontucode: sorry I don't quite grok it, but what's the intended input/output here
09:54cYmenbontucode: Basically it works like this: (loop [some variables] ........ (recur newvaluesforvariables))
09:55bontucodejcromartie: Trying to solve this problem: http://community.topcoder.com/stat?c=problem_statement&amp;pm=13016&amp;rd=15846 (I am not good at clojure and dynamic programming both), but if intended outcome is for the range between low to high, it should return me sequence of all combinations of size K
09:55jcromartiealso it looks like n is not used
09:56jcromartieOK that's helpful thanks
09:56jcromartieyeah, it can be big shift from procedural to functional
09:58bontucodejcromartie: Sorry, sequence of size "N".. I am just at the first stage solution of generating all sequences of size N, next will be a filtering based on the GCD of the sequence that is equal to K
09:58jcromartiesure
09:59jcromartieP.S. docstrings are good, maybe start over with this to help: https://www.refheap.com/67377
10:00jcromartienow nobody can be confused about what your function is supposed to do :)
10:00cYmenwell, it's still called "count-tuples" :p
10:00jcromartieyeah that's straight from the page
10:01jcromartieit is supposed to return the count, updated docstring :P
10:02bontucodejcromartie: point noted :)
10:02jcromartieI think that the point of this exercise is likely not, in fact, to compute all of the sequences…
10:03bontucodejcromartie: yes at this stage I am just trying to generate set of sequences
10:03cYmenbontucode: Try a simple helper first. Write a function that takes a sequence of integers and builds all possible sequences of length n from these integers.
10:04ornicarhello, what's the @ in clojure? Like in `(::http/response-stream @http-agent)`
10:04cYmenso (your-function [1 2 3] 2) -> [[1 1] [2 2] [3 3] [1 2] [2 1] [1 3] [3 1] [2 3] [3 2]]
10:04ornicarit's very difficult to find the answer to this question on Internet.
10:05cYmenornicar: that's used for atoms
10:05jcromartienot just atoms
10:05jcromartieornicar: it means "dereference"
10:05cYmenhttp://clojure.org/atoms
10:05ornicarok, thank you, that I can google
10:05jcromartiei.e. for a reference type (atom, agent, ref, future) return the value
10:05ornicarmakes sense!
10:05cYmenornicar: listen to him he knows more than me! :)
10:05ornicarwhile we're at it... in the same expression, what's ::
10:05jcromartie@foo expands to (clojure.core/deref foo)
10:05bontucodecYmen: on the job
10:06ornicarI know :foo is the symbol foo, but what is ::foo ?
10:06ornicarthe symbol :foo ?
10:06jcromartie,::foo
10:06clojurebot:sandbox/foo
10:06jcromartie,(println ::foo)
10:06clojurebot:sandbox/foo\n
10:07jcromartieornicar: it expands to a namespaced keyword in the current namespace
10:07ornicarok, thank you very much!
10:07jcromartieuseful for when you have maps that may have keys from different places
10:08ornicarI naively thought keys were global
10:08ornicarbut they're namespaced, that's great
10:08jcromartiewell keywords are just values
10:08cYmen...
10:08cYmenAny my head is like "keywords cannot be namespaced...keywords are MAGIC!"
10:09jcromartieit's just "namespaced" in the sense that it has a namespace part and a name part
10:09jcromartie,(name ::foo)
10:09clojurebot"foo"
10:09jcromartie,(namespace ::foo)
10:09clojurebot"sandbox"
10:09cYmen,(namespace :foo)
10:09clojurebotnil
10:09jcromartiebut you could just as easily define :sandbox/foo anywhere else
10:09jcromartie,(namespace :bar/foo)
10:09clojurebot"bar"
10:10cYmenI have no idea what this means. :p
10:10gfredericks$google clojure overloads namespace
10:10lazybot[Operator Overloading in Clojure - Stack Overflow] http://stackoverflow.com/questions/1535176/operator-overloading-in-clojure
10:10gfredericks$google gfredericks clojure overloads namespace
10:10lazybot[gfredericks/hacklog] http://hacklog.gfredericks.com/
10:11gfredericksthat'll work
10:11gfrederickscYmen: ^
10:12jcromartiethe difference is that a namespaced var is *defined* in a namespace, i.e. clojure.core/map is a var in clojure.core, named "map" and it's value is the map function
10:12cYmengfredericks: What is a PSA?
10:12gfredericksclojurebot: PSA is a public service announcement
10:12clojurebotIn Ordnung
10:12jcromartiebut a namespaced keyword is just a *value*, and the namespace/name are really just a convention
10:12jcromartietl;dr don't worry about it
10:12gfredericksthey're two concepts that are technically independent but still have a lot of overlap
10:36futileIs there a lib for faking out the file system in Clojure?
10:41clgvfutile: just build functions in your application through which you access files then you can mock those functions. you probably need them anyway
10:42gfredericksusing raynes/fs would enable that presumably
10:42futileI see.
10:42futileThanks.
10:42RaynesFaking out the file system?
10:42RaynesRaynes fs would enable that?
10:42RaynesDO EXPLAIN
10:42gfrederickswith-redefs
10:42RaynesFair enough good sir.
10:43RaynesFair enough.
10:43clgvRaynes: somehow you sound like a bot today. too much coffee?
10:43clgv;)
10:43Raynesclgv: Abscessed tooth and massive associated infection causing the right side of the face to swell to the point of nearly shutting my right eye.
10:43RaynesBut close!
10:44clgvRaynes: ouch! get well soon.
10:44futileIt seems strange that java.io.File/createTempFile takes a prefix and a suffix, and even more so that it doesn't even insert a "." for you between them.
10:44Raynesfutile: fs implements temporary file and directory creation itself.
10:45futileRaynes: excellent
10:45clgvfutile: dots are not that important except from when you are on windows ;)
10:46futileclgv: touche
10:49gfredericksreiddraper: I'm about to write a generator for characters that don't shrink, so that strings/keywords can be built on that; would that be a reasonable default behavior for test.check?
10:49gfredericksshrinking :abc to :abb doesn't feel helpful to me in a lot of use cases
10:50gfrederickswe could also do it just for keywords (not strings)
10:51clgvgfredericks: random permutations and vectors of distinct numbers of a given range would be great as well^^
10:52reiddrapergfredericks: have you seen the noshrink function?
10:52gfredericksnope!
10:52clgvgfredericks: I guess an explicit generator for those would be more efficient compared to generating arbitrary integer vectors and checking them via a predicate
10:53futileRaynes: you should set the docs for FS to link to the source on github.
10:54RaynesI should get rid of the docs.
10:54futileRaynes: why?
10:54gfredericksreiddraper: ok, this helps a lot; is probably good enough
10:54RaynesBecause the code is pretty good documentation.
10:54clgv:/
10:54futileRaynes: People like me prefer good docs.
10:54RaynesI don't see how a list of functions is 'good docs'
10:55clgvuser stories of using the lib are good docs ;)
10:55RaynesThere is literally no difference between scanning through the web API docs than just scanning through the actual source file itself
10:55futileok
10:55RaynesThat's my only point.
10:56futileWhy is there both https://clojars.org/fs and https://clojars.org/me.raynes/fs ?
10:57RaynesThe former is prior to me using groupids for my projects.
11:03futileAh.
11:53muhoofwiw, when i want api docs in html format, i just run marginalia on the codebase
11:54muhoomakes it nice 'n purty
11:55katratxomuhoo: it just works?
11:55muhookatratxo: yeah, you can run it on someone else's codebase
11:55muhoono api docs? no problem. bang, api docs.
11:55katratxomuhoo: nice!
11:56muhoo http://fogus.me/fun/marginalia/ fyi
11:57muhooactually, better link: https://github.com/gdeer81/lein-marginalia
11:57gfredericksaggressive shrinking idea: tuple should first try shrinking everything at once
12:01muhoolol fogus "Here is a snowman ☃"
12:04cbpstumped by a CA? :-p
12:07twem2irc
12:13TravisDWith lein, is there an easy way to get a REPL outside of a project with dependencies? I want to use Incanter to prod some data, but i'm not ready to start a project
12:13snowstalkerTravisD see lein-exec
12:13technomancyTravisD: you can put them in a profile and run `lein with-profile +incanter repl`
12:14TravisDAh, cool, thanks :)
12:14TravisD(inc technomancy)
12:14lazybot⇒ 103
12:19TravisDprofiles are merged into the project config with (partial merge-with into), or something?
12:20technomancyTravisD: it's a bit more nuanced than that, but that understanding should get you pretty far
12:20TravisD:)
12:31gfredericksclojurebot: it is a bit more nuanced than that, but that understanding should get you pretty far
12:31clojurebotOk.
12:31hyPiRionclojurebot: is?
12:31clojurebotis is commutative
12:31hyPiRionclojurebot: it?
12:31clojurebotit is a bit more nuanced than that, but that understanding should get you pretty far
12:31TravisDclojurebot: it is a?
12:31clojurebotHuh?
12:31TravisD:(
12:32gfredericks~it
12:32clojurebotit is for clojure.pprint/cl-format :)
12:32hyPiRionheh
12:32gfredericks~it
12:32clojurebotit is for clojure.pprint/cl-format :)
12:32gfredericks~it
12:32clojurebotit is a lie
12:32gfredericks~it
12:32clojurebotit is greek to me
12:32gfredericks~it
12:32clojurebotit is a bit more nuanced than that, but that understanding should get you pretty far
12:33gfredericks"We're a small startup hacking together to try to build the first real life clojurebot."
12:37hyPiRiongfredericks: "We're a startup trying to understand how clojurebot works"
12:38gfredericks"We're a startup trying to automate the process of bringing a startup from pre-concept to IPO."
12:39hiredmanclojurebot: clojurebot is the cloud
12:39clojurebotRoger.
12:41gfrederickswe're a marketing-only startup trying to find ways to convince people to give us money without providing any goods or services
12:41hiredmanI want to take slogans from those ibm adds you see at airports, run them through a parts of speech tagger, replace the first noun with clojurebot, and then randomize the rest of the nouns
12:41technomancyyes please
12:42hiredmanthen feed all that back in to clojurebot
12:42AnderkentTravisD: I also like lein try: lein try <artifact-name> <version>?
12:42Anderkentit'll find the by defualt latest release of the artifact and give you a repl with it
12:42hiredmanclojurebot: clojurebot |queues| for elephants
12:42clojurebotOk.
12:42TravisDAnderkent: cool, that's pretty light weight
12:43malyngfredericks: Here's your pitch video -- https://www.youtube.com/watch?v=2YBtspm8j8M
12:43TravisDcan you load multiple artifacts?
12:43Anderkentno, but it should be pretty easy to add
12:43Anderkentpull request go! :P
12:43TravisDhaha
12:43TravisDgo go pull request?
12:43Anderkentactually
12:43Anderkenti ilied
12:43Anderkentyou can
12:43TravisDoh hurray
12:43technomancylein-try is useful if you don't want to store the dependency set in your profiles file on disk
12:44TravisDyeah, for me I think it's actually better to have a profile. There are a few dependencies that I often want to use
12:44technomancyseems like it's intended for one-offs primarily
12:44technomancyhehe https://twitter.com/sorenmacbeth/status/449412230803517441
12:44gfrederickslein-try: for when the latency of going to disk is too high for the dependencies you need
12:44TravisDheh
12:44saolsenanybody have an examply of using om with canvas drawing?
12:45gfrederickssaolsen: I've been wondering about SVG; haven't done any searching though
12:46malynsaolsen: There is at least one SVG example out there, but I haven't seen anything for Canvas (doesn't mean it doesn't exist though).
12:46saolsenyeah, svg could be cool. I found this https://github.com/facebook/react-art
12:47malynsaolsen: SVG and Om https://github.com/kovasb/yantra/blob/master/src/cljs/yantra/graphics.cljs
12:47Anderkentgfredericks: I usually use it when I can't be bothered looking for version strings
12:50gfredericksI can't come up with a good joke for that except to say that I'm imagining somebody sitting in a fast food restaurant cramming clojure libraries into his mouth
12:50gfredericks(and not bothering looking for version strings of course)
12:53bontucodecYmen: Managed to generate all sub-sequence of length n for a given collection of numbers here. It will be great if you could review it: https://www.refheap.com/67402
12:55Bbarretti am trying to create a java file object to be passed as a parameter to a function
12:55Bbarrettwhat is the best way to do that?
12:56cbp(File. "foo") ?
12:56TravisDRelated to my earlier questions, is there a way to get cider running in a directory without creating a lein project? After working in the terminal for a little bit with nREPL, I'm realizing how much I miss cider :(
12:56Bbarrettthanks
12:56bontucodecYmen_: Managed to generate all sub-sequence of length n for a given collection of numbers here. It will be great if you could review it: https://www.refheap.com/67402
12:58jcidahoTravisD, just do M-x cider - localhost & port - should spin up a new repl
12:59BbarrettI am trying to pass a file parameter to a function and get it's size using the .length method, but it returns 0 no matter what
12:59Bbarrettthought I was properly defining it as a file, but not sure
12:59TravisDjcidaho: do I have to start nREPL manually that way?
12:59technomancyTravisD: the current directory will be wherever you jacked in from
13:00TravisDtechnomancy: Ah, and can I get it to use include a lein profile when it starts?
13:00technomancyTravisD: cider-server-command
13:00technomancyshould do it
13:01cbpBbarrett: If (type my-file) returns File then it's a file, though it may not exist
13:02Bbarrettthanks
13:02BbarrettI will check it out
13:02TravisDtechnomancy: Fantastic :)
13:02TravisDIs it a bad idea to permanently modify my cider-server-command?
13:03malynBbarrett: You might check out the fs library as well -- https://github.com/Raynes/fs
13:03Bbarrettah, thanks, I definetely will
13:03BbarrettI have heard good things
13:10technomancyTravisD: depends what you do
13:11TravisDtechnomancy: I might make another function called incanter-jack-in which modifies cider-server-command, jacks in, and then reverts it
13:11TravisDor something.
13:12gtrakTravisD: it's ok, emacs is accretion of hacks.
13:15gtrak' the formation of planets and other bodies by collection of material through gravity;'
13:15gtrakis a fitting analogy
13:29AnderkentAnyone familar with clojure improvement process? When shuold I expect http://dev.clojure.org/jira/browse/CLJ-1330 to land - weeks, months, longer?
13:31BronsaAnderkent: who knows. if you can vote the ticket so it will hopefully get more visibility
13:33gtrakI'd expect it to get in to 1.7
13:34gtrakit was a little late for 1.6
13:35gtrakthere's only 3 bugs with 'critical' priority, and that's one of them.
13:44bontucodeCould some one review my solution for a top-coder problem: http://community.topcoder.com/stat?c=problem_statement&amp;pm=13016&amp;rd=15846
13:45bontucodehttps://www.refheap.com/67435
13:45bontucodeIt fails for the sample input no 3 that's on the problem page
13:46bontucodewith stackoverflow
13:46bontucodeI may need to have a interative solution for create-sequence instead of a recursive one
13:46jcromartiebontucode: you may be able to make it recursive, but not like that
13:47jcromartieyou can recur forever with `recur`
13:47jcromartiecalling (create-seq) within create-seq itself consumes stack
13:47jcromartieClojure makes tail-recursion explicit
13:47jcromartieor rather it requires it to be explicit, to get any benefit
13:48bontucodejcromartie: so is using loop, recur like a iteration? or is it actually a recursion that I dont understand well
13:49jcromartieyou can use recur without loop
13:50jcromartie,((fn [x] (if (> x 0) (recur (dec x)) "zero!")) 10)
13:50clojurebot"zero!"
13:51jcromartiealso (if x true false) may as well be just x
13:51Anderkentjcromartie: (boolean x) surely
13:51jcromartiei.e. (filter #(= (gcd-polynom x) k) …)
13:52Anderkentah nvm didnt see the filter context
13:52jcromartieAnderkent: technically I suppose but in this case...
13:52Anderkentyeah sorry
13:52jcromartieer that is irc://irc.freenode.net:6667/#(= (gcd-polynom %) k)
13:52Anderkent:D
13:52bontucodejcromartie: totally, that was silly
13:53sdegutisRaynes: fs/copy ignores my file's permissions, is there a way to make it use the same permissions?
13:54RaynesFork fs and send me a pull request :P
13:54sdegutisSeriously?
13:54RaynesWell, if it doesn't adhere to permissions then I think so.
13:54sdegutisHmm, it's using io/copy, I wonder if that even takes permissions into account.
13:55sdegutisdoes not appear so -- http://clojure.github.io/clojure/clojure.java.io-api.html#clojure.java.io/copy
13:56Anderkenti don't think it's even doable on java 6
13:57Anderkenton java 7 i think you want Files.copy(Path, Path, COPY_ATTRIBUTES)
13:59sdegutisOh wow.
13:59sdegutisThat's fine, I can just use fs/chmod
14:01sdegutisWho'da thunkit that correctly copying file permissions would be the hardest part of this utility.
14:01Anderkentright, but you can't really trust that, race conditions galore
14:01sdegutisOr at least most tedious.
14:02sdegutisBesides permissions, this thing is pretty much done :D
14:02gtrakmuch permit
14:03gtraki had the same problem trying to unzip files with java
14:03bontucodejcromartie: I am not very clear on how to use recur in this situation. I need to update the "result" based on the output of the recursion, I may still be thinking of recur as actual recursion. could you clarify here please?
14:03Bbarrettwhat is the best way to search for a sub-string within a string in clj
14:03Anderkentgoddamnit
14:03Anderkentctrl-cing gpg password prompt messes your terminal up *real good*
14:03Bbarrett.contains is only for maps or vectors right?
14:03VfeFor a very frequently called function(potentially tens of thousands of times a minute) is there any appreciable performance different between if and cond?
14:04Bbarrettor contains? rather
14:04AnderkentBbarrett: maps and sets really, vectors i'd call it iffy
14:04Bbarrettokay
14:04gtrakVfe: cond is if in the macroexpansion.
14:05justin_smithVfe: case can be much faster than cond though
14:05jonasenBbarrett: (re-find #"bar" "foobar")?
14:06Bbarrettahh
14:06justin_smith(direct jumps based on result's identity vs. call / jump / call / jump ...
14:06justin_smith)
14:07VfeThanks for the info :) Trying to see if I can get server usage % down a bit and there’s really no big things in profiling, so im down to optimizing the small stuff if it makes sense
14:07jonasenBbarrett: or maybe (.indexOf "foobar" "bar")
14:08Bbarrettexcellent
14:08Bbarrettthanks
14:10AnderkentDid anyone get lein + gpg working on a mac? I need to manually do `gpg --sign` and `gpg --decrypt dummy-file` and enter the passphrase (each time) before lein deploy clojars works. It's a huge pain.
14:13sdegutisWhat are the file-permission workarounds in Clojure/Java?
14:14amalloywork...arounds? like, something more devious than just setting correct file permissions?
14:14sdegutisFor when copying files
14:14amalloyAnderkent: i know Raynes and ninjudd both had it working on their macs at geni
14:15Vfe:Anderkent I have it working as well, though I honestly can’t tell you what I did forever ago O.o
14:16sdegutisOh wait, I'm apparently using Java 7, so I can just use java.nio.file.StandardCopyOption/COPY_ATTRIBUTES
14:16Anderkentsdegutis: exec cp file other-file?
14:16Anderkent:D
14:17sdegutisAnderkent: that's not a half bad idea either actually
14:18gfredericksI think I just started a twitter fight about CLJS numerics
14:21sdegutisping
14:25justin_smith,(apply str (map char [112 111 110 103]))
14:25clojurebot"pong"
14:26sdegutis:)
14:26bontucodejcromartie: I am still struggling with the recur for a bottom approach of result building, I read the docs, cannot yet fit, it will be great if you can show an example of working with collections
14:27justin_smithbontucode: you can use recur where you would usually use a call to the same function
14:27AmandaCKSP
14:27justin_smithas long as it is in a "tail position"
14:27AmandaCer, ignore that
14:27justin_smithclojure will tell you if it is not in a tail position
14:29bontucodejustin_smith: I am trying to convert create_seq method here (https://www.refheap.com/67435) to use recur. The recursion call is not at a tail position
14:29justin_smiththen you need to add arguments so that the extra work after that call is carried in an accumulator
14:30justin_smithsuch that the recur can be at the tail
14:30justin_smiththis would also be true in a lang with TCO
14:30amalloybontucode: that is not really an algorithm that is amenable to tail recursion
14:33bontucodeamalloy: you mean, I cannot build the results in a bottom up fashion?
14:33gfredericksI'm thinking of trying to make this fancier, maybe via nrepl middleware: https://github.com/georgejahad/debug-repl
14:34technomancygfredericks: how would it function as a middleware?
14:35gfrederickstechnomancy: it wouldn't be just middleware; but maybe the middleware could be used for setting the context of the repl?
14:35gfredericksletting you bounce around your breakpoints
14:35technomancyah, multiple sessions or something
14:36gfredericksyeah
14:36technomancya session multiplexer
14:36gfredericksfo sho
14:36technomancycool beans
14:37technomancyhttp://p.hagelb.org/make-it-sew.gif
14:49locksoh god
14:50bontucode(map (fn [x] [x]) (range 3))
14:50bontucode,(map (fn [x] [x]) (range 3))
14:50clojurebot([0] [1] [2])
14:50jcromartie,(map vector (range 3))
14:50clojurebot([0] [1] [2])
14:51bontucode,(map #([%]) (range 3))
14:51clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
14:51amalloybontucode: #([%]) is (fn [x] ([x])), not (fn [x] [x])
14:52bontucodeamalloy: right, so how to compress it?
14:52amalloybontucode: (fn [x] [x]) is also vector, as jcromartie pointed out
14:52bontucodeaah, got it, thanks
14:52bontucodeyes, I missed that earlier, thnx
14:52amalloybut like...another answer is: don't. who cares about a few bytes
14:52amalloywrite something legible, not something short
14:52locks^
14:55bontucodeamalloy: true
14:59bontucodewhat is the best way to approach this problem of generating sequence of length n, from the given list of numbers ?
15:08michaniskin(take n (cycle list-of-numbers)) ?
15:10jcromartiebontucode: well maybe reduce it to the mathematical constructs first
15:10jcromartiebontucode: also worth noting: you have your arg lists and doc strings backwards
15:11jcromartieit goes (defn name doc-string? [params] ...)
15:12jcromartie,(do (defn foo "bar" []) (doc foo))
15:12clojurebot"([]); bar"
15:12jcromartie,(do (defn foo [] "bar") (doc foo))
15:12clojurebot"([]); "
15:13bontucodemichaniskin: sorry, need to generate all sequence of length n from the given list of numbers
15:14bontucodejcromartie: thx
15:14jcromartiebontucode: how about starting as simple as possible: write a function that returns the *next* sequence
15:15bontucodejcromartie: what is *next* sequence?
15:16jcromartieasterisks for *emphasis*
15:16TimMcWhat is *emphasis*?
15:17jcromartie:P
15:17TimMc,clojure.core/*emphasis*
15:17clojurebot#<CompilerException java.lang.RuntimeException: No such var: clojure.core/*emphasis*, compiling:(NO_SOURCE_PATH:0:0)>
15:17TimMchow do I english
15:17bontucodejcromartie: so what do you mean by next sequence? if input is [1 2 3] what should be the expected output?
15:18ptcekIs OpenJDK not recommended for Clojure? Any recent article about running on OpenJDK out there?
15:18jcromartieso if low = 0 and high = 1, and n = 1, then the selection that follows [0] is [1]
15:19jcromartiefor n = 2, it goes (0 0) (0 1) (1 0) (1 1) right?
15:21whodidthisman, anyone know if fnhouse is close to being published on clojars
15:22gtrakptcek: I use openjdk all the time, it's fine.
15:23gtrakopenjdk 7 and 8 are barely different from the oracle one.
15:23gtrak6 works fine, too.
15:24jcromartiebontucode: also the mathematical/combinatorics term for this is "selections
15:28bontucodejcromartie: right. so the mathematical construct I had started with was, seq(N) = {seq(N-1), i}, for i = 0 to N
15:29bontucodeand to implement that I was using a bottom up building approach, to add the result of seq(N-1) and i.
15:29jcromartieok, and the problem is that's not compatible with tail recursion
15:29jcromartieyou could use laziness to work around that
15:30jcromartiebut I don't know how (in)efficient that might be
15:31bontucodejcromartie: to start with, if it doesn't blow up with stackoverflow, I will consider myself on the next stage
15:32Anderkentyou want to make it tail recursive then; that usually involves adding an accumulator
15:33ptcekgtrak: thanks. evaluating my posssibilities on BSD and oracle doesn't seem as good option there...
15:34gtrakptcek: I read somewhere you could run the oracle jdk with linux compat, at least on freebsd
15:34gfredericksyou can implement unbounded channels in core.async by replacing (>!! ch x) with (go (>!! ch x)) :)
15:34gfredericks>! for the second one, rather
15:35Anderkentoh, it's not just not tail-recursive, it branches out; not as simple as adding an accumulator then
15:35Anderkentor not, misread that code
15:36jcromartieI mean correct me if I'm wrong, but it's basically lexicographic ordering
15:36ptcekgtrak: I've seen this, but why to bother if OpenJDK is well supported and works... :)
15:37gtrakptcek: meh :-), everything has tradeoffs
15:42sdegutis,(->> (update-in (vec (->> 11 (* (inc 11)) (iterate dec) (take 11) (reverse) (take 1) (first) (range 111) (take (inc 1)) (map char) (reverse) (partition (inc 1) 1) (cycle) (take (inc 1)))) [1] reverse) (flatten) (apply str))
15:42clojurebot"poop"
15:43gfrederickssdegutis: playing with a string obfuscator?
15:44jcromartienow write something that takes a string and returns code like that
15:44sdegutisgfredericks: nope just taking a mental break from work
15:45gfredericksgo model this in core.logig
15:45gfrederickslogic
15:45sdegutisI tried to use only the digit 1
15:45gfrederickscoreo.logico
16:03rhg135hello everyone, I can't for the life of me figure out why outside a for loop is in a workerthread but inside it's a nrepl thread, https://www.refheap.com/67531
16:03gfredericksrhg135: laziness probably
16:04amalloyindeed
16:04hyPiRionyes
16:04rhg135gfredericks: oh duh
16:04hyPiRionrhg135: replace `for` with `doseq`
16:04rhg135no i need results
16:05gfredericksdoall
16:05gtrakrhg135: wrap it in doall
16:05rhg135ill force it
16:05rhg135mhm
16:05gfredericksor (doto dorun) or prn or
16:05rhg135thx for waking my senses
16:05amalloyyou need some way to actually get the value out of all those fork calls
16:05gtrakor you could close over Thread/currentThread outside of the for :-)
16:05gtrakdepending on what you want.
16:06rhg135amalloy: fork returns a future
16:07rhg135the dorun works and i don't need lazyness
16:07gtrakdorun will lose the head.
16:08gtrakand return nil
16:08gfredericks(throw (Exception. "Cannot find head!"))
16:09rhg135oops
16:09rhg135i meant doall which is what i used
16:10rhg135actually i mapv'ed a fork! private function
16:10rhg135more concise imo
16:39conneranyone know a good way to be able to write in character literals when using paredit.. while still maintaining "\" as paredit escape?
16:39conner(in emacs)
16:47justin_smithconner: C-q \
16:47justin_smithC-q and C-w are my two bits of "get out of jail free" in paredit, personally
16:49connerjustin_smith: thanks!
16:50justin_smithC-w is combined with C-space to set mark, of course
16:50connerjustin_smith: doing some pretty silly things with characters for an icon font right now: https://cloudup.com/cf9yRZzk5vE :P
16:53justin_smithnice
17:00bbloom,(deftype MutBox [^:unsynchronized-mutable x])
17:00clojurebotsandbox.MutBox
17:00bbloom,(.x (MutBox. 123))
17:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: x for class sandbox.MutBox>
17:01bbloomisn't that supposed to work?
17:01bbloomwhat am i doing wrong...
17:01gfredericks,(get "abc" -0.99)
17:01clojurebot\a
17:01dnolen_bbloom: no, mutable fields cannot be accessed outside
17:03bbloomdnolen_: ah ok. is there a way to force mutable fields to be public? i'd like to have a small test case to work with (trying to get my interpreter to handle protocols, etc which leverage public mutable fields for the method cache table)
17:03Bronsabbloom: no, you neet to have set/get methods
17:04Bronsaneed*
17:04bbloom,(set! (.__methodImplCache (fn [])) (clojure.lang.MethodImplCache. nil nil))
17:04clojurebot#<MethodImplCache clojure.lang.MethodImplCache@12c9015>
17:04bbloomi guess that'll do for my test case :-P
17:05dbellone place I've been spoiled w/clojure is that immutable data means we don't really need to care about passing object references vs passing the actual object, as neither should change
17:05dbellbut now I'm dealing w/some core.async stuff and I'm realizing I don't know exactly how to handle this
17:05dbellif i'm passing channels around to multiple places, do the channels get multiplied?
17:06gfrederickschannels are stateful objects; if you don't do any kind of explicit copying, you will end up with multiple references to the same object
17:06gfrederickswhich is exactly how the consumer and producer end up looking at the same channel
17:06gfredericksor multiple consumers/producers
17:07dbellso, (let [c chan] (map (fn [n] {:num n :chan c}) (range 5))
17:07dbellwouldn't copy c everywhere, just the ref?
17:07gfredericksright
17:07gfredericksjust one channel happening there
17:07dbellawesome, thank you
17:08gfredericksdbell: the identical? function can help sanity check these kinds of things
17:08dbell,(doc identical?)
17:08clojurebot"([x y]); Tests if 2 arguments are the same object"
17:08dbellah
18:02cYmen_hm...
18:03cYmen_I just tried adding env usage to my project but it seems the values are all nil.
18:03cYmen_Is there something I need to do when I want them set within cdier?
18:03cYmen_cider
18:05cYmen_Do I have to select the profile somehow?
18:14craigbromaybe restart?
18:28cYmen_Don't know...seems to not work from the console either
18:28DomKMAnyone know if there is a core.reducers implementation of partition-all? I want to process a large file in chunks.
18:28cYmen_lein with-profile dev ring server <- this should work, right?
18:29llasramnope
18:29llasram+dev
18:29llasramjust `dev` means "only the :dev profile"
18:29cYmen_still all nil
18:30llasramnb that the default :default includes :dev anyway though
18:30cYmen_well crap I must have set it up wrong
18:31cYmen_I can access the values with (env :somename), right?
18:32cYmen_and set them using :env {:somename "foo"}, correct?
18:36Lucairssi -n keppy
18:36Lucaexit
18:40llasramDomKM: Not a stand-alone one I'm aware of. I've got some stuff in parkour I'm actually about to split out into a library named something like `reduxsirs`
18:42llasramHmm, `partition-all` though -- I was thinking `partition-by`. Interesting. Just as tricky, but for different reasons!
18:43TravisDWhat was the emacs variable to customize the command executed by cider-jack-in? I can't remember :(
18:44DomKMllasram: Cool. I think I need partition-all, not by, though I do see you have distinct here which is also useful for me. Thanks.
18:44technomancyTravisD: M-x apropos-variable cider command
18:45llasramDomKM: Well, be careful with the `distinct` -- it does removes only *adjacent* duplicates
18:45TravisDtechnomancy: That only seems to show cider-switch-to-repl-command
18:45llasramDomKM: (because this is intended for a sorted MapReduce context)
18:45DomKMllasram: Thanks for the warning. I saw that and it's actually perfect for my usecase.
18:46technomancyTravisD: sorry, cider.*command
18:46TravisDoh weird. After jacking in the variable shows up
18:46TravisDbut not before
18:46cYmen_oh what the hell
18:46technomancyTravisD: oh sure; if cider isn't loaded yet
18:46cYmen_can anybody give me hint on how to debug where these profile settings are getting lost?
18:46TravisDweird that some variables are there but not all
18:47justin_smithcYmen_: maybe you are both setting the value manually, and you have a customize block with a different setting in it?
18:48cYmen_All I did was add an :env {...} map to both the dev and production profiles of a default compojure-app project
18:48cYmen_and they both contain the same keys
18:48justin_smithah, I was thinking emacs sorry
18:48cYmen_ah, sorry
18:48cYmen_emacs has profiles? :)
18:49justin_smithsometimes I've seen a settings file called a profile
18:49llasramDomKM: There's also bbloom's tranduce libray, which lets you trivially implement `partition` (but still not `partition-all`): https://github.com/brandonbloom/transduce
18:50llasram,tranduce,transduce,
18:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tranduce in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:50llasramhaha
18:52bbloomllasram: why would partition-all be any harder to implement than partition?
18:53llasrambbloom: Because you need to do something different at the end of the reduction
18:53llasramEmit something from the partially-accumulated state
18:54llasrambbloom: Here's what I did to get something approximating (and generalizing) a reducers `partition-by`: https://github.com/damballa/parkour/blob/master/src/clojure/parkour/reducers.clj#L28
18:54bbloomllasram: that shouldn't be a problem if you just emit the states and then do a pass over that
18:55llasrambbloom: I'm not seeing it, because you still need to know to know somehow that you've reached the end of the succession of states, then do something different
18:56cYmen_ah crap
18:56cYmen_lein clean solved everything
18:57justin_smithmy favorite voodoo fix-anything-weird option
18:57cbpwhen everything else fails..
18:57llasrambbloom: I believe this is essentially the issue cgrand raised on the dev ML a while ago wrt reducers and transients
18:57justin_smithcbp: well it's easy enough to do you may as well try it first!
18:57amalloyi mean, if you don't have AOT, it's pretty hard to get into a state where lein clean does any good
18:58technomancyevery time lein clean solves a problem, an angel loses its wings
18:58Anderkentamalloy: is it? protocols / records still generate class files when loaded, don't they?
18:58amalloyno
18:58Anderkenthuh. I had that thought cached for some reason
18:59amalloyonly if you have aot are classfiles ever generated, i'm fairly sure
19:00amalloythat's basically what aot means: compile classfiles ahead of time :P
19:00bbloomllasram: just (concat input [::done])
19:00bbloomllasram: store each item in the state, emit it on the next go
19:02llasrambbloom: Except that `concat` doesn't compose with reducers which aren't also lazy sequences :-)
19:03amalloyllasram: it's easy to model concat as a reducer. in fact there's a concat reducer
19:03llasramamalloy: Hmm, fair point. The provided `cat` requires its inputs to be `Counted`, but it would be relatively simple to create an implementation which does not
19:04bbloomllasram: if your inputs are uncounted, then you have a seq probably, so regular concat works :-P
19:04llasrambbloom: My inputs are the (potentially) unbounded collection of input records to a MapReduce task :-p
19:05bbloomllasram: i'm not saying that it's ideal, but mapcat-state can serve as a fully general yield construct
19:05amalloyllasram: sounds like a lazy seq to me?
19:06amalloylike, don't you get an Iterable<T> inputs, such that you can just call (iterator-seq inputs) and use lazy seqs?
19:06bbloomllasram: also, you can just use mapcat identity w/ uncounted values
19:06bbloom(require 'clojure.core.reducers)
19:06bbloom,(require 'clojure.core.reducers)
19:06clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: >
19:06bbloomboo
19:07llasramamalloy: I support working with it as both, but handling via reducers works better -- better performance, more consistent memory usage, and easier to reason about interaction with mutable I/O & serialization interfaces
19:08amalloythat's weird, bbloom. i know clojurebot runs a version that has reducers
19:09llasrambbloom: I'm sold. I just really hadn't considered concatenating a terminator. Cool -- this will really simplify some code
19:09bbloomllasram: clearly not enough C programming :-P
19:10ztellmanamalloy: are there whitelists for namespaces in clojurebot?
19:11llasrambbloom: Haha. Decade-ago me would be scandalized!
19:11amalloyi don't think so
19:12llasramamalloy: Oh, right -- to further clarify (because it took me a second to remember the details), Hadoop task input is generally via mutable serialization wrappers which are modified for each incoming value
19:17hiredmanclojurebot's sandbox can be finicky about loading stuff
19:18rhg135finally got it, https://www.refheap.com/67630
19:18rhg135now i need a parser to populate the data types
19:20amalloyrhg135: whoa. that debug is super worrying - if you ever take out the debug form, you'll be calling (build) on tasks whose prerequisites aren't done building
19:20amalloythat is, the (debug "Results:" ...) line is all that's making you wait for the futures to finish
19:20rhg135amalloy, it's laziness on my part
19:21rhg135eventually i'll get timbre
19:21bbloomrhg135: and that laziness will cause other laziness to burn you :-)
19:21amalloyi think you misunderstood what i'm saying, rhg135. timbre is not a solution: the solution is to not do critical "business logic" inside of a debug statement
19:21rhg135i am?
19:22rhg135hmm
19:22amalloybecause any maintainer, including future-rhg, will think it's safe to take out a debug print if they no longer need to debug it
19:22amalloyand that will break everything about your dependency model
19:23rhg135oh amalloy invoke-all returns a Collection of *realized* futures
19:24amalloyhuh, apparently it does. that's pretty weird, but okay
19:24rhg135yup
19:34rhg135i see one huge problem, what if something is depended on by multiple targets?
19:36amalloyrhg135: you can't just build a thing's dependencies in order to build it. you have to create the lattice representing the dependency graph, and then walk down from (all of) the top-level requested target to find all things that will need to be built
19:36amalloythen you build them all, in dependency order
19:37rhg135amalloy, i tried that i hit a dead-end
19:37rhg135couldnt build a graph
19:39bontucodeis it possible to simply assoc a global map? or do we have to alter it under dosync ?
19:39justin_smithbontucode: do you want the global map to change?
19:40bontucodejustin_smith: yes
19:40justin_smiththen yeah, it should be a ref or atom
19:41bontucodejustin_smith: thanks, also if in the same dosync, the same map needs to be looked up, we have to use the (:key @global-map) construct right?
19:42rhg135could i get some advice on how i could get this graph?
19:42amalloyrhg135: look up the algorithm that make, ant, maven, and so on use
19:43amalloyit's not a novel problem, so someone else should have a solution you can use
19:43rhg135thanks, amalloy
19:43rhg135yeah...
19:43justin_smithbontucode: you probably mean (key @global-map), and that depends on how you are updating it, most likely you will want to use alter or swap!
19:45justin_smith(let [r (ref {:a 0})] (dosync (alter r update-in [:a] inc)) @r)
19:45justin_smith,(let [r (ref {:a 0})] (dosync (alter r update-in [:a] inc)) @r)
19:45clojurebot{:a 1}
19:49rhg135ant is HUGE
19:49amalloyi advise you to shield your eyes before you look at maven, then
19:49bontucodejustin_smith: I want to do, (let [r (ref {:1 1 })] (dosync (alter r assoc :2 (inc (:1 @r)))) @r)
19:49rhg135amalloy, i expected as such since maven does way more lol
19:50jlpeterswhat's the syntax for using a variable within an enlive selector in a function? a fair bit of googling doesn't yield much. In summary, I'd like to set an 'active' class on a selector but be able to define that selector by passing a variable to the class-setting function, i.e., [#picture-id-<<picture number>>] (enlive/add-class "active") where <<picture
19:50jlpetersnumber>> is passed into the function. I smell a macro here but my skills, while growing daily, remain lacking to create it
19:52rhg135i can't even find this in there?
19:52cbptime to update lein new to put 1.6.0 in dependencies? :-D
19:52rhg135now i wonder how it even works?
19:53cbprhg135: soldier on good soul
19:55rhg135i am, it just hurts D:
19:55technomancycbp: already there
19:55cbptechnomancy: oh. Do I have to upgrade lein then?
19:56technomancycpb: need to run master or wait for a release
19:56cbpah
19:57rhg135the scary part is this isn't uncommon
20:35krasHi, I am looking for a simple graph library similar to networkx in python, any suggestions?
20:36charewhats the difference between -> and ->>
20:36rootex>
20:36hiredmankras: loom might be a good place to start
20:37Frozenlockchare (-> "x" (str "a")) will give you (str "x" "a")
20:37Frozenlockwhile (->> "x" (str "a")) will give you (str "a" "x")
20:39gfredericks,(-> 'x (str 'a))
20:39clojurebot"xa"
20:39gfredericks,(-> 'x (str 'a 'b 'c 'd))
20:39clojurebot"xabcd"
20:39gfredericks,(->> 'x (str 'a 'b 'c 'd))
20:39clojurebot"abcdx"
20:40krashiredman: thank you, will give it a try
20:40krasgfredericks: wow, I didn't know about clojurebot
20:41gfredericksclojurebot: clojurebot?
20:41clojurebotclojurebot is broken
20:41gfredericksclojurebot: clojurebot?
20:41clojurebotclojurebot is a multimap
20:41gfredericksclojurebot: clojurebot?
20:41bitemyappRaynes: pick up the pieces.
20:41clojurebotclojurebot is broken
20:41Bronsaso, I just compiled clojure.core with tools.emitter.jvm.
20:42gfredericksBronsa: okay so we'll all switch now?
20:44gfredericksBronsa: do you have some sort of measurement of how close it is to the existing compilation?
20:44Bronsagfredericks: I still have to make sure that everything works without errors after being recompiled though
20:44Bronsathere are probably going to be some issues but the fact that it is able to compile it is still pretty cool, it's getting real close to being stable
20:45Bronsagfredericks: compilation time or bytecode?
20:45gfredericksBronsa: bytecode
20:47Bronsanom but it should be pretty similar overall, I haven't made many changes
20:47Bronsano*
20:48Bronsathe biggest change is that t.e.j emits typed bytecode while Compiler.java tags every object as Object and check-casts when needed
20:49gfredericksoh wow
20:49amalloy!!
20:49gfredericksis that significant for runtime perf?
20:49llasram(inc Bronsa)
20:49lazybot⇒ 19
20:49llasramThis is totally awesome
20:50amalloyi wasn't even watching this conversation but my IRC client suddenly set off alarm bells all throughout the building when i heard about the typed bytecode
20:50Bronsagfredericks: I havn't done any perf test yet, will do them once I get everything to work :P
20:51gfredericksgit commit -m "got the last thing to work"
20:52gfredericksBronsa: I enjoyed your proxy talk at clojurewest
20:52Bronsagfredericks: the only downside (that I actually think is an enhancement) is that some functions will throw at runtime
20:52Bronsae.g. ns-interns
20:52hyPiRionI really like commits where the message is like "fixed a bug"
20:52gfredericks"boog stompin"
20:53Bronsabecause (fn [^Y x] ..) when compiled with t.e.j will throw when x is not a Y
20:53Raynesbitemyapp: ?
20:53bitemyappRaynes: pick up the BRRAAIIIIINNZZZZ
20:53gfredericksBronsa: oh right. that's interesting
20:53Bronsagfredericks: yeah, tbaldridge did an awesome talk
20:53Raynesbitemyapp: I have no idea what you're talking about.
20:53bitemyappRaynes: it's okay.
20:54Raynes>_>
20:56krasLooking at the loom library where it says "The namespace loom.graph must be AOT compiled. You can include :aot [loom.graph] in your project.clj to do this". Can anyone throw some light on why this is required?
20:56krasTried to follow a conversation on clojure group but cudn't understand anything :-(
20:56bitemyappRaynes: <3
20:56hiredmankras: I have not found that to be the case
20:56hiredmanno idea why they say that
20:57krashttps://github.com/aysylu/loom#usage
20:57hiredmankras: I was just using it earlier today without any aot compilation
20:58hyPiRionkras: I guess it has some protocols which may be needed in some functions
20:58hyPiRionnot sure if AOT is strictly required, though
20:58krashiredman: does it have to do with the clojure version? I am using 1.5.1
20:58hiredmankras: me too
20:59hiredmankras: I actually chimed in on that mailing list thread
21:03hiredmankras: they aren't using protocols/records correctly, and they thrashed around and ended up discovering aot solved it without understanding the problem
21:03hiredmankras: is you always load loom.graph before loading loom.attr you should be fine
21:04hiredmanbefore loom.label too
21:06hiredmanand :use everywhere :/
21:13krashiredman: thanks for the advice, will try
21:18rhg135here's my probably horribly-inefficient dep graph generator, https://www.refheap.com/67725
21:22amalloyrhg135: transients aren't pointers - you can't just bash on them in place
21:22amalloyyou have to use the return value from conj!
21:22rhg135amalloy, strange how it works then ;)
21:23amalloyit's not guaranteed to work, anyway. for sets, in the current version of clojure, maybe it does. for maps, it works up to a size of like 8 or 10, and then stops working
21:24amalloybut there's no excuse for depending on it. you can easily use an atom, if mutability is what you're after, or reduce over a transient, if performance is what you want
21:24rhg135hmm
21:24rhg135i'll rewrite it
21:24Anderkentor use a volatile-mutable if you need both
21:24amalloyyou can even use an atom around a transient, if you wan
21:24amalloyt
21:24rhg135before release too
21:24amalloy(swap! a conj! whatever)
21:25Anderkentamalloy: eh, function given to swap has to be side-effect free
21:26amalloyAnderkent: well, yes and no. this atom is local, so he knows nobody else will ever touch it
21:26amalloyso nothing will retry, etc etc
21:26amalloybut yes, it's not a great practice
21:27amalloywhich is why i'd just use reduce - this isn't a complicated computation that needs mutability
21:27Anderkentsure, I didnt look at the code
21:28michaniskinhttps://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/kahnsort.clj
21:29amalloyroughly like https://www.refheap.com/9fd1a28c2f89e5ccd0647a255
21:29rhg135i don't think walking through a sequence twice is good either
21:30amalloywhat does that have to do with anything?
21:31rhg135in the first function there
21:31rhg135bbiab
21:43hiredmankras: further digging in to loom, it looks like the aot problem only happens in their tests because they force the reloading of some namespaces in their tests
21:45hiredmantechnomancy: please kickban __VenTys__; it seems to be some kind of bot, keeps privmsging me links
21:47hiredmanpossibly triggered by saying "loom"
21:50hyPiRionhrm, by saying loom you say?
21:51hyPiRionyup.
21:51hiredmanweird
21:54gfredericksI've gotten two PMs in the last couple hours and have never said that word
21:54hiredmanmultiple triggers?
21:54hiredmanthe only thing to do is get a dictionary and start throwing out words
21:54gfredericksoh there's a third
21:55hyPiRionOh, I'll start
21:55hyPiRionaardvark
21:56hyPiRionwhat, that bot actually replied to me when I said that.
21:56gfredericksabaci
21:57gfredericksaback
21:57gfrederickshiredman makes up the FUNNEST games
21:58michaniskini wish to say loom, too
21:58michaniskinbam
21:58gfredericksmy best theory is that it's as soon as you start talking after a bit of silence
21:58llasramI'll just go with aardvark
21:58gfrederickssomebody else pipe up
21:59gfredericksoh no it got him
21:59llasramHmm, no new messages, but apparently messaged me hours ago and I didn't notice
21:59gfredericksllasram: thank goodness you're safe
22:00llasram:-)
22:02gfredericksshow gratis (solo hooy) ;; is hooy a typo for hoy?
22:02gfredericksis this not spanish?
22:02michaniskinit's a celebratory hoy
22:04gfrederickswhat does "show" mean?
22:07technomancyah actually quiet is probably not enough for a bot gone awry
22:08hiredmanclojurebot: thank technomancy
22:08clojurebotHuh?
22:08bjeaneshello everybody
22:10technomancynot sure that actually worked, hostmasks are weird
22:11Bronsatechnomancy: he's back in
22:11hyPiRionclojurebot: thank technomancy |is| Thank you technomancy!
22:11clojurebotc'est bon!
22:11hyPiRionclojurebot: thank technomancy
22:11clojurebotthank technomancy is Thank you technomancy!
22:11hyPiRionwhoops.
22:15gfredericksclojurebot: thank technomancy is thank technomancy is <reply> is Thank you technomancy! is
22:15clojurebotRoger.
22:17hyPiRiongfredericks: wat
22:17michaniskintechnomancy: does leiningen do anything special with respect to data_readers.clj when installing dependencies?
22:17hyPiRionand this dude keeps spamming me
22:19gfrederickshyPiRion: you teach the bot something weird, I teach him something weirder
22:19llasrammichaniskin: Since 2.3.4 (IIRC) it does something special when uberjaring, if that's what you mean?
22:19hyPiRionclojurebot: thank technomancy
22:19clojurebotthank technomancy is thank technomancy is <reply> is Thank you technomancy! is
22:20Bronsalol
22:20llasrammichaniskin: Otherwise it's all just class path entries, which the code in Clojure handles merging multiple instances of
22:20Bronsa(inc gfredericks)
22:20lazybot⇒ 47
22:20hyPiRiongfredericks: it did exactly what I expected it to do. Which was a bit unexpected, if that even makes sense
22:20michaniskinllasram: for some reason when i use a URLClassloader to load clojure jars into my project the data_readers.clj doesn't seem to be installed (datomic specifically)
22:21michaniskini'm not using leiningen, which is why i was thinking that lein was doing something special
22:22llasrammichaniskin: Are you pulling in new JARs via classloader fun after Clojure itself is loaded?
22:22michaniskinllasram: yup
22:22llasramOk. clojure.core loads all the `data_readers.clj` it can find when it itself is first loaded
22:22llasramAnd that's it
22:23llasramIf you want to load things after-the-fact, you'll need to do something yourself
22:23michaniskini suppose it's ok to find them in the jars and merge them in myself, right?
22:23hiredmanit is amazing the bugs you'll find using eastman
22:24hiredmanloom's tests have a bunch of (is (= foo) bar)
22:24hiredmanclearly meaning to be (is (= foo bar))
22:24llasrammichaniskin: Or even just ##(#'clojure.core/load-data-readers)
22:24lazybot⇒ {}
22:24llasramHaha, not quite what I expected to happen
22:24llasram,(#'clojure.core/load-data-readers)
22:24clojurebot{}
22:24michaniskinllasram: awesome, that saves me some time!
22:26gfredericks$google github eastman clojure fingerhut
22:26llasrammichaniskin: Be aware that that (private) function only sets the root value of *data-readers*. I haven't tried to track down who started when what, but at least in my REPL it has a threat-local value too
22:27llasramIs eastman a fork of eastwood or something?
22:27hiredmanoh, I meant eastwood
22:27llasramOh, hah
22:27michaniskinllasram: that seems reasonable and what you'd expect if it were done automatically
22:28gfredericksno wonder google was so bad at that
22:28michaniskinthanks llasram
22:29hiredmanhttps://github.com/aysylu/loom/pull/16
22:33gfredericksit couldn't resolve a buncha muh vars o_O
22:34amalloyhiredman: usually i write: (is = foo bar)
22:34hiredmanare you putting defs inside defns again?
22:34Bronsagfredericks: :( what's going wrong?
22:35gfredericksBronsa: heckifiknow
22:35Bronsaare you running it on a public project?
22:35gfredericksno
22:35gfrederickssorry, too tired to dig into it right now
22:37Bronsano worries, open a ticket with the error message when you have some time and I'll try to understand
22:37Bronsaand now __VenTys__ started spamming me too. thank god for /ignore
22:40amalloyi mentioned it in #freenode a couple hours ago, Bronsa; dunno if that was the right place to report spam, but nobody seemed to care
22:49ivanthat is more of a channel op thing for chouser or technomancy
22:49ivanyay, now I got it too
22:57ivanis there an nREPL middleware that prevents code execution until a secret cookie is presented?
23:01bob2niche
23:01ivanit seems at least a little wrong to execute code that other users send you
23:14rhg135vast imporvement imho https://www.refheap.com/67949
23:18amalloywait, why isn't dedupe just clojure.core/distinct, rhg135?
23:19amalloyright, nm, it's distinct-by, which doesn't really exist
23:20rhg135amalloy, oh i didn't know but yeah...