#clojure log - Mar 28 2014

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

0:07 MadFunk: amalloy: 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).

0:08 I was basically trying to brute force it.

0:11 Anderkent: can anyone explain this to me

0:11 ,(bytes (byte-array [1 2 3]))

0:11 clojurebot: #<byte[] [B@13abee1>

0:11 Anderkent: ,((do bytes) (byte-array [1 2 3]))

0:11 clojurebot: (. clojure.lang.Numbers clojure.core/bytes #<byte[] [B@6dd60e>)

0:11 Anderkent: because I'm lost

0:12 the lostest

0:12 beamso: i'm lost because (byte-array [1 2 3]) gives me a classcastexception

0:13 Anderkent: just do (byte-array (map byte [1 2 3])) , i think that was relaxed in 1.6

0:14 amalloy: ~def bytes

0:15 beamso: bytes appears to just cast the argument to byte[] by the looks

0:15 Anderkent: yeah I guess I don't understand inline fuctions, if that's expected behaviour?

0:16 amalloy: Anderkent: no, no way is that expected

0:16 i just wanted a source link to try and figure it out

0:17 beamso: what is expected to happen?

0:17 amalloy: definline is supposed to just allow (f x) to expand into a more efficient form

0:18 than calling something like ((identity f) x)

0:18 Anderkent: beamso: they should do the same

0:19 i think it must be a compiler bug?

0:19 amalloy: Anderkent: i kinda doubt that. the compiler isn't even involved in the behavior you don't like, just the macroexpander

0:20 or, well, the uh...function defined by the macro definline

0:20 Anderkent: well, what looks at the :inline meta?

0:21 ,(pprint (macroexpand (read-string (with-out-str (source bytes)))))

0:21 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0:0)>

0:21 Anderkent: blah

0:22 amalloy: Anderkent: :inline is looked at exclusively by Compiler/analyzeSeq

0:22 but it won't be looked at in the case that's troubling you

0:22 it's the non-inline version that's broken

0:25 Anderkent: ,clojure.pprint/pprint

0:25 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.pprint, compiling:(NO_SOURCE_PATH:0:0)>

0:25 amalloy: &((identity bytes) (byte-array [1 2 3]))

0:25 lazybot: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Byte

0:25 amalloy: &((identity bytes) (byte-array (map byte [1 2 3])))

0:25 lazybot: ⇒ (. clojure.lang.Numbers clojure.core/bytes #<byte[] [B@2e03c8>)

0:25 amalloy: okay, so not a new problem in 1.6

0:26 Anderkent: yeah checked back to 1.2

0:26 ,(macroexpand (read-string (with-out-str (source bytes))))

0:26 clojurebot: #<SecurityException java.lang.SecurityException: denied>

0:26 Anderkent: reaaly now

0:26 anyway

0:26 running that amcroexpanded defn manually seems to work, so it must be inline-related

0:27 or hm

0:28 (. clojure.lang.Numbers clojure.core/bytes xs)

0:28 thaht symbol being namespaced is suspicious

0:28 amalloy: Anderkent: nah, that happens all the time

0:28 in (. foo bar/baz), the compiler ignores bar

0:30 Anderkent: even if i run that definline in my repl, without macroexpanding it by hand first, bytes goes back to the "expected" behavior

0:30 Anderkent: yeah

0:31 just found that out too

0:31 amalloy: so i posit that the source we're looking at for bytes is not actually the code that is running. something else redefines bytes

0:31 and yet, clearly nothing does. a puzzler

0:32 do the other inline functions have this problem? i don't think so

0:32 Anderkent: yes they do

0:32 amalloy: ,((do +) 1 2)

0:32 clojurebot: 3

0:32 Anderkent: oh not all

0:32 just the `definline` ones

0:32 ,(source +)

0:32 clojurebot: Source not found\n

0:38 Anderkent: bah, nodisassemble cant disassemble byte

0:38 *bytes

0:39 ah nvm im doing it wrong

0:44 hm

0:45 how does clojure decide whether to re-generate a .class file?

0:46 amalloy: i 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

0:46 Anderkent: I edited core.clj within clojure.jar changing definline slightly then rolling that back

0:46 now it works as expected

0:46 theres a definline.class ...

0:47 amalloy: Anderkent: i'd be interested to see what happens if you just remove *.class from clojure.jar

0:47 at that point i presume it recompiles everything

0:48 i'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

0:52 Anderkent: amalloy: not that easy, because without clojure.main life is hard!

0:57 amalloy: oh. http://dev.clojure.org/jira/browse/CLJ-1227

1:01 amalloy: ah. and caused by http://dev.clojure.org/jira/browse/CLJ-1330, Anderkent

1:01 so that makes sense sorta

1:01 Anderkent: Except that link says it's since 1.6.0-alpha2

1:02 i guess it's just a bad blame

1:04 oh nvm it's 1.2

1:04 i was misled by the tag

1:17 avshalom: anyone know if intellij cursive integrates with a debugger?

1:18 beamso: i've struggled to run programs inside of cursive so i've no idea

1:25 dbell: say 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?

1:26 the smiley is \:d

1:26 : d

1:27 guns: dbell: (map vector [:a 1] [:b 2] …)

1:27 dbell: oooooooooh

1:28 guns: blew my mind too when it was introduced to me

1:28 dbell: that is pretty freaking slick

1:30 rplaca: if you really have it in a list as shown, you can

1:30 ,(apply (partial map vector) '([:a 1] [:b 2] [:c 3]))

1:30 clojurebot: ([:a :b :c] [1 2 3])

1:44 SegFaultAX: rplaca: You don't need partial there, apply collects all arguments into the last arg ##(apply map vector [[:a 1] [:b 2] [:c 3]])

1:44 lazybot: ⇒ ([:a :b :c] [1 2 3])

1:48 rplaca: oh yes, of course!

1:49 my mental model wanted to glue the "map vector" into one magic thing, but really vector is just an argument like any other

2:35 yuri_niyazov: What's the status of clojureql?

2:35 clojureql.org seems to be a hijacked website

2:41 SegFaultAX: yuri_niyazov: Awesome markovs.

2:52 fro_: 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.

3:32 chare: when I run lein repl how does lein know what jvm to run? Is there a way to control that?

3:33 ivan: chare: set JAVA_CMD or LEIN_JAVA_CMD

3:34 otherwise it uses the java in the PATH

4:58 l3dx: how can I configure lein to use clj 1.6 when starting the repl outside a project?

5:18 chare: is anyone awake?

5:18 have any of you done a speed comparision between clojure, python django, and ruby rails?

5:24 wink: chare: http://www.techempower.com/benchmarks/ might be worth alook

5:25 chare: wink wtf how is go winning?

5:25 wink: ask them, not me. you can clone all of the tests and run them for yourself

5:25 they started a benchmarking spree and a lot of folks contributed

5:26 chare: wink when did the go runtime and optimizer get so fast?

5:26 wink: 1.2 probably

6:11 jph-: im surprised by rack-jruby

6:15 khaled_: why dont you by jack ruby (sorry jokin)

6:17 jph-: it's interesting to see performance drop significantly on luminus... i wonder if that's to do with out of box defaults

6:19 ddellacosta: jph-: what are you using rack-jruby w/clojure for? some rack-app interop stuff?

6:20 jph-: no no

6:20 im just looking at the benchmark site

6:20 kras: Whats wrong with this code: http://pastebin.com/WkWVY2sg

6:20 ddellacosta: jruby-rack I should say

6:20 jph-: i came from ruby, i dont like it being faster than clojure

6:20 heheh

6:20 kras: I get a stackoverflow

6:20 ddellacosta: jph-: ah, haha...

6:21 jph-: clojure was meant to be my step up in speed without having to learn Go

6:21 so i shake my fist at rack-jruby

6:21 kras: stackoverflow when I run (module_declarations zp) where zp is a zipper

6:21 (module_declarations zp)

6:21 ddellacosta: kras: try using loop rather than recursing without a accumulator

6:22 kras: ddellacosta: As I see there is nothing to accumulate here, I just return the location in the zipper when it matches something

6:24 ddellacosta: kras: 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.

6:27 yotsov: kras: 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

6:34 kaw_: The key being recur rather than loop there, I think, since a defn should already be a recursion point?

6:35 kras: Changing the code to use loop atleast got rid stackoverflow error but the code is still running since paste 5 mins http://pastebin.com/ugDxccAu

6:36 ddellacosta: kaw_: 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

6:36 kras: yotsov: how do I check what the stack size is currently set to? Sorry noob here

6:37 jph-: i remember starting clojure, thinking "when am i going to do this recursive looping stuff?"

6:37 they hide most of that from you

6:37 bastards

6:37 ddellacosta: kras: so, your if clause is failing? re: stack size, you can set that in your project.clj file.

6:37 kras: or just java args

6:38 kras: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L229-L230

6:38 kras: jph-: same here, this problem looked very trivial when I started, probably need to to get used to clojure's way of thinking

6:38 ddellacosta: thanks a lot, will take a look

6:39 ddellacosta: kras: 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.

6:39 kras: ddellacosta: if my if clause if failing ..... oops forgot to check the end?

6:40 ddellacosta: kras: I just mean, it seems like your code would be correct, but obviously it's not returning from the if condition, right?

6:40 kras: so not sure what else it would be

6:41 kras: ddellacosta: 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

6:41 will test it and confirm

6:45 http://pastebin.com/3EMP9L6p the following code seems to be working, atleast its returning nil

6:45 need to refactor it a more I guess

6:46 ddellacosta: kras: ah, right, I didn't think about end either

7:12 kras: coming to the heap-size/stack size, how do I check these values interactively in the repl?

7:33 gfredericks: stack size could be done by creating an exception? but heap isn't easy to get a useful handle on

7:35 ,(-> (Exception.) (.getStackTrace) (count))

7:35 clojurebot: 37

7:36 gfredericks: ,(defn stack-depth [] (-> (Exception.) .getStackTrace count))

7:36 clojurebot: #'sandbox/stack-depth

7:37 beamso: 50% off clojure books at o'reilly using discount code WKCLJUR .

7:40 gfredericks: ,(map (fn [_] (stack-depth)) (concat (repeat 3 3) (repeat 2 2)))

7:40 clojurebot: (49 51 51 51 51)

7:41 gfredericks: ,(map (fn [_] (stack-depth)) (reduce concat (map list (range 5))))

7:41 clojurebot: (49 51 51 51 51)

7:42 gfredericks: ,(map (fn [_] (stack-depth)) (reduce #(concat %2 %1) (map list (range 5))))

7:42 clojurebot: (49 51 51 51 51)

7:42 gfredericks: huh. I figured it'd be easier to get different results

7:45 I guess the outermost map does all the stack-normalizing before it ever calls stack-depth?

7:56 ,(->> (repeatedly 5 #(repeatedly 1 stack-depth)) (reduce concat))

7:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: stack-depth in this context, compiling:(NO_SOURCE_PATH:0:0)>

7:56 gfredericks: ,(defn stack-depth [] (-> (Exception.) .getStackTrace count))

7:56 clojurebot: #'sandbox/stack-depth

7:56 gfredericks: ,(->> (repeatedly 5 #(repeatedly 1 stack-depth)) (reduce concat))

7:56 clojurebot: (72 69 64 59 54)

7:56 gfredericks: ah HA.

7:56 ,(->> (repeatedly 50 #(repeatedly 1 stack-depth)) (reduce concat))

7:56 clojurebot: (297 294 289 284 279 ...)

7:57 gfredericks: ,(->> (repeatedly 150 #(repeatedly 1 stack-depth)) (reduce concat))

7:57 clojurebot: (797 794 789 784 779 ...)

8:47 yotsov: gfredericks: stack size is governed by quantum physics: the only way to look at it changes it :)

9:04 cYmen: How do I activate "lisp mode" for cljs files in emacs?

9:10 beamso: adding clojure-mode seems to give me lisp recognition for .cljs files

9:10 but i use emacs prelude

9:11 * cYmen blushes.

9:11 cYmen: So uh..what is emacs prelude and what is is clojure-mode and how do I add it?

9:12 beamso: http://batsov.com/prelude/

9:12 clojure-mode is in elpa

9:12 cYmen: elpa?

9:12 clojurebot: elpa is a package manager for Emacs: http://tromey.com/elpa

9:13 cYmen: Hm...so assuming I already have clojure-mode (since everything works for clj files) how do I activate it for cljs?

9:13 beamso: i'm not familiar enough with the mode to give you that answer

9:14 have you tried making sure you're running the most up to date version of the mode?

9:14 cYmen: No...

9:18 I seem to have clojure-mode installed using marmalade...

9:18 tmciver: cYmen: generally, you add a mode hook in your ~/.emacs: http://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Hooks.html:

9:19 cYmen: no wait

9:21 cYmen: 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))

9:21 cYmen: http://www.emacswiki.org/emacs/AutoModeAlist

9:26 cYmen: (add-to-list 'auto-mode-alist '("\\.cljs$" . clojure-mode)) this did the trick

9:27 tmciver: thank you very much!

9:29 tmciver: cYmen: ah, that makes sense. You're welcome.

9:46 bontucode: I am new to clojure and struggling to write a construct, where in a loop a result is populated by result of a recursive call

9:46 jcromartie: bontucode: I'd be glad to help

9:46 cYmen: bontucode: Show us what you've got! :)

9:47 jcromartie: can you paste a snippet of code to Gist or something?

9:47 people like refheap too

9:47 bontucode: jcromartie: thanks

9:50 https://www.refheap.com/67376

9:51 jcromartie: first thing: `loop` is meant to be used with `recur`

9:51 bontucode: jcromartie, cYmen: I would like to concat the return value of count-tuples with result vector

9:52 jcromartie: 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

9:52 jcromartie: ~for

9:52 clojurebot: for is not used enough

9:52 jcromartie: oh, that's not what I thought clojurebot would say :)

9:52 augustl: haha

9:52 jcromartie: for is not a loop!

9:52 augustl: I concur, I use loop/recur too much..

9:53 jcromartie: bontucode: `for` is a comprehension which returns a seq, not a looping construct like in java/C

9:53 bontucode: jcromartie: so I will replace it with a map and range

9:53 jcromartie: bontucode: sorry I don't quite grok it, but what's the intended input/output here

9:54 cYmen: bontucode: Basically it works like this: (loop [some variables] ........ (recur newvaluesforvariables))

9:55 bontucode: jcromartie: Trying to solve this problem: http://community.topcoder.com/stat?c=problem_statement&pm=13016&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

9:55 jcromartie: also it looks like n is not used

9:56 OK that's helpful thanks

9:56 yeah, it can be big shift from procedural to functional

9:58 bontucode: jcromartie: 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

9:58 jcromartie: sure

9:59 P.S. docstrings are good, maybe start over with this to help: https://www.refheap.com/67377

10:00 now nobody can be confused about what your function is supposed to do :)

10:00 cYmen: well, it's still called "count-tuples" :p

10:00 jcromartie: yeah that's straight from the page

10:01 it is supposed to return the count, updated docstring :P

10:02 bontucode: jcromartie: point noted :)

10:02 jcromartie: I think that the point of this exercise is likely not, in fact, to compute all of the sequences…

10:03 bontucode: jcromartie: yes at this stage I am just trying to generate set of sequences

10:03 cYmen: bontucode: 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:04 ornicar: hello, what's the @ in clojure? Like in `(::http/response-stream @http-agent)`

10:04 cYmen: so (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:04 ornicar: it's very difficult to find the answer to this question on Internet.

10:05 cYmen: ornicar: that's used for atoms

10:05 jcromartie: not just atoms

10:05 ornicar: it means "dereference"

10:05 cYmen: http://clojure.org/atoms

10:05 ornicar: ok, thank you, that I can google

10:05 jcromartie: i.e. for a reference type (atom, agent, ref, future) return the value

10:05 ornicar: makes sense!

10:05 cYmen: ornicar: listen to him he knows more than me! :)

10:05 ornicar: while we're at it... in the same expression, what's ::

10:05 jcromartie: @foo expands to (clojure.core/deref foo)

10:05 bontucode: cYmen: on the job

10:06 ornicar: I know :foo is the symbol foo, but what is ::foo ?

10:06 the symbol :foo ?

10:06 jcromartie: ,::foo

10:06 clojurebot: :sandbox/foo

10:06 jcromartie: ,(println ::foo)

10:06 clojurebot: :sandbox/foo\n

10:07 jcromartie: ornicar: it expands to a namespaced keyword in the current namespace

10:07 ornicar: ok, thank you very much!

10:07 jcromartie: useful for when you have maps that may have keys from different places

10:08 ornicar: I naively thought keys were global

10:08 but they're namespaced, that's great

10:08 jcromartie: well keywords are just values

10:08 cYmen: ...

10:08 Any my head is like "keywords cannot be namespaced...keywords are MAGIC!"

10:09 jcromartie: it's just "namespaced" in the sense that it has a namespace part and a name part

10:09 ,(name ::foo)

10:09 clojurebot: "foo"

10:09 jcromartie: ,(namespace ::foo)

10:09 clojurebot: "sandbox"

10:09 cYmen: ,(namespace :foo)

10:09 clojurebot: nil

10:09 jcromartie: but you could just as easily define :sandbox/foo anywhere else

10:09 ,(namespace :bar/foo)

10:09 clojurebot: "bar"

10:10 cYmen: I have no idea what this means. :p

10:10 gfredericks: $google clojure overloads namespace

10:10 lazybot: [Operator Overloading in Clojure - Stack Overflow] http://stackoverflow.com/questions/1535176/operator-overloading-in-clojure

10:10 gfredericks: $google gfredericks clojure overloads namespace

10:10 lazybot: [gfredericks/hacklog] http://hacklog.gfredericks.com/

10:11 gfredericks: that'll work

10:11 cYmen: ^

10:12 jcromartie: the 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:12 cYmen: gfredericks: What is a PSA?

10:12 gfredericks: clojurebot: PSA is a public service announcement

10:12 clojurebot: In Ordnung

10:12 jcromartie: but a namespaced keyword is just a *value*, and the namespace/name are really just a convention

10:12 tl;dr don't worry about it

10:12 gfredericks: they're two concepts that are technically independent but still have a lot of overlap

10:36 futile: Is there a lib for faking out the file system in Clojure?

10:41 clgv: futile: just build functions in your application through which you access files then you can mock those functions. you probably need them anyway

10:42 gfredericks: using raynes/fs would enable that presumably

10:42 futile: I see.

10:42 Thanks.

10:42 Raynes: Faking out the file system?

10:42 Raynes fs would enable that?


10:42 gfredericks: with-redefs

10:42 Raynes: Fair enough good sir.

10:43 Fair enough.

10:43 clgv: Raynes: somehow you sound like a bot today. too much coffee?

10:43 ;)

10:43 Raynes: clgv: 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:43 But close!

10:44 clgv: Raynes: ouch! get well soon.

10:44 futile: It 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:44 Raynes: futile: fs implements temporary file and directory creation itself.

10:45 futile: Raynes: excellent

10:45 clgv: futile: dots are not that important except from when you are on windows ;)

10:46 futile: clgv: touche

10:49 gfredericks: reiddraper: 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:49 shrinking :abc to :abb doesn't feel helpful to me in a lot of use cases

10:50 we could also do it just for keywords (not strings)

10:51 clgv: gfredericks: random permutations and vectors of distinct numbers of a given range would be great as well^^

10:52 reiddraper: gfredericks: have you seen the noshrink function?

10:52 gfredericks: nope!

10:52 clgv: gfredericks: I guess an explicit generator for those would be more efficient compared to generating arbitrary integer vectors and checking them via a predicate

10:52 * gfredericks scuttles over to the source code

10:53 futile: Raynes: you should set the docs for FS to link to the source on github.

10:54 Raynes: I should get rid of the docs.

10:54 futile: Raynes: why?

10:54 gfredericks: reiddraper: ok, this helps a lot; is probably good enough

10:54 Raynes: Because the code is pretty good documentation.

10:54 clgv: :/

10:54 futile: Raynes: People like me prefer good docs.

10:54 Raynes: I don't see how a list of functions is 'good docs'

10:55 clgv: user stories of using the lib are good docs ;)

10:55 Raynes: There is literally no difference between scanning through the web API docs than just scanning through the actual source file itself

10:55 futile: ok

10:55 Raynes: That's my only point.

10:56 futile: Why is there both https://clojars.org/fs and https://clojars.org/me.raynes/fs ?

10:57 Raynes: The former is prior to me using groupids for my projects.

11:03 futile: Ah.

11:26 * gfredericks just proposed mapply to prismatic/plumbing

11:53 muhoo: fwiw, when i want api docs in html format, i just run marginalia on the codebase

11:54 makes it nice 'n purty

11:55 katratxo: muhoo: it just works?

11:55 muhoo: katratxo: yeah, you can run it on someone else's codebase

11:55 no api docs? no problem. bang, api docs.

11:55 katratxo: muhoo: nice!

11:56 muhoo: http://fogus.me/fun/marginalia/ fyi

11:57 actually, better link: https://github.com/gdeer81/lein-marginalia

11:57 gfredericks: aggressive shrinking idea: tuple should first try shrinking everything at once

12:01 muhoo: lol fogus "Here is a snowman ☃"

12:03 * gfredericks gives up trying to modify the monadic code in test.check

12:04 cbp: stumped by a CA? :-p

12:07 twem2: irc

12:13 TravisD: With 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:13 snowstalker: TravisD see lein-exec

12:13 technomancy: TravisD: you can put them in a profile and run `lein with-profile +incanter repl`

12:14 TravisD: Ah, cool, thanks :)

12:14 (inc technomancy)

12:14 lazybot: ⇒ 103

12:19 TravisD: profiles are merged into the project config with (partial merge-with into), or something?

12:20 technomancy: TravisD: it's a bit more nuanced than that, but that understanding should get you pretty far

12:20 TravisD: :)

12:31 gfredericks: clojurebot: it is a bit more nuanced than that, but that understanding should get you pretty far

12:31 clojurebot: Ok.

12:31 hyPiRion: clojurebot: is?

12:31 clojurebot: is is commutative

12:31 hyPiRion: clojurebot: it?

12:31 clojurebot: it is a bit more nuanced than that, but that understanding should get you pretty far

12:31 TravisD: clojurebot: it is a?

12:31 clojurebot: Huh?

12:31 TravisD: :(

12:32 gfredericks: ~it

12:32 clojurebot: it is for clojure.pprint/cl-format :)

12:32 hyPiRion: heh

12:32 gfredericks: ~it

12:32 clojurebot: it is for clojure.pprint/cl-format :)

12:32 gfredericks: ~it

12:32 clojurebot: it is a lie

12:32 gfredericks: ~it

12:32 clojurebot: it is greek to me

12:32 gfredericks: ~it

12:32 clojurebot: it is a bit more nuanced than that, but that understanding should get you pretty far

12:33 gfredericks: "We're a small startup hacking together to try to build the first real life clojurebot."

12:37 hyPiRion: gfredericks: "We're a startup trying to understand how clojurebot works"

12:38 gfredericks: "We're a startup trying to automate the process of bringing a startup from pre-concept to IPO."

12:39 hiredman: clojurebot: clojurebot is the cloud

12:39 clojurebot: Roger.

12:41 gfredericks: we're a marketing-only startup trying to find ways to convince people to give us money without providing any goods or services

12:41 hiredman: I 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:41 technomancy: yes please

12:42 hiredman: then feed all that back in to clojurebot

12:42 Anderkent: TravisD: I also like lein try: lein try <artifact-name> <version>?

12:42 it'll find the by defualt latest release of the artifact and give you a repl with it

12:42 hiredman: clojurebot: clojurebot |queues| for elephants

12:42 clojurebot: Ok.

12:42 TravisD: Anderkent: cool, that's pretty light weight

12:43 malyn: gfredericks: Here's your pitch video -- https://www.youtube.com/watch?v=2YBtspm8j8M

12:43 TravisD: can you load multiple artifacts?

12:43 Anderkent: no, but it should be pretty easy to add

12:43 pull request go! :P

12:43 TravisD: haha

12:43 go go pull request?

12:43 Anderkent: actually

12:43 i ilied

12:43 you can

12:43 TravisD: oh hurray

12:43 technomancy: lein-try is useful if you don't want to store the dependency set in your profiles file on disk

12:44 TravisD: yeah, for me I think it's actually better to have a profile. There are a few dependencies that I often want to use

12:44 technomancy: seems like it's intended for one-offs primarily

12:44 hehe https://twitter.com/sorenmacbeth/status/449412230803517441

12:44 gfredericks: lein-try: for when the latency of going to disk is too high for the dependencies you need

12:44 TravisD: heh

12:44 saolsen: anybody have an examply of using om with canvas drawing?

12:45 gfredericks: saolsen: I've been wondering about SVG; haven't done any searching though

12:46 malyn: saolsen: 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:46 saolsen: yeah, svg could be cool. I found this https://github.com/facebook/react-art

12:47 malyn: saolsen: SVG and Om https://github.com/kovasb/yantra/blob/master/src/cljs/yantra/graphics.cljs

12:47 Anderkent: gfredericks: I usually use it when I can't be bothered looking for version strings

12:50 gfredericks: I 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:50 (and not bothering looking for version strings of course)

12:53 bontucode: cYmen: 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:55 Bbarrett: i am trying to create a java file object to be passed as a parameter to a function

12:55 what is the best way to do that?

12:56 cbp: (File. "foo") ?

12:56 TravisD: Related 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:56 Bbarrett: thanks

12:56 bontucode: cYmen_: 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:58 jcidaho: TravisD, just do M-x cider - localhost & port - should spin up a new repl

12:59 Bbarrett: I 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:59 thought I was properly defining it as a file, but not sure

12:59 TravisD: jcidaho: do I have to start nREPL manually that way?

12:59 technomancy: TravisD: the current directory will be wherever you jacked in from

13:00 TravisD: technomancy: Ah, and can I get it to use include a lein profile when it starts?

13:00 technomancy: TravisD: cider-server-command

13:00 should do it

13:01 cbp: Bbarrett: If (type my-file) returns File then it's a file, though it may not exist

13:02 Bbarrett: thanks

13:02 I will check it out

13:02 TravisD: technomancy: Fantastic :)

13:02 Is it a bad idea to permanently modify my cider-server-command?

13:03 malyn: Bbarrett: You might check out the fs library as well -- https://github.com/Raynes/fs

13:03 Bbarrett: ah, thanks, I definetely will

13:03 I have heard good things

13:10 technomancy: TravisD: depends what you do

13:11 TravisD: technomancy: I might make another function called incanter-jack-in which modifies cider-server-command, jacks in, and then reverts it

13:11 or something.

13:12 gtrak: TravisD: it's ok, emacs is accretion of hacks.

13:15 ' the formation of planets and other bodies by collection of material through gravity;'

13:15 is a fitting analogy

13:29 Anderkent: Anyone familar with clojure improvement process? When shuold I expect http://dev.clojure.org/jira/browse/CLJ-1330 to land - weeks, months, longer?

13:31 Bronsa: Anderkent: who knows. if you can vote the ticket so it will hopefully get more visibility

13:33 gtrak: I'd expect it to get in to 1.7

13:34 it was a little late for 1.6

13:35 there's only 3 bugs with 'critical' priority, and that's one of them.

13:44 bontucode: Could some one review my solution for a top-coder problem: http://community.topcoder.com/stat?c=problem_statement&pm=13016&rd=15846

13:45 https://www.refheap.com/67435

13:45 It fails for the sample input no 3 that's on the problem page

13:46 with stackoverflow

13:46 I may need to have a interative solution for create-sequence instead of a recursive one

13:46 jcromartie: bontucode: you may be able to make it recursive, but not like that

13:47 you can recur forever with `recur`

13:47 calling (create-seq) within create-seq itself consumes stack

13:47 Clojure makes tail-recursion explicit

13:47 or rather it requires it to be explicit, to get any benefit

13:48 bontucode: jcromartie: so is using loop, recur like a iteration? or is it actually a recursion that I dont understand well

13:49 jcromartie: you can use recur without loop

13:50 ,((fn [x] (if (> x 0) (recur (dec x)) "zero!")) 10)

13:50 clojurebot: "zero!"

13:51 jcromartie: also (if x true false) may as well be just x

13:51 Anderkent: jcromartie: (boolean x) surely

13:51 jcromartie: i.e. (filter #(= (gcd-polynom x) k) …)

13:52 Anderkent: ah nvm didnt see the filter context

13:52 jcromartie: Anderkent: technically I suppose but in this case...

13:52 Anderkent: yeah sorry

13:52 jcromartie: er that is irc://irc.freenode.net:6667/#(= (gcd-polynom %) k)

13:52 Anderkent: :D

13:52 bontucode: jcromartie: totally, that was silly

13:53 sdegutis: Raynes: fs/copy ignores my file's permissions, is there a way to make it use the same permissions?

13:54 Raynes: Fork fs and send me a pull request :P

13:54 sdegutis: Seriously?

13:54 Raynes: Well, if it doesn't adhere to permissions then I think so.

13:54 sdegutis: Hmm, it's using io/copy, I wonder if that even takes permissions into account.

13:55 does not appear so -- http://clojure.github.io/clojure/clojure.java.io-api.html#clojure.java.io/copy

13:56 Anderkent: i don't think it's even doable on java 6

13:57 on java 7 i think you want Files.copy(Path, Path, COPY_ATTRIBUTES)

13:59 sdegutis: Oh wow.

13:59 That's fine, I can just use fs/chmod

14:01 Who'da thunkit that correctly copying file permissions would be the hardest part of this utility.

14:01 Anderkent: right, but you can't really trust that, race conditions galore

14:01 sdegutis: Or at least most tedious.

14:02 Besides permissions, this thing is pretty much done :D

14:02 * sdegutis so excite

14:02 gtrak: much permit

14:03 i had the same problem trying to unzip files with java

14:03 bontucode: jcromartie: 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:03 Bbarrett: what is the best way to search for a sub-string within a string in clj

14:03 Anderkent: goddamnit

14:03 ctrl-cing gpg password prompt messes your terminal up *real good*

14:03 Bbarrett: .contains is only for maps or vectors right?

14:03 Vfe: For a very frequently called function(potentially tens of thousands of times a minute) is there any appreciable performance different between if and cond?

14:04 Bbarrett: or contains? rather

14:04 Anderkent: Bbarrett: maps and sets really, vectors i'd call it iffy

14:04 Bbarrett: okay

14:04 gtrak: Vfe: cond is if in the macroexpansion.

14:05 justin_smith: Vfe: case can be much faster than cond though

14:05 jonasen: Bbarrett: (re-find #"bar" "foobar")?

14:06 Bbarrett: ahh

14:06 justin_smith: (direct jumps based on result's identity vs. call / jump / call / jump ...

14:06 )

14:07 Vfe: Thanks 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:07 jonasen: Bbarrett: or maybe (.indexOf "foobar" "bar")

14:08 Bbarrett: excellent

14:08 thanks

14:10 Anderkent: Did 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:13 sdegutis: What are the file-permission workarounds in Clojure/Java?

14:14 amalloy: work...arounds? like, something more devious than just setting correct file permissions?

14:14 sdegutis: For when copying files

14:14 amalloy: Anderkent: i know Raynes and ninjudd both had it working on their macs at geni

14:15 Vfe: :Anderkent I have it working as well, though I honestly can’t tell you what I did forever ago O.o

14:16 sdegutis: Oh wait, I'm apparently using Java 7, so I can just use java.nio.file.StandardCopyOption/COPY_ATTRIBUTES

14:16 Anderkent: sdegutis: exec cp file other-file?

14:16 :D

14:17 sdegutis: Anderkent: that's not a half bad idea either actually

14:18 gfredericks: I think I just started a twitter fight about CLJS numerics

14:21 sdegutis: ping

14:25 justin_smith: ,(apply str (map char [112 111 110 103]))

14:25 clojurebot: "pong"

14:26 sdegutis: :)

14:26 bontucode: jcromartie: 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:27 justin_smith: bontucode: you can use recur where you would usually use a call to the same function

14:27 AmandaC: KSP

14:27 justin_smith: as long as it is in a "tail position"

14:27 AmandaC: er, ignore that

14:27 justin_smith: clojure will tell you if it is not in a tail position

14:29 bontucode: justin_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:29 justin_smith: then you need to add arguments so that the extra work after that call is carried in an accumulator

14:30 such that the recur can be at the tail

14:30 this would also be true in a lang with TCO

14:30 amalloy: bontucode: that is not really an algorithm that is amenable to tail recursion

14:33 bontucode: amalloy: you mean, I cannot build the results in a bottom up fashion?

14:33 gfredericks: I'm thinking of trying to make this fancier, maybe via nrepl middleware: https://github.com/georgejahad/debug-repl

14:34 technomancy: gfredericks: how would it function as a middleware?

14:35 gfredericks: technomancy: it wouldn't be just middleware; but maybe the middleware could be used for setting the context of the repl?

14:35 letting you bounce around your breakpoints

14:35 technomancy: ah, multiple sessions or something

14:36 gfredericks: yeah

14:36 technomancy: a session multiplexer

14:36 gfredericks: fo sho

14:36 technomancy: cool beans

14:37 http://p.hagelb.org/make-it-sew.gif

14:49 locks: oh god

14:50 bontucode: (map (fn [x] [x]) (range 3))

14:50 ,(map (fn [x] [x]) (range 3))

14:50 clojurebot: ([0] [1] [2])

14:50 jcromartie: ,(map vector (range 3))

14:50 clojurebot: ([0] [1] [2])

14:51 bontucode: ,(map #([%]) (range 3))

14:51 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>

14:51 amalloy: bontucode: #([%]) is (fn [x] ([x])), not (fn [x] [x])

14:52 bontucode: amalloy: right, so how to compress it?

14:52 amalloy: bontucode: (fn [x] [x]) is also vector, as jcromartie pointed out

14:52 bontucode: aah, got it, thanks

14:52 yes, I missed that earlier, thnx

14:52 amalloy: but like...another answer is: don't. who cares about a few bytes

14:52 write something legible, not something short

14:52 locks: ^

14:55 bontucode: amalloy: true

14:59 what is the best way to approach this problem of generating sequence of length n, from the given list of numbers ?

15:08 michaniskin: (take n (cycle list-of-numbers)) ?

15:10 jcromartie: bontucode: well maybe reduce it to the mathematical constructs first

15:10 bontucode: also worth noting: you have your arg lists and doc strings backwards

15:11 it goes (defn name doc-string? [params] ...)

15:12 ,(do (defn foo "bar" []) (doc foo))

15:12 clojurebot: "([]); bar"

15:12 jcromartie: ,(do (defn foo [] "bar") (doc foo))

15:12 clojurebot: "([]); "

15:13 bontucode: michaniskin: sorry, need to generate all sequence of length n from the given list of numbers

15:14 jcromartie: thx

15:14 jcromartie: bontucode: how about starting as simple as possible: write a function that returns the *next* sequence

15:15 bontucode: jcromartie: what is *next* sequence?

15:16 jcromartie: asterisks for *emphasis*

15:16 TimMc: What is *emphasis*?

15:17 jcromartie: :P

15:17 TimMc: ,clojure.core/*emphasis*

15:17 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: clojure.core/*emphasis*, compiling:(NO_SOURCE_PATH:0:0)>

15:17 TimMc: how do I english

15:17 bontucode: jcromartie: so what do you mean by next sequence? if input is [1 2 3] what should be the expected output?

15:18 ptcek: Is OpenJDK not recommended for Clojure? Any recent article about running on OpenJDK out there?

15:18 jcromartie: so if low = 0 and high = 1, and n = 1, then the selection that follows [0] is [1]

15:19 for n = 2, it goes (0 0) (0 1) (1 0) (1 1) right?

15:21 whodidthis: man, anyone know if fnhouse is close to being published on clojars

15:22 gtrak: ptcek: I use openjdk all the time, it's fine.

15:23 openjdk 7 and 8 are barely different from the oracle one.

15:23 6 works fine, too.

15:24 jcromartie: bontucode: also the mathematical/combinatorics term for this is "selections

15:28 bontucode: jcromartie: right. so the mathematical construct I had started with was, seq(N) = {seq(N-1), i}, for i = 0 to N

15:29 and to implement that I was using a bottom up building approach, to add the result of seq(N-1) and i.

15:29 jcromartie: ok, and the problem is that's not compatible with tail recursion

15:29 you could use laziness to work around that

15:30 but I don't know how (in)efficient that might be

15:31 bontucode: jcromartie: to start with, if it doesn't blow up with stackoverflow, I will consider myself on the next stage

15:32 Anderkent: you want to make it tail recursive then; that usually involves adding an accumulator

15:33 ptcek: gtrak: thanks. evaluating my posssibilities on BSD and oracle doesn't seem as good option there...

15:34 gtrak: ptcek: I read somewhere you could run the oracle jdk with linux compat, at least on freebsd

15:34 gfredericks: you can implement unbounded channels in core.async by replacing (>!! ch x) with (go (>!! ch x)) :)

15:34 >! for the second one, rather

15:35 Anderkent: oh, it's not just not tail-recursive, it branches out; not as simple as adding an accumulator then

15:35 or not, misread that code

15:36 jcromartie: I mean correct me if I'm wrong, but it's basically lexicographic ordering

15:36 ptcek: gtrak: I've seen this, but why to bother if OpenJDK is well supported and works... :)

15:37 gtrak: ptcek: meh :-), everything has tradeoffs

15:42 sdegutis: ,(->> (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:42 clojurebot: "poop"

15:43 gfredericks: sdegutis: playing with a string obfuscator?

15:44 jcromartie: now write something that takes a string and returns code like that

15:44 sdegutis: gfredericks: nope just taking a mental break from work

15:45 gfredericks: go model this in core.logig

15:45 logic

15:45 sdegutis: I tried to use only the digit 1

15:45 gfredericks: coreo.logico

16:03 rhg135: hello 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:03 gfredericks: rhg135: laziness probably

16:04 amalloy: indeed

16:04 hyPiRion: yes

16:04 rhg135: gfredericks: oh duh

16:04 * gfredericks feels affirmed

16:04 hyPiRion: rhg135: replace `for` with `doseq`

16:04 * rhg135 thought he understood laziness

16:04 rhg135: no i need results

16:05 gfredericks: doall

16:05 gtrak: rhg135: wrap it in doall

16:05 rhg135: ill force it

16:05 mhm

16:05 gfredericks: or (doto dorun) or prn or

16:05 rhg135: thx for waking my senses

16:05 amalloy: you need some way to actually get the value out of all those fork calls

16:05 gtrak: or you could close over Thread/currentThread outside of the for :-)

16:05 depending on what you want.

16:06 rhg135: amalloy: fork returns a future

16:07 the dorun works and i don't need lazyness

16:07 gtrak: dorun will lose the head.

16:08 and return nil

16:08 gfredericks: (throw (Exception. "Cannot find head!"))

16:09 rhg135: oops

16:09 i meant doall which is what i used

16:10 actually i mapv'ed a fork! private function

16:10 more concise imo

16:39 conner: anyone know a good way to be able to write in character literals when using paredit.. while still maintaining "\" as paredit escape?

16:39 (in emacs)

16:47 justin_smith: conner: C-q \

16:47 C-q and C-w are my two bits of "get out of jail free" in paredit, personally

16:49 conner: justin_smith: thanks!

16:50 justin_smith: C-w is combined with C-space to set mark, of course

16:50 conner: justin_smith: doing some pretty silly things with characters for an icon font right now: https://cloudup.com/cf9yRZzk5vE :P

16:53 justin_smith: nice

17:00 bbloom: ,(deftype MutBox [^:unsynchronized-mutable x])

17:00 clojurebot: sandbox.MutBox

17:00 bbloom: ,(.x (MutBox. 123))

17:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: x for class sandbox.MutBox>

17:01 bbloom: isn't that supposed to work?

17:01 what am i doing wrong...

17:01 gfredericks: ,(get "abc" -0.99)

17:01 clojurebot: \a

17:01 dnolen_: bbloom: no, mutable fields cannot be accessed outside

17:03 bbloom: dnolen_: 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:03 Bronsa: bbloom: no, you neet to have set/get methods

17:04 need*

17:04 bbloom: ,(set! (.__methodImplCache (fn [])) (clojure.lang.MethodImplCache. nil nil))

17:04 clojurebot: #<MethodImplCache clojure.lang.MethodImplCache@12c9015>

17:04 bbloom: i guess that'll do for my test case :-P

17:05 dbell: one 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:05 but now I'm dealing w/some core.async stuff and I'm realizing I don't know exactly how to handle this

17:05 if i'm passing channels around to multiple places, do the channels get multiplied?

17:06 gfredericks: channels 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:06 which is exactly how the consumer and producer end up looking at the same channel

17:06 or multiple consumers/producers

17:07 dbell: so, (let [c chan] (map (fn [n] {:num n :chan c}) (range 5))

17:07 wouldn't copy c everywhere, just the ref?

17:07 gfredericks: right

17:07 just one channel happening there

17:07 dbell: awesome, thank you

17:08 gfredericks: dbell: the identical? function can help sanity check these kinds of things

17:08 dbell: ,(doc identical?)

17:08 clojurebot: "([x y]); Tests if 2 arguments are the same object"

17:08 dbell: ah

18:02 cYmen_: hm...

18:03 I just tried adding env usage to my project but it seems the values are all nil.

18:03 Is there something I need to do when I want them set within cdier?

18:03 cider

18:05 Do I have to select the profile somehow?

18:14 craigbro: maybe restart?

18:28 cYmen_: Don't know...seems to not work from the console either

18:28 DomKM: Anyone know if there is a core.reducers implementation of partition-all? I want to process a large file in chunks.

18:28 cYmen_: lein with-profile dev ring server <- this should work, right?

18:29 llasram: nope

18:29 +dev

18:29 just `dev` means "only the :dev profile"

18:29 cYmen_: still all nil

18:30 llasram: nb that the default :default includes :dev anyway though

18:30 cYmen_: well crap I must have set it up wrong

18:31 I can access the values with (env :somename), right?

18:32 and set them using :env {:somename "foo"}, correct?

18:36 Luca: irssi -n keppy

18:36 exit

18:40 llasram: DomKM: 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:42 Hmm, `partition-all` though -- I was thinking `partition-by`. Interesting. Just as tricky, but for different reasons!

18:43 TravisD: What was the emacs variable to customize the command executed by cider-jack-in? I can't remember :(

18:44 DomKM: llasram: 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:44 technomancy: TravisD: M-x apropos-variable cider command

18:45 llasram: DomKM: Well, be careful with the `distinct` -- it does removes only *adjacent* duplicates

18:45 TravisD: technomancy: That only seems to show cider-switch-to-repl-command

18:45 llasram: DomKM: (because this is intended for a sorted MapReduce context)

18:45 DomKM: llasram: Thanks for the warning. I saw that and it's actually perfect for my usecase.

18:46 technomancy: TravisD: sorry, cider.*command

18:46 TravisD: oh weird. After jacking in the variable shows up

18:46 but not before

18:46 cYmen_: oh what the hell

18:46 technomancy: TravisD: oh sure; if cider isn't loaded yet

18:46 cYmen_: can anybody give me hint on how to debug where these profile settings are getting lost?

18:46 TravisD: weird that some variables are there but not all

18:47 justin_smith: cYmen_: maybe you are both setting the value manually, and you have a customize block with a different setting in it?

18:48 cYmen_: All I did was add an :env {...} map to both the dev and production profiles of a default compojure-app project

18:48 and they both contain the same keys

18:48 justin_smith: ah, I was thinking emacs sorry

18:48 cYmen_: ah, sorry

18:48 emacs has profiles? :)

18:49 justin_smith: sometimes I've seen a settings file called a profile

18:49 llasram: DomKM: There's also bbloom's tranduce libray, which lets you trivially implement `partition` (but still not `partition-all`): https://github.com/brandonbloom/transduce

18:50 ,tranduce,transduce,

18:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tranduce in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:50 llasram: haha

18:52 bbloom: llasram: why would partition-all be any harder to implement than partition?

18:53 llasram: bbloom: Because you need to do something different at the end of the reduction

18:53 Emit something from the partially-accumulated state

18:54 bbloom: 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:54 bbloom: llasram: that shouldn't be a problem if you just emit the states and then do a pass over that

18:55 llasram: bbloom: 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:56 cYmen_: ah crap

18:56 lein clean solved everything

18:57 justin_smith: my favorite voodoo fix-anything-weird option

18:57 cbp: when everything else fails..

18:57 llasram: bbloom: I believe this is essentially the issue cgrand raised on the dev ML a while ago wrt reducers and transients

18:57 justin_smith: cbp: well it's easy enough to do you may as well try it first!

18:57 amalloy: i mean, if you don't have AOT, it's pretty hard to get into a state where lein clean does any good

18:58 technomancy: every time lein clean solves a problem, an angel loses its wings

18:58 Anderkent: amalloy: is it? protocols / records still generate class files when loaded, don't they?

18:58 amalloy: no

18:58 Anderkent: huh. I had that thought cached for some reason

18:59 amalloy: only if you have aot are classfiles ever generated, i'm fairly sure

19:00 that's basically what aot means: compile classfiles ahead of time :P

19:00 bbloom: llasram: just (concat input [::done])

19:00 llasram: store each item in the state, emit it on the next go

19:02 llasram: bbloom: Except that `concat` doesn't compose with reducers which aren't also lazy sequences :-)

19:03 amalloy: llasram: it's easy to model concat as a reducer. in fact there's a concat reducer

19:03 llasram: amalloy: 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:04 bbloom: llasram: if your inputs are uncounted, then you have a seq probably, so regular concat works :-P

19:04 llasram: bbloom: My inputs are the (potentially) unbounded collection of input records to a MapReduce task :-p

19:05 bbloom: llasram: i'm not saying that it's ideal, but mapcat-state can serve as a fully general yield construct

19:05 amalloy: llasram: sounds like a lazy seq to me?

19:06 like, don't you get an Iterable<T> inputs, such that you can just call (iterator-seq inputs) and use lazy seqs?

19:06 bbloom: llasram: also, you can just use mapcat identity w/ uncounted values

19:06 (require 'clojure.core.reducers)

19:06 ,(require 'clojure.core.reducers)

19:06 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: >

19:06 bbloom: boo

19:07 llasram: amalloy: 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:08 amalloy: that's weird, bbloom. i know clojurebot runs a version that has reducers

19:09 llasram: bbloom: I'm sold. I just really hadn't considered concatenating a terminator. Cool -- this will really simplify some code

19:09 bbloom: llasram: clearly not enough C programming :-P

19:10 ztellman: amalloy: are there whitelists for namespaces in clojurebot?

19:11 llasram: bbloom: Haha. Decade-ago me would be scandalized!

19:11 amalloy: i don't think so

19:12 llasram: amalloy: 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:17 hiredman: clojurebot's sandbox can be finicky about loading stuff

19:18 rhg135: finally got it, https://www.refheap.com/67630

19:18 now i need a parser to populate the data types

19:20 amalloy: rhg135: 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:20 that is, the (debug "Results:" ...) line is all that's making you wait for the futures to finish

19:20 rhg135: amalloy, it's laziness on my part

19:21 eventually i'll get timbre

19:21 bbloom: rhg135: and that laziness will cause other laziness to burn you :-)

19:21 amalloy: i 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:21 rhg135: i am?

19:22 hmm

19:22 amalloy: because 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:22 and that will break everything about your dependency model

19:23 rhg135: oh amalloy invoke-all returns a Collection of *realized* futures

19:24 amalloy: huh, apparently it does. that's pretty weird, but okay

19:24 rhg135: yup

19:34 i see one huge problem, what if something is depended on by multiple targets?

19:36 amalloy: rhg135: 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:36 then you build them all, in dependency order

19:37 rhg135: amalloy, i tried that i hit a dead-end

19:37 couldnt build a graph

19:39 bontucode: is it possible to simply assoc a global map? or do we have to alter it under dosync ?

19:39 justin_smith: bontucode: do you want the global map to change?

19:40 bontucode: justin_smith: yes

19:40 justin_smith: then yeah, it should be a ref or atom

19:41 bontucode: justin_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:42 rhg135: could i get some advice on how i could get this graph?

19:42 amalloy: rhg135: look up the algorithm that make, ant, maven, and so on use

19:43 it's not a novel problem, so someone else should have a solution you can use

19:43 rhg135: thanks, amalloy

19:43 yeah...

19:43 justin_smith: bontucode: 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:45 (let [r (ref {:a 0})] (dosync (alter r update-in [:a] inc)) @r)

19:45 ,(let [r (ref {:a 0})] (dosync (alter r update-in [:a] inc)) @r)

19:45 clojurebot: {:a 1}

19:49 rhg135: ant is HUGE

19:49 amalloy: i advise you to shield your eyes before you look at maven, then

19:49 bontucode: justin_smith: I want to do, (let [r (ref {:1 1 })] (dosync (alter r assoc :2 (inc (:1 @r)))) @r)

19:49 rhg135: amalloy, i expected as such since maven does way more lol

19:50 jlpeters: what'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:50 number>> is passed into the function. I smell a macro here but my skills, while growing daily, remain lacking to create it

19:52 rhg135: i can't even find this in there?

19:52 cbp: time to update lein new to put 1.6.0 in dependencies? :-D

19:52 rhg135: now i wonder how it even works?

19:53 cbp: rhg135: soldier on good soul

19:55 rhg135: i am, it just hurts D:

19:55 technomancy: cbp: already there

19:55 cbp: technomancy: oh. Do I have to upgrade lein then?

19:56 technomancy: cpb: need to run master or wait for a release

19:56 cbp: ah

19:57 rhg135: the scary part is this isn't uncommon

20:35 kras: Hi, I am looking for a simple graph library similar to networkx in python, any suggestions?

20:36 chare: whats the difference between -> and ->>

20:36 rootex: >

20:36 hiredman: kras: loom might be a good place to start

20:37 Frozenlock: chare (-> "x" (str "a")) will give you (str "x" "a")

20:37 while (->> "x" (str "a")) will give you (str "a" "x")

20:39 gfredericks: ,(-> 'x (str 'a))

20:39 clojurebot: "xa"

20:39 gfredericks: ,(-> 'x (str 'a 'b 'c 'd))

20:39 clojurebot: "xabcd"

20:39 gfredericks: ,(->> 'x (str 'a 'b 'c 'd))

20:39 clojurebot: "abcdx"

20:40 kras: hiredman: thank you, will give it a try

20:40 gfredericks: wow, I didn't know about clojurebot

20:41 gfredericks: clojurebot: clojurebot?

20:41 clojurebot: clojurebot is broken

20:41 gfredericks: clojurebot: clojurebot?

20:41 clojurebot: clojurebot is a multimap

20:41 gfredericks: clojurebot: clojurebot?

20:41 bitemyapp: Raynes: pick up the pieces.

20:41 clojurebot: clojurebot is broken

20:41 Bronsa: so, I just compiled clojure.core with tools.emitter.jvm.

20:42 gfredericks: Bronsa: okay so we'll all switch now?

20:44 Bronsa: do you have some sort of measurement of how close it is to the existing compilation?

20:44 Bronsa: gfredericks: I still have to make sure that everything works without errors after being recompiled though

20:44 there 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:45 gfredericks: compilation time or bytecode?

20:45 gfredericks: Bronsa: bytecode

20:47 Bronsa: nom but it should be pretty similar overall, I haven't made many changes

20:47 no*

20:48 the biggest change is that t.e.j emits typed bytecode while Compiler.java tags every object as Object and check-casts when needed

20:49 gfredericks: oh wow

20:49 amalloy: !!

20:49 gfredericks: is that significant for runtime perf?

20:49 llasram: (inc Bronsa)

20:49 lazybot: ⇒ 19

20:49 llasram: This is totally awesome

20:50 amalloy: i 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:50 Bronsa: gfredericks: I havn't done any perf test yet, will do them once I get everything to work :P

20:51 gfredericks: git commit -m "got the last thing to work"

20:52 Bronsa: I enjoyed your proxy talk at clojurewest

20:52 Bronsa: gfredericks: the only downside (that I actually think is an enhancement) is that some functions will throw at runtime

20:52 e.g. ns-interns

20:52 hyPiRion: I really like commits where the message is like "fixed a bug"

20:52 gfredericks: "boog stompin"

20:53 Bronsa: because (fn [^Y x] ..) when compiled with t.e.j will throw when x is not a Y

20:53 Raynes: bitemyapp: ?

20:53 bitemyapp: Raynes: pick up the BRRAAIIIIINNZZZZ

20:53 gfredericks: Bronsa: oh right. that's interesting

20:53 Bronsa: gfredericks: yeah, tbaldridge did an awesome talk

20:53 Raynes: bitemyapp: I have no idea what you're talking about.

20:53 bitemyapp: Raynes: it's okay.

20:54 Raynes: >_>

20:54 * Raynes wobbles off

20:56 kras: Looking 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:56 Tried to follow a conversation on clojure group but cudn't understand anything :-(

20:56 bitemyapp: Raynes: <3

20:56 hiredman: kras: I have not found that to be the case

20:56 no idea why they say that

20:57 kras: https://github.com/aysylu/loom#usage

20:57 hiredman: kras: I was just using it earlier today without any aot compilation

20:58 hyPiRion: kras: I guess it has some protocols which may be needed in some functions

20:58 not sure if AOT is strictly required, though

20:58 kras: hiredman: does it have to do with the clojure version? I am using 1.5.1

20:58 hiredman: kras: me too

20:59 kras: I actually chimed in on that mailing list thread

21:03 kras: they aren't using protocols/records correctly, and they thrashed around and ended up discovering aot solved it without understanding the problem

21:03 kras: is you always load loom.graph before loading loom.attr you should be fine

21:04 before loom.label too

21:06 and :use everywhere :/

21:13 kras: hiredman: thanks for the advice, will try

21:18 rhg135: here's my probably horribly-inefficient dep graph generator, https://www.refheap.com/67725

21:22 amalloy: rhg135: transients aren't pointers - you can't just bash on them in place

21:22 you have to use the return value from conj!

21:22 rhg135: amalloy, strange how it works then ;)

21:23 amalloy: it'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:24 but 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:24 rhg135: hmm

21:24 i'll rewrite it

21:24 Anderkent: or use a volatile-mutable if you need both

21:24 amalloy: you can even use an atom around a transient, if you wan

21:24 t

21:24 rhg135: before release too

21:24 amalloy: (swap! a conj! whatever)

21:25 Anderkent: amalloy: eh, function given to swap has to be side-effect free

21:26 amalloy: Anderkent: well, yes and no. this atom is local, so he knows nobody else will ever touch it

21:26 so nothing will retry, etc etc

21:26 but yes, it's not a great practice

21:27 which is why i'd just use reduce - this isn't a complicated computation that needs mutability

21:27 Anderkent: sure, I didnt look at the code

21:28 michaniskin: https://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/kahnsort.clj

21:29 amalloy: roughly like https://www.refheap.com/9fd1a28c2f89e5ccd0647a255

21:29 rhg135: i don't think walking through a sequence twice is good either

21:30 amalloy: what does that have to do with anything?

21:31 rhg135: in the first function there

21:31 bbiab

21:43 hiredman: kras: 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:45 technomancy: please kickban __VenTys__; it seems to be some kind of bot, keeps privmsging me links

21:47 possibly triggered by saying "loom"

21:50 hyPiRion: hrm, by saying loom you say?

21:51 yup.

21:51 hiredman: weird

21:54 gfredericks: I've gotten two PMs in the last couple hours and have never said that word

21:54 hiredman: multiple triggers?

21:54 the only thing to do is get a dictionary and start throwing out words

21:54 gfredericks: oh there's a third

21:55 hyPiRion: Oh, I'll start

21:55 aardvark

21:56 what, that bot actually replied to me when I said that.

21:56 gfredericks: abaci

21:57 aback

21:57 hiredman makes up the FUNNEST games

21:58 michaniskin: i wish to say loom, too

21:58 bam

21:58 gfredericks: my best theory is that it's as soon as you start talking after a bit of silence

21:58 llasram: I'll just go with aardvark

21:58 gfredericks: somebody else pipe up

21:59 oh no it got him

21:59 llasram: Hmm, no new messages, but apparently messaged me hours ago and I didn't notice

21:59 gfredericks: llasram: thank goodness you're safe

22:00 llasram: :-)

22:02 gfredericks: show gratis (solo hooy) ;; is hooy a typo for hoy?

22:02 is this not spanish?

22:02 michaniskin: it's a celebratory hoy

22:04 gfredericks: what does "show" mean?

22:07 technomancy: ah actually quiet is probably not enough for a bot gone awry

22:08 hiredman: clojurebot: thank technomancy

22:08 clojurebot: Huh?

22:08 bjeanes: hello everybody

22:10 technomancy: not sure that actually worked, hostmasks are weird

22:11 Bronsa: technomancy: he's back in

22:11 hyPiRion: clojurebot: thank technomancy |is| Thank you technomancy!

22:11 clojurebot: c'est bon!

22:11 hyPiRion: clojurebot: thank technomancy

22:11 clojurebot: thank technomancy is Thank you technomancy!

22:11 hyPiRion: whoops.

22:15 gfredericks: clojurebot: thank technomancy is thank technomancy is <reply> is Thank you technomancy! is

22:15 clojurebot: Roger.

22:17 hyPiRion: gfredericks: wat

22:17 michaniskin: technomancy: does leiningen do anything special with respect to data_readers.clj when installing dependencies?

22:17 hyPiRion: and this dude keeps spamming me

22:19 gfredericks: hyPiRion: you teach the bot something weird, I teach him something weirder

22:19 llasram: michaniskin: Since 2.3.4 (IIRC) it does something special when uberjaring, if that's what you mean?

22:19 hyPiRion: clojurebot: thank technomancy

22:19 clojurebot: thank technomancy is thank technomancy is <reply> is Thank you technomancy! is

22:20 Bronsa: lol

22:20 llasram: michaniskin: Otherwise it's all just class path entries, which the code in Clojure handles merging multiple instances of

22:20 Bronsa: (inc gfredericks)

22:20 lazybot: ⇒ 47

22:20 hyPiRion: gfredericks: it did exactly what I expected it to do. Which was a bit unexpected, if that even makes sense

22:20 michaniskin: llasram: 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:21 i'm not using leiningen, which is why i was thinking that lein was doing something special

22:22 llasram: michaniskin: Are you pulling in new JARs via classloader fun after Clojure itself is loaded?

22:22 michaniskin: llasram: yup

22:22 llasram: Ok. clojure.core loads all the `data_readers.clj` it can find when it itself is first loaded

22:22 And that's it

22:23 If you want to load things after-the-fact, you'll need to do something yourself

22:23 michaniskin: i suppose it's ok to find them in the jars and merge them in myself, right?

22:23 hiredman: it is amazing the bugs you'll find using eastman

22:24 loom's tests have a bunch of (is (= foo) bar)

22:24 clearly meaning to be (is (= foo bar))

22:24 llasram: michaniskin: Or even just ##(#'clojure.core/load-data-readers)

22:24 lazybot: ⇒ {}

22:24 llasram: Haha, not quite what I expected to happen

22:24 ,(#'clojure.core/load-data-readers)

22:24 clojurebot: {}

22:24 michaniskin: llasram: awesome, that saves me some time!

22:26 gfredericks: $google github eastman clojure fingerhut

22:26 llasram: michaniskin: 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:27 Is eastman a fork of eastwood or something?

22:27 hiredman: oh, I meant eastwood

22:27 llasram: Oh, hah

22:27 michaniskin: llasram: that seems reasonable and what you'd expect if it were done automatically

22:28 gfredericks: no wonder google was so bad at that

22:28 michaniskin: thanks llasram

22:29 hiredman: https://github.com/aysylu/loom/pull/16

22:31 * gfredericks runs eastwood for the first time

22:33 gfredericks: it couldn't resolve a buncha muh vars o_O

22:34 amalloy: hiredman: usually i write: (is = foo bar)

22:34 hiredman: are you putting defs inside defns again?

22:34 Bronsa: gfredericks: :( what's going wrong?

22:35 gfredericks: Bronsa: heckifiknow

22:35 Bronsa: are you running it on a public project?

22:35 gfredericks: no

22:35 sorry, too tired to dig into it right now

22:37 Bronsa: no worries, open a ticket with the error message when you have some time and I'll try to understand

22:37 and now __VenTys__ started spamming me too. thank god for /ignore

22:40 amalloy: i 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:49 ivan: that is more of a channel op thing for chouser or technomancy

22:49 yay, now I got it too

22:57 is there an nREPL middleware that prevents code execution until a secret cookie is presented?

23:01 bob2: niche

23:01 ivan: it seems at least a little wrong to execute code that other users send you

23:14 rhg135: vast imporvement imho https://www.refheap.com/67949

23:18 amalloy: wait, why isn't dedupe just clojure.core/distinct, rhg135?

23:19 right, nm, it's distinct-by, which doesn't really exist

23:20 rhg135: amalloy, oh i didn't know but yeah...

Logging service provided by n01se.net