#clojure log - Jun 13 2014

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

0:15 tolstoy: Any clue why this doesn't return any attributes: {:find [?attrs] :in [$ ?str] :where [[_ ?attrs ?str]]}?

0:18 Hm. Maybe I have to define some sort of full text search in there?

0:21 Or: "If both the entity and attribute positions of a clause are unbound and the value is specified, the value must be an entity id."

0:23 xeqi: michaniskin: I'll be interested to hear if you get the full tree you're looking for

0:25 michaniskin: xeqi: i'll let you know. it's slow going, though, and difficult to debug when things aren't working.

0:27 xeqi: my immediate goal is to be able to run an nrepl server in one pod and the reply repl client in another pod without getting namespace clashes

1:06 justin_smith: michaniskin: isn't there some kind of java architecture for things like this, with parallel modular classpaths or something? it looked very complicated and architected iirc

1:08 beamso: osgi?

1:09 justin_smith: that was the one indeed

1:09 I am sure michaniskin has seen this, and probably thought it looked silly http://en.wikipedia.org/wiki/OSGi

2:33 hellofunk: yes

2:45 Jaood: hellofunk: no way

2:48 IbrahimA: yes way

2:56 dbasch: &(str (get ["yes" "no"] (rand-int 2)) " way")

2:56 lazybot: ⇒ "yes way"

2:56 beamso: haha.

3:00 jonasen: &(str (rand-nth [“yes” “no”]) “ way”)

3:00 lazybot: java.lang.RuntimeException: Unable to resolve symbol: “yes” in this context

3:01 allenj12: does anyone else find om to be confusing?

3:02 beamso: seemed easier than angular to me (from tutes and initial dev work)

3:04 allenj12: beamso: hmm im new to all this kinda stuff, and the om tutorials kinda shove alot in your face at once

3:04 john2x: sufficiently complex manipulation of the DOM is inherently confusing

3:05 jonasen: &(str (rand-nth ["yes" "no"]) " way")

3:05 lazybot: ⇒ "yes way"

3:06 allenj12: so if i have a root watching a div, then i have a function that renders that original div, does it replace that div with the components i add?

3:06 beamso: it renders inside the div

3:06 allenj12: gotcha

3:06 beamso: you probably shouldn't render the div again (or attempt to)

3:09 allenj12: beamso: hmm alright

3:11 dbasch: &(str (last (take (inc (rand-int 2)) (cycle ["yes" "no"]))) " way")

3:11 lazybot: ⇒ "no way"

3:11 allenj12: when you <! from a chan what might your val look likeL

3:15 beamso: would it help if i read the js tutorials first?

3:17 hellofunk: allenj12 the value on a chan could be anything, even another channel

3:18 allenj12: hellofunk: hmm kk

3:18 hellofunk: allenj12 and i don't know what js tutorials you are referrign to but personally i don't think it is necessary to know js well to write clojurescript

3:18 beamso: allenj12: i'd recommend looking at the o'reilly clojurescript book or a javascript book if you're struggling

3:18 allenj12: hellofunk: clojurescript im fine its just om :(

3:19 sorry i ment js react tutorials

3:19 hellofunk: it can't hurt to read them but i'm not and i'm also learning om.

3:21 allenj12: hellofunk: ahh kk i guess i just need to look more, are you using any source besides the gitub wiki?

3:22 hellofunk: nope that's the one (or two) that i'm using

3:22 just go through them a few times over and over

3:22 allenj12: hellofunk: yea, thats my plan now

3:22 hellofunk: reification, core.async, DOM handling, React, I agree it is a lot to learn at once. but it's not rocket science, nor is it neurosurgery.

3:23 allenj12: hellofunk: indeed :)

3:29 is transact pretty much swap?

3:44 borkdude: my emacs cider autocomplete thing is broken. When I press tab, I get "List expression: ..."

3:44 *Lisp

3:49 ddellaco_: anyone have a suggestion as to how I can convert some filenames to unreadable garbage to make Java throw an exception? (specifically, java.util.zip.ZipFile)

3:52 borkdude: ddellacosta you can just use throw to throw an exception ;)

3:53 clgv: ddellacosta: either the Zip format specification or the implementation details might help there. I'd bet you have more success probabilities with the former

3:54 ddellacosta: borkdude: well, I'm trying to duplicate an exception that I'm getting with data I'm not allowed to use. The exception is getting provoked inside from an enumeration-seq when I doseq

3:56 clgv: ddellacosta: so you are not trying to build an invalid zip archive for testing with respect to filenames?

3:58 ddellacosta: clgv: I should put it like this: I'm trying to duplicate this behavior in my code somehow: https://www.refheap.com/86541

3:58 clgv: I'm willing to consider any way to do that, but I'm a bit stumped right now.

3:59 clgv: rather, I want to duplicate that in my tests, I should clarify

3:59 clgv: ...and then I can ensure I'm handling it correctly.

4:01 clgv: ddellacosta: there are lots of results on google for that one, e.g. https://github.com/zeroturnaround/zt-zip/issues/34

4:01 ddellacosta: (updated that refheap with the two lines that provoke it in the code)

4:02 clgv: okay, thanks, I'll see if that leads me anywhere.

4:04 clgv: ddellacosta: äöü;)

4:05 ddellacosta: clgv: yeah, tried putting that in a file but it's not working. The problem I think is that it's already UTF-8 I guess, which will make it moot.

4:05 clgv: what I'd really rather do is somehow get java.util.zip.ZipCoder.toString to throw that exception on demand, but I'm not sure how to do that.

4:06 Glenjamin: can you just with-redef something to throw a canned exception?

4:07 clgv: ddellacosta: if you want the exception in the enumerating code just build a enumeration which throws an exception at a random point in a valid sequence

4:07 ddellacosta: Glenjamin: can you use with-redefs with Java methods?

4:07 Glenjamin: no, you'd need a wrapper

4:08 ddellacosta: clgv: that's not going to guarantee that it will be handled in the same way in production though.

4:09 Glenjamin: (defn zipfile-entries-seq [^java.util.zip.ZipFile zipfile] (enumeration-seq (.entries zipfile)))

4:09 then with-redef that

4:09 clgv: ddellacosta: ok let me rephrase. I'd put it in the last clojure function that interfaces zipfile

4:09 last => nearest to the java layer

4:10 ddellacosta: from the link I sent you, I'd say you could just create a ZipFile instance with a wrong charset that definitely does not support the characters you used in filenames

4:11 ddellacosta: clgv: right; that would make me happiest since it's closest to a real integration test. All this other mucking about with redefs and fudging where the exception is coming from smells to me, although if I could trigger it on the actual Java method I would do that.

4:12 clgv, Glenjamin: anyways, thanks for the help. I'll keep fiddling around with this.

4:12 clgv: ddellacosta: the last comment indicating the fix seems to me could be the way to break it on purpose

4:13 we are in an evil mood today, breaking things on purpose ;)

4:13 ddellacosta: clgv: ? You mean in the link you gave me? How so?

4:13 Glenjamin: i think its reasonable to mock/stub at the boundary between your code and not-your-code

4:13 but i can see why you might prefer a real integration test

4:14 ddellacosta: Glenjamin: I would normally agree but the problem is that that boundary is not clear to me. It appears to be happening when doseq begins, which triggers the exception from calling first on the value produced by enumeration-seq. doseq is a macro and stubbing that out with with-redefs does nasty things. Otherwise I'm not sure where to stub and not happy digging deeper into the Clojure internals.

4:15 clgv: ddellacosta: that one: new ZipFile(file, Charset.forName("Cp437")); - I'd bet using cyrillic from UTF-8 and applying an ANSI charset should break, no?

4:15 ddellacosta: Glenjamin: so I'd much rather either stub out the method where it's actually thrown (java.util.zip.ZipCoder.toString()) or just pass in a crap zipfile. I wish I could use the original file, but business/legal concerns mean I can't.

4:16 clgv: ddellacosta: stubbing a custom seq similar to enumeration-seq would be the next better choice I guess

4:16 Glenjamin: ,(doc enumeration-seq)

4:17 clojurebot: "([e]); Returns a seq on a java.util.Enumeration"

4:17 ddellacosta: clgv: probably...but this is where I'm stumped: I'm on Mac OS X, and I'm not sure how to produce a file with a filename in some non-UTF-8 encoding. I've tried using convmv but that doesn't seem to break it. Sorry, this is not really #clojure related at this point

4:17 clgv: Glenjamin: for java's enumerators

4:17 Glenjamin: yeah, just wondering if its lazy

4:17 as the stack trace shows two calls to nextElement

4:17 clgv: ddellacosta: via Java? create a non-utf8 string (possible?) and create a file with it

4:18 Glenjamin: it is certainly lazy since enumerators are ;)

4:18 Glenjamin: it's probably the second item encountered that throws

4:19 ah scratch that. I bet on some overloaded version

4:20 Glenjamin: ah yes, very different line numbers

4:21 ddellacosta: can you make a zipfile with a non-ascii char in the name, then load as ascii?

4:21 clgv: I am not sure why it reports line 513 since this is a return statement in java 7

4:22 ddellacosta: Glenjamin: I haven't had much luck with that so far.

4:22 clgv: ddellacosta: do it programmatically if OS X prevents you from doing it manually

4:23 borkdude: I am now using a relatively vanilla emacs with cider installed, and when I press tab for autocomplete, I get this exception: java.lang.ClassNotFoundException: complete.core

4:24 ddellacosta: clgv: yeah, I'll give that a shot if I can't figure out a way to stub this Java method

4:26 clgv: borkdude: dependency issues - hoooray!

4:27 borkdude: clgv do you know how to solve this?

4:29 clgv: borkdude: nope. I am glad that I can decide manually when to upgrade my clojure ide ;)

4:29 I always check new releases on a private computer before using them at work...

4:30 borkdude: clgv what 'ide' are you using?

4:31 clgv: non-emacs. I still use CCW ;)

4:31 I had a look at cursive and lighttable but there was no compelling reason to switch so far

4:32 guess I dont wanna change the running and reliable system ;)

4:34 Psy-Q: i'm trying to get into clojure by porting something i did in ruby: a base parser class that parses various online store product pages and sticks all the found products into a database. right now there is a parser superclass with some generic functionality and then one subclass per specific store, containing the correct xpath/css selectors to parse each different shop's HTML. what would be a good structure for this in clojure or an FP approach in general, how ca

4:36 clgv: Psy-Q: split the "parser superclass" into sever functions that can be used from the specialized functions

4:37 *several

4:42 borkdude: so what is the best place to go with my cider issue, this channel or other one?

4:44 allenj12: borkdude: definatley emacs channel id say

4:46 clgv: borkdude: some of the maintainers of cider are often here at a later time, maybe 5-6 hours from now

4:47 allenj12: does it make sense to make a channel if im only keeping watch on one thing of a certain type, like if i have 3 input feilds one where i keep track of a name field when the person types and i keep track of two password fields to see if they match

5:02 clgv: was there ever an explanation why exceptions might not contain stacktraces anymore after reevaluating a namespace?

5:07 borkdude: hmm https://gist.github.com/borkdude/6301d3a1f05e37074276

5:07 I am now using Emacs Prelude and the cider-nrepl plugin, but it doesn't seem to pick it up

5:17 Psy-Q: clgv: ah, so it wouldn't be completely ugly to have e.g. "store-one-parser.clj", "store-two-parser.clj" and "useful-parser-stuff.clj" that they both use?

5:19 borkdude: one step further: https://gist.github.com/borkdude/0426d75b3c562d9581e2

5:19 clgv: Psy-Q: in fact you could also implement all in one namespace - the consideration depends on how you much you want to limit the size of the namespaces

5:19 borkdude: installed cider-nrepl 0.7.0-snapshot. Please install cider-nrepl 0.7.0-snapshot?

5:19 clgv: Psy-Q: provided you switch to functional style completely and use the right libs your code will shrink considerably anyway

5:20 Psy-Q: clgv: ah, okay. size-wise it would work, each parser more or less has two things, a regex for filtering product names and a css or xpath selector to find the products on a page

5:20 clgv: *code size

5:20 Psy-Q: clgv: i might even get by with one function that takes the appropriate regex and path per store, i think :)

5:20 clgv: Psy-Q: oh maybe you need only one function then, since you can pass those as parameters

5:20 Psy-Q: ^^ :D

5:20 Psy-Q: clgv: hah, same thought :)

5:21 this'll be really, really enlightening to implement

5:21 even if it takes me a month :P

5:21 clgv: Psy-Q: but you should break down parts of the functionality into smaller functions

5:21 so that you do not end up with one messy 50 lines function ;)

5:22 Psy-Q: clgv: so far (even in the ruby version, i notice) i have one thing that finds the product list, one thing that extracts a single product from the list and iterates further, one thing that determines whether there are more catalog pages to parse, one thing that extracts the price from a product etc.

5:22 so maybe i was already splitting it more or less appropriately for FP

5:22 clgv: seems like it.

6:21 oholiab: this is probably asked quite a lot but my google-fu is failing me - is there a way to drop into the repl from running code?

6:28 ggherdov: hi. somebody here https://groups.google.com/forum/#!topic/clojure/nt8Lud-AOb8 asked for a book "à la Meyers or Bloch". Who are those authors? Meyers the C++ guy?

6:29 * ggherdov http://en.wikipedia.org/wiki/Joshua_Bloch ?

6:29 * ggherdov http://en.wikipedia.org/wiki/Scott_Meyers ?

6:30 hugoduncan: michaniskin: if you want a list jars on the classpath, look at bultitude

6:32 guyme: Hi!

6:33 philandstuff: ggherdov: yes. they wrote books titled "effective c++" and "effective java"

6:33 ggherdov: philandstuff: ok

6:34 clgv: oholiab: not as you describe it. but you can embed a repl or nrepl in your running program

6:35 oholiab: clgv: thanks

6:36 alternatively does anyone know what incantation you use to ptint the return value of an object as it's printed in the repl (NOT coerce it to a string)

6:36 clgv: ggherdov: seems like it. google finds "Effective C++..." and "Effective Java ..."

6:36 oholiab: i.e. the equivalent of ruby's "inspect"

6:36 *print

6:37 clgv: oholiab: sounds like you want `prn`

6:37 oholiab: clgv: nice

6:37 thanks

6:37 clgv: well thats a book title to clain "Effective Clojure" :D

6:37 ^^

6:38 *claim

6:38 oholiab: I was about to tell you you were wrong about prn and then I realised I was manually casting to a string

6:38 that could have been awkward

6:39 clgv: thanks for your help :)

6:39 clgv: ,(println (range 10))

6:39 clojurebot: (0 1 ...)\n

6:39 oholiab: I knew all of this stuff once and then I didn't write any clojure in ages

6:39 clgv: damn he is cheating

6:40 oholiab: that's taking lazy evaluation a bit too far

6:40 :P

6:40 clgv: ah no

6:40 ,(str (range 10))

6:40 clojurebot: eval service is offline

6:40 clgv: now he seems annoyed :P

6:40 oholiab: lol wut

6:40 clgv: &(str (range 10))

6:40 lazybot: ⇒ "clojure.lang.LazySeq@9ebadac6"

6:41 clgv: &(pr-str (range 10))

6:41 lazybot: ⇒ "(0 1 2 3 4 5 6 7 8 9)"

6:48 Glenjamin: ,:working?

6:48 clojurebot: :working?

6:49 ggherdov: clgv: indeed, the key word was "effective" in the book title. I missed it, reading the message in the newsgroup.

6:50 oholiab: welp all that time I spent trying to add recursive config loading to this project and it already has it

6:50 I am such a dumbass

7:02 borkdude: already someone awake who knows how I can get cider-nrepl plugin working?

7:14 agarman: emacs live

7:15 borkdude: if you don't want to use emacs live, give me a sec and I'll get a link to a gist of my old user.el file

7:42 borkdude: agarman I just switched form emacs live to Emacs Prelude, because in live it stopped working as well

7:43 agarman but no luck in prelude neither :-s

7:45 but in prelude I have a different problem. the cider-nrepl plugin isn't recognized

7:47 agarman: borkdude: have you tried deleting your elpa directory?

7:48 borkdude: multiple conflicting versions can get downloaded and elpa will happily try to use all of them

7:48 borkdude: I have removed cider and clojure-mode from elpa

7:48 then re-installed

7:48 agarman: and it's still not working?

7:48 borkdude: well, it's working but not completely. the autocomplete won't work, which was my problem in the first place

7:48 https://gist.github.com/borkdude/0426d75b3c562d9581e2

7:48 agarman: ah, repl autocomplete?

7:48 borkdude: agarman yes

7:49 agarman: okay, emacs-live didn't seem to have that enabled because AC breaks once a buffer gets too large

7:50 REPL buffers cause AC to break

7:50 borkdude: I remember having used this in emacs-live

7:50 agarman: I enable company mode in my emacs live

7:50 borkdude: completion--some: Can't find nREPL middleware providing op "complete". Please, install cider-nrepl 0.7.0-snapshot and restart CIDER <- is what I get now

7:50 agarman: and for nrepl middleware

7:51 you need to add that stuff to your lein profile

7:51 borkdude: I got this in my profiles.clj under :user :plugins : [cider/cider-nrepl "0.7.0-SNAPSHOT"]

7:52 agarman: 0.7.0 wasn't working for me when I tried it

7:52 I'm using 0.6.0

7:52 borkdude: cider also prints this when it starts: ; CIDER 0.7.0alpha (package: 20140612.1003) (Java 1.7.0_55, Clojure 1.6.0, nREPL 0.2.2, cider-nrepl 0.7.0-snapshot)

7:52 I can try 0.6 then

7:53 agarman: yeah 0.6.0 is stable

7:54 borkdude: hmm, how can I install an older version in emacs from package-list-packages?

7:55 there should be something like a project.clj for elpa

7:57 agarman: borkdude: I have no idea how to keep elpa from grabbing the most up-to-date version...aside from not reference the package-archives that have beta, alpha and snapshot builds

8:04 borkdude: I started to switch to http://tapoueh.org/emacs/el-get.html because it's less surprising than elpa

8:04 borkdude: agarman ok, I think I'll switch back to emacs live now and then work from there again (I like the defaults better)

8:05 agarman: borkdude: ^_^

8:14 borkdude: agarman what do you get when you type in a repl for instance '(diss' followed by a tab?

8:14 I'm working with the newest emacs-live from master

8:17 agarman: borkdude: I add https://www.refheap.com/86550 to my ~/.live-packs/`whoami`-packs/init.el

8:17 borkdude: so I have company mode running in my repl

8:18 borkdude: AC everywhere else...and you'll want to change the default bindings for completion in one or the other

8:19 borkdude: ok

8:24 is emacs-live still actively maintained btw? last commit is couple of months ago

8:26 agarman: borkdude: if Sam Aaron abandons it, someone will take over...

8:26 Hodapp: you an emacs-live user?

8:26 agarman: borkdude: until there's a new stable release of cider, there's not much to do with Emacs-Live

8:26 borkdude: agarman I'm not sure how to get company working though, if I install it via elpa, it installs also a newer version of cider, etc.

8:27 Hodapp: I am liking emacs-live, though I find some of the default settings to be a bit obnoxious.

8:27 agarman: Hodapp: I use it currently...though I may switch to just using el-get in the future

8:28 borkdude: the thing I don't like of emacs-live is the slow startup time compared to prelude

8:28 agarman: borkdude: I start emacs on boot, so I don't notice

8:28 borkdude: https://gist.github.com/agarman/9715019

8:29 borkdude: agarman ok cool

8:29 agarman: borkdude: that's assuming OSX

8:29 borkdude: agarman I have osx

8:30 agarman: I then have an alias in my bash_profile

8:30 "reattach-to-user-namespace emacsclient -s emax -t"

8:30 which assumes you have used brew to install reattach-to-user-namespace

8:31 engblom: Reading https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-14_read-write-clojure-data-structures.asciidoc I wonder how safe this approach is? Let's assume we have a power-loss while writing some data structures to the disk, is the whole file lost?

8:31 Can this be done in an ACID way?

8:31 agarman: engblom: read-string will potentially eval

8:32 borkdude: agarman I don't know the reattach thing, but I might check it out

8:32 agarman: borkdude: it's mostly for tmux in iterm

8:32 borkdude: agarman do you use emacs via iterm?

8:32 agarman: borkdude: yes

8:32 borkdude: agarman hm, I don't, I like the cocoa better

8:32 agarman: borkdude: I have my iterm config up on gist

8:33 borkdude: I'm open to dumping iterm, though I'd miss it's buffer history if whatever I switched to didn't have it

8:34 borkdude: agarman buffer history as in clipboard?

8:35 agarman: borkdude: no CMD-OPT-B will let you look at the state of the term through it's history

8:36 borkdude: agarman ah yes, I see that now

8:36 I just use up arrow ;)

8:36 agarman: borkdude: I use flycut for OSX paste-history

8:36 borkdude: up arrow doesn't work for top

8:36 borkdude: or looking at stuff in old tmux windows

8:36 borkdude: agarman I use alfred for clipboard history

8:37 agarman I tried to use tmux, but when scrolling didn't work as expected I got annoyed

8:39 CookedGryphon: I'm using PersistentVector from java and I want to conj the contents of a java array, is there a better way than looping and repeatedly consing to add it all at once?

8:40 szymanowski: Hi, I need to make a type that is a small wrapper around an Integer, I would like it to be treated as an Integer by clojure.core functions, what is the way to go for doing that?

8:41 CookedGryphon: have you tried just extending it? or are you just assuming it won't work?

8:42 agarman: CookedGryphon: have you tried addAll?

8:42 szymanowski: java.lang.Number extension seems to be the thing

8:43 CookedGryphon: agarman: ah, yeah that looks like it

8:44 engblom: Is there anything similar to this for clojure? https://hackage.haskell.org/package/acid-state

8:44 CookedGryphon: agarman: I guess the question then is, which is faster, building a collection (I know the size ahead of time) and using this, or doing cons on each element and not bothering with the collection

8:45 engblom: http://acid-state.seize.it/

9:33 mikerod: It's interesting. You can do something like `(defn .myFn [x] x)`

9:33 However, you cannot call it like `(.myFn 1)`

9:34 Glenjamin: ,(defn .dot [] "dot")

9:34 clojurebot: #'sandbox/.dot

9:34 Glenjamin: (.dot)

9:34 mikerod: "IllegalArgumentException No matching field found: myFn for class java.lang.Long clojure.lang.Reflector.getInstanceField (Reflector.java:271)"

9:34 Glenjamin: ,(.dot)

9:34 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)>

9:34 mikerod: Is what I get

9:34 Glenjamin: ,(#'.dot)

9:34 clojurebot: "dot"

9:34 mikerod: It is interpreted as the dot special form

9:34 yes, I figured directly accessing the var first would work.

9:34 Glenjamin: ,(macroexpand '(.dot))

9:34 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)>

9:35 Glenjamin: ah, interop is a reader thing i guess

9:35 mikerod: Oh.

9:35 I guess that surprises me

9:36 Bronsa: not a reader thing

9:36 philandstuff: ,(macroexpand '(.dot :fake-target))

9:36 clojurebot: (. :fake-target ...)

9:36 Bronsa: (.foo bar) gets transformed to (. bar foo) by macroexpand

9:37 philandstuff: huh, where did that "..." come from?

9:37 Bronsa: ,'dot

9:37 clojurebot: dot

9:37 Bronsa: ,'(dot dot)

9:37 clojurebot: (dot dot)

9:37 Bronsa: uh

9:38 philandstuff: ,(macroexpand '(.foo :fake-target))

9:38 Bronsa: ,(macroexpand '(dot dot))

9:38 clojurebot: (. :fake-target ...)

9:38 (dot dot)

9:38 philandstuff: ,(macroexpand '(.foo :fake-target bar baz))

9:38 clojurebot: (. :fake-target ...)

9:38 philandstuff: *shrug*

9:38 Bronsa: oh

9:38 ,*print-length*

9:38 clojurebot: 2

9:38 Bronsa: that's useless

9:38 ,(set! *print-length* 10)

9:38 clojurebot: 10

9:38 philandstuff: ,(macroexpand '(.foo :fake-target))

9:38 clojurebot: (. :fake-target ...)

9:39 Bronsa: ,*print-length*

9:39 clojurebot: 2

9:39 Bronsa: :|

9:40 Glenjamin: ,(binding [*print-length* 10] (macroexpand '(.foo :fake)))

9:40 clojurebot: (. :fake ...)

9:40 Glenjamin: :s

9:40 mikerod: Bronsa: I was messing around with attempting to qualify symbols while parsing them. I originally thought "anything starting with a `.` can't be qualified". Then I realized you can make vars that start with `.`; so my assumption was a bit wrong.

9:40 Glenjamin: i assume (.method target) -> (. target method) is a reader thing, because i dunno what the macro would be called

9:41 mikerod: Glenjamin: it is a special form I am thinking.

9:41 static final Symbol DOT = Symbol.intern(".");

9:41 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L51

9:42 erlis: need help here. I've just executed something in the emacs Repl (cider) and is not ending, it looks like is trying to realize a lazy seq or something

9:42 Bronsa: Glenjamin: the transformation is hardcoded here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6567-L6578

9:42 erlis: is there a way to abort this execution?

9:43 philandstuff: cider-interrupt?

9:43 erlis: I don't want to kill the repl just abort the executing command

9:43 philandstuff: that is, M-x cider-interrupt

9:43 erlis: philandstuff let me try that

9:44 did it, nothing happens

9:46 I think I'll kill it :(

9:46 is there a way to automatically load all files in my project in cider

9:47 without having to C-c C-k file by file?

9:48 Glenjamin: i usually have a scratch.clj which does (ns user (require [blah blah blah]))

9:50 erlis: I have in my .core file this (ns project.core (:require [path.module1 :as m1] [path.module2 :as m2]))

9:51 the problem is that if I do C-c C-k in that file it will error complaining that module1 and module2 are not loaded

9:51 so I have to go to module1 file and to C-c C-k and also to module2

9:51 then it works

9:51 but imagine that now I'm having almost 7 files

9:51 that's why I don't want to kill my REPL

9:52 Glenjamin: thats odd, if you eval that file i'd expect the ns form to require all the deps like it would normally

9:52 i don't use emacs, so can't advise more

9:53 andyf: Bronsa: Should tools.reader be able to read and preserve any kind of metadata on code it reads, or only some kinds? I ask because I can see type tags like ^Integer preserved, but things like ^{:linter {:disable [bar]}} do not seem to be.

9:53 I'm probably doing something wrong, but thought I'd ask to see if you knew of any limitations there.

9:54 erlis: Glenjamin that's what I was hoping too

9:55 Bronsa: andyf: yeah tools.reader shouldn't leave out any metadata

9:55 andyf: Bronsa: OK, I'll keep experimenting and open a case if I think I can narrow it down to tools.reader

10:05 justin_smith: erlis: any chance you put a - in the filenaes / path somewhere for module1 and module2?

10:06 erlis: or maybe in some other way, the name of the path / module does not reflect the directory / file structure of your project. that is usually the problem in a case like that

10:07 Glenjamin: this is not an emacs issue, his require forms are failing, and that means some ns is not resolving to the right file properly (since evidently he can load files defining those namespaces manually)

10:21 erlis: justin_smith: no, I don't have any dash

10:21 but I noticed that when I do cider-jack-in I got an error

10:21 I ignore it and everything works fine (that's what I think)

10:22 justin_smith: "an error"

10:22 erlis: pp something

10:22 trying to reproduce it

10:23 lol now it's not happening

10:23 but check this is my header

10:23 or better said, my ns declaration

10:23 can I paste here?

10:24 Bronsa: use a nopaste

10:24 erlis: how?

10:24 clojurebot: with style and grace

10:24 Bronsa: ~refheap

10:24 clojurebot: https://www.refheap.com/

10:24 Bronsa: erlis: ^

10:25 erlis: https://www.refheap.com/86554

10:25 that's my ns declaration

10:26 https://www.refheap.com/86556

10:26 error when I C-c C-k

10:27 you can access this code here: www.github.com/erlis/4Clojure

10:27 I would like to C-c C-k in core.clj and done

10:31 cbp: erlis: have you tried C-c C-k in elementary.clj?

10:31 Maybe there's an error there

10:31 erlis: cbp: no, I do it in answers.core

10:32 that's the file I open first

10:32 if I do C-c C-k in elementary then it will give me the error for answers.easy

10:32 and so on

10:33 rurumate: ,(bean java.aws.Color/black)

10:33 clojurebot: #<CompilerException java.lang.ClassNotFoundException: java.aws.Color, compiling:(NO_SOURCE_PATH:0:0)>

10:33 rurumate: ,(bean java.awt.Color/black)

10:33 clojurebot: #<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0:0)>

10:34 scriptor: f

10:34 erlis: cbp: wait, I tried now and only gave me the error with elementary

10:34 scriptor: whoops, sorry

10:35 also, apparently pimgus is spamming

10:35 erlis: cbp: so I did C-c C-k in elementary and after that, the same in answers.core works

10:35 what's weird is that if I do C-c C-k in elementary it will work fine, no error there

10:38 justin_smith: erlis: can you run "lein repl" in a terminal from the top of your project, and in that repl run "(require 'answers.core :as core)" and report the result?

10:38 err, I mean (require '[answers.core :as core]) of course, don't mind my typo

10:39 erlis: good idea let me try that

10:39 gfredericks: has anybody installed cider 0.6.0 via the package repos? I tried yesterday and still got 0.5.0

10:39 why can't we just use maven for elisp packages

10:39 justin_smith: erlis: #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(answers/elementary.clj:142:13)> <- this is your problem

10:40 sorry, went ahead and did that myself :)

10:40 the problem disappears, likely because some other ns requires clojure.set and makes it load properly

10:40 erlis: and it's working?

10:40 justin_smith: it's not working

10:40 erlis: it's working here too

10:40 no?

10:40 clojurebot: no is tufflax: there was a question somewhere in there, the answer

10:40 erlis: lein repl works here

10:41 justin_smith: it fails because you use clojure.set without requiring it

10:41 lein repl works

10:41 but note that error

10:41 that ns does not load

10:41 in elementary.clj, you need to require clojure.set before you use it

10:41 erlis: wow

10:41 if you go to elementary in emacs

10:42 and do C-c C-k it will work

10:42 how is that possible

10:42 justin_smith: cider probably requires clojure.set

10:42 erlis: hmmm

10:42 justin_smith: clojure.set is loaded if any ns required it

10:42 that is the problem with using fully qualified names

10:42 erlis: how did you get that error? using lein?

10:43 justin_smith: don't do it

10:43 it disguises require errors

10:43 lein repl prints that error

10:43 erlis: lein repl didn't print any for me, let me try again I would like to reproduce

10:43 so I learn for the next time

10:44 justin_smith: https://www.refheap.com/86558 what it looks like when I run lein repl in that repo

10:44 erlis: https://www.refheap.com/86559

10:44 this is mine

10:45 59

10:45 :)

10:45 justin_smith: also, repl doesn't work that wway

10:45 you need to require your code, in-ns just made the ns and did not load your ns from the file

10:46 engblom: Besides serializing data structures and spitting them to a file, is there any other way to store data structures in a file (and in a safer way) without the complexity of a full blown sql database.

10:47 justin_smith: engblom: using the pr version of vanilla datastructures and then loading with clojure.edn/read works

10:47 or you could use cheshire to emit json, if you care about other languages at all

10:48 engblom: justin_smith: and what happens if the program/os/computer is crashing during a write? Or we are going multithreaded?

10:48 justin_smith: erlis: try doing lein do clean repl, it could be reusing a version that successfully compiled

10:48 cbp: engblom: then you need a full blown sql database..

10:48 erlis: I was able to reproduce it

10:49 cbp: erlis: yay

10:49 erlis: I was doing lein repl outside answers folder

10:49 justin_smith: hah

10:49 erlis: the code snipped you sent me help me with that

10:49 justin_smith: yeah, being in your project dir would help :)

10:49 erlis: wow

10:49 justin_smith: (project dir being the one containing project.clj)

10:49 erlis: thanks justin

10:49 justin_smith: np

10:49 engblom: cbp: Thanks. I had been hoping for something similar to # set PATH so it includes user's private bin if it exists

10:49 if [ -d "$HOME/bin" ] ; then

10:49 PATH="$HOME/bin:$PATH"

10:50 Ooops. bad paste

10:50 http://hackage.haskell.org/package/acid-state <--- That was what I wanted to paste

10:52 justin_smith: engblom: for better or worse, the clojure approach is to use an existing tool if it works. We do have, for example, datomic which gives a clojury wrapper over sql using datalog and immutible semantics.

10:53 but I would be surprised to se a pure clojure replacement for a db get much traction

10:53 cbp: there's a reason we're on top of java :-P

10:53 justin_smith: not because clojure would be a worse tool for the job than haskell imho, just that isn't the mainstream attitude in clojure circles

10:54 cbp: In any case you can choose to use h2 or whatever

10:54 engblom: That is a pity. I have done many sql based projects, but most of my projects are small and the extra code and complexity added by this feels unnecessary. Much of the code will be just mapping between data structures and sql database.

10:55 Being able to use the data structures directly as a persistent ACID storage would be nice

10:56 justin_smith: engblom: I mentioned datomic, that's what datomic does

10:57 with a clojure / cascalog flavor

10:57 *datalog

10:57 engblom: justin_smith: But unless I am wrong, it is not opensource and available for free.

10:57 justin_smith: (cascalog is a competing / less mature datalog in clojure)

10:57 engblom: you are correct

10:58 rurumate: less mature.. really? I've been using it a lot

10:58 justin_smith: engblom: we also have caribou.model, which helps make a database schema for storing clojurey stuff

10:58 but it is not meant to be a transperent translation of arbitrary edn to sql

10:59 rurumate: cascalog? I was under the impression it was less developed than datomic, maybe I am off bas there.

10:59 *off base

10:59 rurumate: isn't datomic proprietary?

10:59 mdrogalis: Is Cascalog actually a datalog? I know it's written that is, but I think there're a few missing properties, like recursion.

11:00 justin_smith: ahh so maybe it is immature :P

11:00 rurumate: mdrogalis: not sure what you mean. you can call any code within cascalog queries, and these in turn are allowed to recur, of course

11:00 Glenjamin: i thought cascalog was a hadoop querying thing

11:00 engblom: Cascalog seem to be opensource

11:00 rurumate: Glenjamin: exactly

11:01 not sure why it's compared to, or portrayed as less mature than datomic

11:01 Glenjamin: the use-cases are entirely different afaik

11:01 mdrogalis: I guess you could always ask sritchie. *Cough*

11:01 justin_smith: rurumate: so is cascalog datalog, or was I just confused?

11:02 rurumate: well I have not used datalog yet but afaik it should look familiar to datalog programmer

11:02 sritchie: hey, what up?

11:02 justin_smith: yeah, it’s totally different

11:03 cascalog lets you use a subset of datalog to generate hadoop queries

11:03 justin_smith: totally different from datalog that is?

11:03 sritchie: no, from datomic

11:03 justin_smith: ahh ok

11:03 sritchie: the use cases are totally different, I’d say

11:03 rurumate: one is a real time thing while the other is just a dsl that compiles to hadoop / cascading jobs

11:04 mdrogalis: That being said, I've had success using both query constructs with data structures, and not their primary storage targets.

11:04 So thumbs up.

11:06 rurumate: there are so many boring ways of doing java interop

11:07 michaniskin: rurumate: take the cure: https://github.com/tailrecursion/javastar

11:07 rurumate: the sad thing is that it's not easy apparently to convert nested java bean-convention objects to a map

11:07 michaniskin: hahaha

11:07 andyf: Bronsa: yep, I was messing something up. Not easy to get pprint to print all metadata, strangely.

11:08 Bronsa: But it is easy to get it to pprint *some* but not all metadata on a form

11:09 justin_smith: rurumate: naive question, what about calling bean on the thing and selecting the keys you want?

11:10 ,(bean "hello")

11:10 clojurebot: {:empty false, :class java.lang.String, ...}

11:10 clgv: michaniskin: what a perversion :P

11:10 Bronsa: andyf: uh? *print-length* or something else?

11:10 rurumate: justin_smith: hmm

11:10 michaniskin: clgv: it's not boring, at least

11:10 rurumate: and then write some breadh-first tree search thing

11:10 andyf: Let me find a short example

11:11 rurumate: but general bfs won't work if I have to know what keys I want in each step

11:12 justin_smith: it's a big tree (the conf file) which i usually slurp as an edn map, now java programmer need an "easy interface"

11:12 CookedGryphon: https://github.com/clojure/java.data provides a better bean than the clojure.core one

11:13 as to-java, from-java, works recursively

11:13 rurumate: apparently passing the map is not easy, so I have to create a Conf* class & objects for each tree segmment

11:13 justin_smith: rurumate: maybe compose clojure.edn/read and cheshire/generate-string and then they can just use jackson on their end?

11:13 or is that not easy enough?

11:13 rurumate: I just want to convert that hideous structure back into a normal hashmap in one easy step

11:13 justin_smith: also you could use jackson to get pojo from json reliably

11:14 rurumate: the jackson approach is interesting

11:14 justin_smith: it is easy to get hashmaps from jackson, I did it recently actually

11:14 rurumate: but that would be a heavy dependency

11:14 especially considering that I already use clojure.data.json

11:15 justin_smith: it's already a dep of cheshire if you use that

11:15 cheshire is better by far

11:15 rurumate: define better

11:16 justin_smith: static ObjectMapper json = new ObjectMapper(); Hashtable[] raw = json.readValue(in, Hashtable[].class);

11:16

11:16 better = faster, easier to adapt to custom data types, more stable API across versions

11:16 rurumate: well speed and custom datatypes are not an issue here

11:17 justin_smith: OK, just saying you have other reasons to use cheshire, other than the fact that jackson is the best way to share this stuff with java

11:17 rurumate: hmm

11:17 it was a pain to move from cheshire from data.json

11:18 justin_smith: I mean if you want, you can just turn the edn into Array and Hashtable instances etc.

11:18 you should be able to walk a tree and do that

11:18 and the java coders should know what to do with those datatypes

11:18 rurumate: but still. going through json, if all you want is to convert beans to maps, seems not ideal

11:19 justin_smith: OK - but I thought you didn't want to covnert beans to maps but rather an edn file to a map?

11:21 or is it that a hash table isn't an easy interface for java programmers, so they make you use beans and now you have to figure out how to use beans from clojure? maybe I am just confused

11:24 andyf: Bronsa: https://gist.github.com/jafingerhut/4350299162411f738bce

11:24 Short answer: Not a problem with tools.reader that I can find

11:25 I only thought there was because pprint was showing me some metadata, but not all

11:25 Bronsa: andyf: weird behaviour by pprint there

11:26 I wonder if that's intended or a bug

11:27 clgv: andyf: I ran into the same thing a while ago

11:34 rurumate: justin_smith: yes it's beans, I used to have an edn config file, now the java programmers are passing beans instead and I don't want to change everything but rather convert the beans to maps

11:35 justin_smith: OK, got it

11:36 I guess -> beans -> jackson -> cheshire -> maps would work, but probably be a clumsy / heavy handed way to do it

11:36 rurumate: yes there got to be another way

11:37 afterall clojure should be easy and fun, not clumsy and dull

11:37 andyf: Bronsa, clgv: I will file a ticket categorized as a Defect, and others will decide whether it is intended or a bug

11:39 rurumate: the beans can be considered a tree and I want to convert to a very similar tree, so I need something like map but for trees

11:39 clgv: andyf: great *hoping-for-a-less-confusing-macro-debugging-future* ;)

11:40 andyf: I'll send you a link once written. I can include a temporary workaround function to use until Clojure is enhanced (if it is)

11:41 justin_smith: $doc tree-seq

11:41 hyPiRion: ,1

11:41 justin_smith: ,(doc tree-seq) maybe...

11:42 clojurebot: 1

11:42 "([branch? children ...]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."

11:42 justin_smith: there is also clojure.walk/*

11:43 oh, clojure.walk is only for native clojure datastructures I think

11:53 sveri1: hi there, does someone know how to integrate test.check with midje or if its possible at all?

11:57 gfredericks: sveri1: should be possible; at worst you can make your test call test.check/quick-check and make an assertion about the result

11:57 this function can help: https://github.com/clojure/test.check/blob/master/src/main/clojure/clojure/test/check.clj#L29-32

12:03 andyf: Bronsa, clgv: Vote early, vote often: http://dev.clojure.org/jira/browse/CLJ-1445

12:07 sveri1: gfredericks: thank you, looks a bit like a hack, but I gues sits ok

12:11 gfredericks: sveri1: that's essentially what test.check's adapter for clojure.test does

12:12 sveri1: As I am trying out test.check I wonder its possible to submit nil or a string and expect an assertionerror if it was nil and something else if it was not nil? I got a generator which returns a string or nil, but don't know how to make test.check pass if it is nil and returns an assertionerror

12:14 gfredericks: sveri1: you should just include the logic for what you want to check for in your property

12:14 I don't quite understand what you were describing so I can't suggest the exact way to check for it

12:16 sveri1: gfredericks: I have function that expects a string and that string should not be null. Now I am testing that function with test.check, which is ok as long as I dont input nil into that function. So what I want to do is test.check to test for that assertionerror if it passes nil. But I guess it's cleaner to split this into to tests, one generating strings and another one to test if the assertionerror is thrown on nil

12:17 reiddraper: sveri1: you can also just look at the value generated by test.check first, and decide what you should expect, based on whether it generated a string or nil

12:19 sveri1: reiddraper: true, checking the case is nice too :-)

12:20 gfredericks: sometimes it can be cleaner to generate the expected behavior check as well

12:22 e.g., you generate a pair [input output-pred] where the latter can somehow distinguish between throwing/returning

12:24 justin_smith: gfredericks: maybe (try (output-pred (test input)) (catch Throwable t (caught-pred t)))

12:24 catching Throwable at runtime is bad, but for a test should be OK

12:25 gfredericks: I tend to use helper functions that wrap output to [:returned x] or [:threw e]

12:26 (defmacro catchingly [& body] `(try [:returned (do ~@body)] (catch Throwable t# [:threw t#])))

12:27 justin_smith: nice

12:30 sveri1: gfredericks: yea, that works :-)

12:34 nathan7: gfredericks: that feels like a primitive Either

12:36 gfredericks: sounds about right

12:36 danneu: I have a weak understanding of aot-compilation and what it entails. Why does the `compojure-app` template specify `:aot :all` in project.clj?

12:36 andyf: Bronsa, clgv, arrdem, TimMc: Ticket has an attached file with function to work around the problem for now, which works with Clojure 1.6. It isn't a patch for Clojure, but something you can use now: http://dev.clojure.org/jira/browse/CLJ-1445

12:36 technomancy: danneu: that's not a good idea; it shouldn't do that.

12:37 justin_smith: danneu: it means that every namespace should be recursively compiled to bytecode

12:37 danneu: justin_smith: right, i meant 'why would...'

12:37 justin_smith: maybe the idea is in order to reduce boot time on deployment?

12:37 gfredericks: is there a lein plugin that creates shims for executable jars to avoid AOT?

12:37 technomancy: gfredericks: yeah, see lein-otf

12:38 gfredericks: however, as of 2.4.0, uberjars have clojure.main as their main

12:38 so you can just pass an -m arg to point it to your own ns

12:38 err--clojure.main as their main if they don't specify their own

12:39 gfredericks: technomancy: oh hey nice

12:40 danneu: justin_smith: i have a weak understanding of jars, too. so if you specify just one namespace to be AOT compiled and then run `lein uberjar`, the rest of the namespaces are compiled on the fly every time you run the jar?

12:40 justin_smith: danneu: well, aot is contagious I think

12:41 but technomancy knows this stuff better than I do

12:41 also aot does not mean that the code is done compiling, there is still the vm hotspot optimization that kicks in at runtime

12:41 danneu: right

12:43 technomancy: :aot :all is the same as :aot some-namespace.that-requires.all-others

12:45 gfredericks: the namespace to require all other namespaces

12:47 technomancy: and in the darkness bind them?

12:48 justin_smith: well, clearly, binding is done on a per namespace basis

12:48 pjstadig: gfredericks & technomancy: doesn't have quite the same ring

12:49 which wasn't an intended pun at first, but I'll go with it

12:49 technomancy: nice

12:50 gfredericks: technomancy: yes, via the namespace monad presumably

12:50 If you don't realize that X is a monad you aren't thinking hard enough.

12:51 pjstadig: thinking of monads is the thinking of monads monad

12:51 nullptr: pjstadig: maybe...

12:51 justin_smith: turning things into jokes via self reference is the nerd humor monad

12:53 pjstadig: justin_smith: a corrolary to that is that computer science is a sub-field of mathematics, because mathematicians have the same humor schemata

12:53 gfredericks: monads are the borderline-useful-abstraction monad

12:53 pjstadig: er corollary

12:53 http://j.mp/ruined-joke

12:53 gfredericks: sppeling

12:54 justin_smith: wow, that tweet is from two years ago, you're psychic

12:54 gfredericks: pjstadig: I like the implication that jokes are written

12:55 I guess that's pretty normal though, even among the regular folks

12:55 with the snapchats and the hipstagrams

12:57 pjstadig: justin_smith: either psychic or i just save it around and use it often, which tells you something about my spelling abilities

12:58 gfredericks: pjstadig: or maybe it's that spelling & joking contend for the same resources

12:59 that hypothesis has the benefit of explaining well-spelled-but-unfunny jokes

13:00 justin_smith: funny, correctly delivered, well timed: pick 2

13:00 pjstadig: gfredericks: this is a fruitful area for research, you should apply for a grant

13:01 gfredericks: A) Both B and C; B) B; C) none of the above;; pick 2

13:02 justin_smith: http://en.wikipedia.org/wiki/List_of_people_who_have_been_pied

13:03 technomancy: justin_smith: even includes missed pies

13:04 gfredericks: technically any thrown pie misses almost everybody

13:04 you could also include pies that were accidentally not thrown

13:05 http://en.wikipedia.org/wiki/List_of_people_who_could_have_been_pied

13:06 technomancy: redirects to http://en.wikipedia.org/wiki/List_of_people

13:06 gfredericks: omg it just occurred to me that this could totally exist and then it did: http://en.wikipedia.org/wiki/List_of_lists_of_lists

13:06 pjstadig: this Les Entartistes is a prolific pieing perpetrator

13:06 justin_smith: I remember finding that, ages ago

13:06 technomancy: https://en.wikipedia.org/wiki/List_of_people_who_have_declined_a_British_honour

13:07 justin_smith: gfredericks: this one got deleted: http://en.wikipedia.org/wiki/List_of_lists_of_lists_of_lists

13:07 gfredericks: repeatedly, apparently

13:08 some of the lists of lists linked to appear to just be single pages with sections

13:08 pjstadig: http://en.wikipedia.org/wiki/List_of_lists_not_on_Wikipedia_lists

13:09 arrdem: complement set of of the set of lists :P

13:09 gfredericks: why did I start this nonexisting wikipedia page joke

13:09 justin_smith: ,(repeatedly 3 #(list (list (list) (list) (list)) (list (list) (list)) (list (list)) (list)))

13:09 clojurebot: (((() () ...) (() ()) ...) ((() () ...) (() ()) ...) ...)

13:10 justin_smith: pjstadig: Russel had something to say about that one

13:10 pjstadig: http://toolserver.org/~dispenser/cgi-bin/rdcheck.py?page=Russell%27s_paradox

13:10 gfredericks: ,((fn f [x] (->> (repeatedly rand) (take-while #(< % x)) (map f))) 0.93)

13:10 clojurebot: (() ((() ())) ...)

13:11 justin_smith: gfredericks: much more elegant, though I was going for semantic overload on the token "list"

13:22 technomancy: http://blog.jorgenschaefer.de/2014/06/the-sorry-state-of-emacs-lisp-package.html somewhat relevant to some

13:24 TimMc: gfredericks: I'm partial to https://en.wikipedia.org/wiki/Lists_of_pairs

13:25 I want to put a disambiguation hatnote at the top saying "Also see: [[association list]]"

13:25 technomancy: https://en.wikipedia.org/wiki/List_of_married_couples_among_space_travelers

13:26 TimMc: :-D

13:26 technomancy: "Lee and Davis had met during training for the flight and had married in secret. They disclosed their marriage to NASA shortly before the flight, when it was too late to train a substitute. NASA has since changed the rules and will not allow married astronauts on the same flight."

13:26 TimMc: I guess the splitters are winning.

13:27 hiredman: if you want to call that winning

13:27 justin_smith: technomancy: fix for the the Melpa version number problem: start all your package numbers with Inf

13:28 * technomancy nods sagely

13:28 hyPiRion: I expected a section named "In Fiction", but alas

13:28 * hyPiRion creates https://en.wikipedia.org/wiki/List_of_married_couples_among_space_travelers_in_science_fiction

13:29 justin_smith: or actually, maybe just ZZZZZz

13:29 TimMc: This always reminds me of https://en.wikipedia.org/wiki/Celestial_Emporium_of_Benevolent_Knowledge

13:29 * technomancy is reminded of the fact that he needs to read some Borges

13:31 justin_smith: that list is classic

13:31 dbasch: technomancy: the nice thing about Borges is that all his stories are short and pack a punch

13:31 TimMc: technomancy: May I also recommend the webcomic The Secret Knots.

13:32 Anything after 2006 (during which the author seems to have been finding his rhythm.)

13:32 dbasch: technomancy: I know you’ve read some Borges when your projects have names like Tlön or Uqbar :P

13:32 technomancy: dbasch: \m/

13:32 TimMc: Many of the comics (such as the latest one) seem a bit Borges...ian.

13:33 dbasch: technomancy: http://en.wikipedia.org/wiki/Uqbar

13:33 technomancy: nice; metafictional

13:33 dbasch: very lispy

13:33 that is just begging for some software to be named after it

13:34 PigDude: does eastwood always report functions with arities [foo & bar] as misused when called as (f v), omitting the optional "bar"?

13:34 justin_smith: mock object of some type?

13:34 TimMc: Santapau uses story-within-a-story for a lot of his comics.

13:34 PigDude: seems like a bug

13:35 stephenjudkins: i'm confused about how anonymous functions and -> interact

13:35 why does this work:

13:35 ' (map #(+ 1 %) [1 2 3])

13:35 , (map #(+ 1 %) [1 2 3])

13:35 clojurebot: (2 3 ...)

13:36 stephenjudkins: and this work:

13:36 justin_smith: stephenjudkins: macroexpand helps a lot when figuring out ->

13:36 dbasch: stephenjudkins: that is basically the same as (map inc [1 2 3])

13:36 stephenjudkins: , (map #(-> (+ (+ 1 %) 5)) [1 2 3])

13:36 clojurebot: (4 2 ...)

13:36 stephenjudkins: while this does not:

13:36 , (map #(-> + 1 %) [1 2 3])

13:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

13:37 justin_smith: ,(macroexpand '(map #(-> + 1 %) [1 2 3]))

13:37 clojurebot: (map (fn* [p1__106#] ...) ...)

13:37 technomancy: when in doubt, macroexpand

13:37 dbasch: stephenjudkins: that inserts the vector between + and 1

13:37 justin_smith: ,(macroexpand '#(-> + 1 %))

13:37 clojurebot: (fn* [p1__131#] ...)

13:37 dbasch: sorry, not the vector

13:38 justin_smith: that's some pretty agressive truncation there...

13:38 stephenjudkins: justin_smith: yeah, it's unfortunate. thankfully i'm just copypastaing to my own repl :)

13:38 dbasch: that tries to do things to +

13:39 justin_smith: it tries to call 1 with + as an argument

13:40 ,(macroexpand '(-> + 1)) embedded in that output

13:40 clojurebot: (1 +)

13:40 TimMc: ,*print-length*

13:40 clojurebot: 2

13:40 TimMc: That's absurd.

13:41 justin_smith: indeed it is

13:41 PigDude: ,(-> + (partial #(partial % 1)) 3)

13:41 TimMc: hiredman: I think clojurebot's *print-length* of 2 is a bit short...

13:41 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

13:41 hiredman: it is, that doesn't seem right

13:41 TimMc: ,[[[[[[[[]]]]]]]]

13:41 clojurebot: [[[[[[[#]]]]]]]

13:41 TimMc: Maybe length and depth are reversed?

13:42 justin_smith: alright who flipped printing on its side again?

13:42 PigDude: stephenjudkins: when you do -> +, like dbasch said, you're operating on the plus function

13:42 ,((-> + (partial 1)) 4)

13:42 clojurebot: 2

13:43 PigDude: well no, that's 5, but thanks clojurebot

13:43 hiredman: I suspect someone monkeying with the sandbox

13:43 dbasch: ,(-> + type)

13:43 clojurebot: clojure.core$_PLUS_

13:43 justin_smith: ,(range 10)

13:43 clojurebot: eval service is offline

13:43 hiredman: ,(+ 1 2)

13:43 clojurebot: 3

13:43 hiredman: ,5

13:43 clojurebot: 5

13:44 metellus: ,4

13:44 clojurebot: 4

13:44 hiredman: sometimes I wonder why I bother

13:44 justin_smith: ,(range 10)

13:44 clojurebot: (0 1 2 3 4 ...)

13:50 stephenjudkins: i don't yet fully understand what's going on

13:51 but thanks for your help. macroexpand will be very useful to me in the future

13:52 justin_smith: stephenjudkins: clojurebot got in a weird state

13:53 arrdem: ,4

13:53 clojurebot: eval service is offline

13:53 arrdem: well at least 3 isn't 4 right now..

13:53 dbasch: stephenjudkins: -> x a b c is the same as (c (b (a x)))

13:54 (-> x a b c) that is

13:58 gfredericks: &(macroexpand-1 '(-> x (a b) c (d e f)))

13:58 lazybot: ⇒ (clojure.core/-> (clojure.core/-> x (a b)) c (d e f))

13:58 gfredericks: &*clojure-version*

13:58 lazybot: ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}

13:58 gfredericks: &(alter-var-root #'*clojure-version* assoc :minor 6)

13:58 lazybot: java.lang.SecurityException: You tripped the alarm! alter-var-root is bad!

14:03 gfredericks: clojurebot: You |tripped| the alarm! alter-var-root is bad!

14:03 clojurebot: You don't have to tell me twice.

14:18 llasram: clojurebot: You?

14:18 clojurebot: You tripped the alarm!

14:19 llasram: Infinite amusement

14:19 squidz: Does anybody know how to tell cljsbuild to recompile clojurescript when a given file/directory changes?

14:19 I want to recompile when some javascript that is included in my project changes

14:20 justin_smith: lein cljsbuild auto

14:20 I like "nohup lein cljsbould auto" in order to leave it running without wasting a window on it

14:20 squidz: justin_smith: that recompiles when clojurescript files change, but how do I tell it to recompile when non-clojurescript files change?

14:23 justin_smith: do you know what I mean?

14:23 justin_smith: I do, but I'm not sure how to do that

14:23 I thought that if the file was a proper dependency in a cljs file that it would trigger a recompile, but that is clearly wrong

14:24 squidz: hm okay does anybody have an idea

14:28 prachetasp: anyone done any sentiment analysis in java/clojure that can recommend a library?

14:32 squidz: justin_smith: okay, I have to use :libs in the cljsbuild settings. All changes in the directories listed in :libs will recompile on change

14:33 justin_smith: oh, nice

14:33 I expected something like that, but have only done a little cljs so I didn't know the details

14:33 igor: hi everybody

14:33 may be someone could help me

14:34 I'm trying to understand how I use emacs/cider to develop a compojure/ring-based program

14:34 I understand perfectly that I can change files of the project

14:35 justin_smith: OK

14:35 igor: and the program will automatically reload them (like django etc)

14:35 but I can't understand

14:35 technomancy: igor: it's simpler if you just recompile on save from cider

14:35 you can use a hook if you like

14:35 igor: how I can attach directly to the running process

14:35 aaelony: prachetasp: I haven't read it yet, but have you seen http://www.packtpub.com/mastering-clojure-data-analysis/book#chapter_6

14:35 justin_smith: igor: in my experience, the best way is to use nrepl.server to start a repl host from your app, and then connect to that via emacs, and then you can evaluate code in the context of the running app

14:35 igor: for example, I would like to

14:36 write something, then press c-c c-c and have it in my process

14:36 justin_smith: igor: https://github.com/clojure/tools.nrepl it shows how to start a repl from inside your code

14:36 then, in emacs, M-x cider prompts for a port to connect to, tell it the port your app is serving

14:37 technomancy: igor: you just need the HTTP server launched from the same process as the repl.

14:37 justin_smith: technomancy: well, there is that too

14:37 technomancy: you can embed nrepl in your program, or you can launch your HTTP server from cider

14:37 igor: justin, thank you, that means that I must embed repl to my process

14:37 then start the process

14:37 then attach to it

14:37 right?

14:37 justin_smith: or, as technomancy mentions, you can start the process from inside a repl, one or the other

14:37 technomancy: igor: that's one option, but you don't need to do that; you can just kick off jetty from cider

14:38 justin_smith: I find embedding the repl in the process handier (lets me debug uberjars etc.)

14:38 technomancy: it's nicer for production

14:38 igor: ok, thank you guys, I will repeat it that to be sure that I understand the things right

14:38 So

14:38 I have two options

14:38 1) embed repl into process

14:38 technomancy: but it's a bit more setup up-front

14:38 igor: 2) start jetty from cider directly

14:38 right?

14:38 technomancy: yeah

14:38 justin_smith: right

14:39 igor: ok, so and then what option is better for me, depends on the situation

14:39 justin_smith: technomancy: one line for the dep, one line for the require, one line for the "should I start a repl" conditional, one line for starting the repl, four lines of setup in two files is not so bad

14:39 igor: for example, if I'm developing a production server

14:39 that first option is better

14:40 if I just try to write some small peace of code from scratch

14:40 it's better to start with cider and run jetty in it

14:40 justin_smith: sounds about right, yeah

14:41 igor: Ok, but if I embed repl into process I have no disadvantages at all, right? I just strt the process connect to it and do what I want?

14:41 technomancy: justin_smith: true.

14:41 justin_smith: well, not no disadvantages

14:41 technomancy: igor: you get a few conveniences from leiningen launching the repl

14:41 justin_smith: but I find it more convenient

14:42 unless you are going to restart jetty frequently - then starting jetty from a repl is convenient

14:42 igor: In what case do I need to restart jetty?

14:42 technomancy: justin_smith: do you still use jack-in then?

14:42 igor: I can change by functions without restarting it, right?

14:42 justin_smith: no, not jack-in

14:43 I am still on nrepl, I run "M-x nrepl" instead of "M-x nrepl-jack-in"

14:43 igor: right, just make sure you give ring your #'handler instead of handler, so it knows to update when the var changes

14:44 then, if you rebind some middleware, you may need to redefine the handler, but it will all just work

14:44 but otherwise, yeah, redefine a function and its just using the new function, pretty straightforward

14:45 igor: ok

14:45 thank you very much guys

14:45 I will try these two methods

14:45 technomancy: I guess that's the main downside; I'm used to just jacking in and running from there.

14:45 tjd: is there a good convention in clojure to say "this function gets a remote resource that has state, so it might return a different value if you call it again with the same args later"?

14:46 justin_smith: technomancy: I actually like starting the process in its own terminal outside emacs - for example I am less likely to miss messages logged by the code that way

14:46 technomancy: justin_smith: how is that different from checking *nrpl-server*

14:47 justin_smith: technomancy: well, my emacs / repl integration hasn't always been so stable or reliable in behavior, and I know for a fact everything will show up in the terminal

14:47 _alejand1o: tjd: It's not uncommon to put `!` at the end of an impure function name

14:47 justin_smith: but yeah, I could check *nrepl-server* and that would probably work

14:48 _alejand1o: tjd: although, I usually only do it for lower level functions, and not for other functions that depend on impure functions

14:48 hiredman: or, you know, configuring logging to log to a file at dev time

14:48 justin_smith: _alejand1o: but that function doesn't mutate, it just observes state

14:48 _alejand1o: justin_smith: yeah, that's a fair point. not sure of a convention then

14:48 tjd: it's almost like a (deref ...), except the remote resource doesn't have any concurrency semantics to speak of

14:49 amalloy: tjd: there is no such convention

14:49 technomancy: justin_smith: pretty sure there's no difference as far as output goes

14:51 justin_smith: yeah. I'm just UI wise less likely to miss stuff in my process terminal, and am used to a process I run owning a terminal. It's a comfort / familiarity thing as much as anything else.

14:53 gfredericks: thinking about making a special kind of var that prints as: #_"helpful info" #"var/name

14:54 amalloy: gfredericks: var is final, so...?

14:54 gfredericks: I've never seen anybody use #_ to add messages-for-humans to readable things

14:54 amalloy: clojure.core/type

14:54 arrdem: ,(read-string "#_\"foo\" #'clojure.core/conj")

14:54 clojurebot: eval service is offline

14:55 gfredericks: #'var/name is what I meant above of course

14:55 amalloy: so? it still has to be a Var object to live in a namespace, no?

14:55 arrdem: ##(read-string "#_\"foo\" #'clojure.core/conj")

14:55 lazybot: ⇒ (var clojure.core/conj)

14:55 arrdem: hum... interesting

14:55 gfredericks: amalloy: yeah I didn't mean a different class

14:55 amalloy: of course you can build an object that prints that way, but it can't be a var

14:55 gfredericks: just different print-method behavior

14:55 sure it can

14:57 amalloy: oh, i see

14:58 i didn't get what you meant about c.c/type

14:58 gfredericks: yeah am be confuse today

15:05 cbp: hmm I could swear there was a forv function

15:05 marco*

15:06 johnwalker: whats forv?

15:06 cbp: like (into [] (for..))

15:06 SegFaultAX: Presumably a strict variant of for that yields a vector instead of a list.

15:06 clojurebot: excusez-moi

15:06 SegFaultAX: Is that in c.c?

15:06 johnwalker: ahh

15:07 cbp: it's not in core. I thought it was

15:08 SegFaultAX: cbp: Phew, I thought I had just been mentally ignoring it for the last 2 years. :)

15:09 cbp: I thought it got added along with mapv :-P

15:12 gfredericks: &'#'#'#'#'#'#'foo

15:12 lazybot: ⇒ (var (var (var (var (var (var foo))))))

15:13 llasram: gfredericks: Ha! Reader macros

15:13 gfredericks: reader macros make a great party joke

15:14 llasram: Or even a great party game. Try reader macros instead of "Apples to Apples" at your next party!

15:15 gfredericks: &(read-string (str (apply str (repeatedly 10 #(rand-nth ["#'" "@" "'"]))) "foo"))

15:15 lazybot: ⇒ (quote (clojure.core/deref (clojure.core/deref (quote (var (clojure.core/deref (quote (var (var (quote foo))))))))))

15:15 justin_smith: or the adult alternative, "quotation rules against sanity"

15:15 llasram: nice

15:15 gfredericks: &(read-string (str (apply str (repeatedly 10 #(rand-nth ["#'" "@" "'" "~"]))) "foo"))

15:15 lazybot: ⇒ (var (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref (var (clojure.core/unquote (var (quote (quote foo)))))))))

15:21 gfredericks: (require '[clojure.walk :as clojure.core]) ;; <- don't do that

15:31 TimMc: :-D

15:32 cbp: No such var: clojure.core/fn

15:33 TimMc: (require '[clojure.walk :as clojure.lang.RT])

15:33 cbp: heh i cant go back to the ns i did that

15:34 justin_smith: cbp: well a restart would clearly fix it, but maybe ns-unmap would do the trick?

15:35 cbp: justin_smith: probably remove-ns

15:36 justin_smith: cbp: I was thinking some combination of ns-publics on clojure.walk with ns-unmap on the contaminated ns

15:37 prachetasp: aaelony: did see that - working my way through the clojure data analysis cookbook first actually

15:38 stephenjudkins: in `fn` or `defn` it's possible to do multiple statements before the final expression that returns

15:40 is it possible to this with an anonymous expression?

15:41 i'm doing an if, and i'd like put a debug statement in one of the legs

15:41 justin_smith: stephenjudkins: yes, with do

15:41 cbp: stephenjudkins: #(do..)

15:41 justin_smith: damn it

15:41 justin_smith: but if it is long enough for do, you would probably want to use fn anyway

15:41 stephenjudkins: justin_smith, cbp : thanks

15:41 yes, i was debugging by doing that

15:41 but `do` seems like a quicker solution

15:42 cbp: stephenjudkins: debugging? :-P

15:43 stephenjudkins: cbp: trying to write pure functional stuff, but throwing in some prints to see what's going on

15:43 cbp: stephenjudkins: doto might be better

15:43 ,(doto 1 (print))

15:43 clojurebot: 11

15:44 stephenjudkins: cbp: that is nice

15:45 devn: xeqi: technomancy: _ato: If you get a chance could we get a deploy of will's change deployed: https://github.com/ato/clojars-web/pull/217

15:45 derp, redundancy department of redundancy

15:46 dbasch: quick puzzle if anyone wants to waste some time. Given the three letter codes for all countries in the world cup, which potential matches would be valid six-letter english words?

15:46 list here: http://pastebin.com/z4BKLUwy

15:47 devn: dbasch: i dont totally follow

15:47 stephenjudkins: cbp: (doto ... (print)) is a lot like haskell's debug.trace

15:47 dbasch: devn: hun-arg is not a valid word, for example

15:47 without the dash of course

15:47 devn: oh, so the cartesian product of that list

15:48 and then check against a dictionary

15:48 dbasch: I was a bit disappointed by the results

15:49 devn: https://www.refheap.com/86565

15:49 devn: oops https://www.refheap.com/86566

15:52 devn: dbasch: can they be in any order?

15:52 and can you use the same thing twice?

15:52 like MEXMEX

15:53 llasram: "And the final match of the World Cup will be -- Mexico versus Mexico!"

15:54 johnwalker: llasram: who will win?

15:54 llasram: That's the great thing about sports -- you never know what will happen

15:54 technomancy: one team will probably score more points than the other

15:55 that's what usually happens

15:55 AimHere: Not in football

15:55 devn: sportsball

15:55 AimHere: I think 0-0 is about the second or third most likely scoreline

15:55 borkdude: I have a question about seesaw. In a listener function I do this: (println *ns*). As a result 'clojure.core is printed. How does that work?

15:55 johnwalker: oh my _god_

15:55 a new quil release

15:55 and clojurescript quil is a thing

15:55 dbasch: (inc llasram)

15:56 devn: basketsball, feetball, basesball -- they make /baskets/, there is more than one base, and there are many feet involved

15:56 llasram: borkdude: The dynamic value of *ns* is clojure.core except when loading is actually happening

15:56 dbasch: chichi is actually a word

15:56 devn: scrabble knows!

15:57 llasram: borkdude: Which has tripped me up before, but makes sense when you squint at it

15:57 nbeloglazov: johnwalker: yep! alpha version of cljs support will be available soon

15:58 borkdude: llasram I am trying to do (source-fn 'alert) in a listener, so the source of the alert function from seesaw.core is shown

15:58 llasram seesaw tutorial

15:58 gfredericks: lein-release causes me to release things like every other commit

15:58 it's just too easy

15:58 johnwalker: ,(inc nbeloglazov)

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

15:58 technomancy: gfredericks: addictive, innit

16:00 * gfredericks whatever, he does what he wants

16:00 johnwalker: whatever, i'll figure it out later. thanks for your work on quil

16:00 i've wanted that for a long time

16:00 the functional mode also looks like

16:01 technomancy: quil's has a non-imperative mode?

16:01 johnwalker: it's new, you should check it out

16:01 https://github.com/quil/quil/wiki/Functional-mode-%28fun-mode%29

16:01 nbeloglazov: technomancy: 'draw' is still imperative. But other functions can be pure. As well as 'update' function was added.

16:02 technomancy: yay!

16:02 borkdude: fully qualifying the symbol worked

16:04 technomancy: heh, 2+ years between opening and closing https://github.com/quil/quil/pull/19 but it looks like it was worth the wait =)

16:05 nbeloglazov: technomancy: yes, the pull request was very useful :)

16:12 TimMc: technomancy: What I'm still missing in lein-release is a way to automatically dump the new version into some source file so that the artifact can know its own version.

16:13 That and it should also update my changelog for me. :-P

16:13 nDuff: Huh. Last time I looked at lein-release it was missing something critical

16:13 ...jar-signing, maybe?

16:14 TimMc: That too, maybe.

16:17 nkozo: I'm having a very weird problem when getting var metadata

16:17 llasram: (inc hugod)

16:17 Well, that not-actually-happening karma is for Alembic

16:18 justin_smith: nkozo: what's a weird problem?

16:18 llasram: I just added like the 5th library to my REPL w/o restarting, and was thinking about sad I'd have been if each one was a restart

16:18 nkozo: (def ^:mykey a) (let [v (def a)] [(meta v) (identical? v #'a)]) ;==> mykey is not present but identical? returns true, is the same var

16:19 justin_smith: nkozo: that def inside the let should be replacing the metadata on the previous def

16:20 nkozo: justin_smith: I thought it was only a lookup, like resolve

16:20 justin_smith: def is always namespace scope, it's replacing what existed before

16:20 technomancy: nDuff: is this the lein-release plugin or the new release task in lein 2.4?

16:20 it signs jars now

16:20 nDuff: I was referring to the plugin.

16:21 re: having a task built in now... shiny!

16:21 technomancy: TimMc: as for version-awareness, do you know about pom.properties?

16:21 justin_smith: nkozo: oh, ok, def without an arg will not clobber, you are right

16:21 nkozo: justin_smith, but the var's value doesn't change, only his metadata.

16:22 technomancy: nDuff: yeah, it's a lot more flexible now

16:22 justin_smith: nkozo: so it seems def removes metadata, even when called with no args

16:22 technomancy: basically just a user-overridable chain of tasks to cut a release

16:22 justin_smith: it is not just a lookup

16:23 nkozo: so the question is, removing metadata is a feature or a bug? :)

16:23 justin_smith: nkozo: to me, for def to be called twice on the same var is a sign something is wrong

16:23 llasram: ditto

16:23 justin_smith: more "don't do that then"

16:23 nkozo: justin_smith: is a simple case, check (source defmulti), it does the same thing to lookup the var

16:24 llasram: And causes all sorts of problems in the process

16:24 justin_smith: nkozo: it checks if it is bound before calling def

16:25 oh, wait, I am wrong

16:25 it uses def in the let

16:26 nkozo: yes, it tries to do nothing if the var already has a multifn

16:26 justin_smith: right, but it calls def before that

16:26 nkozo: but seeing this def behaviour, the multifn var metadata will be destroyed in that check

16:26 justin_smith: thus removing metadata, if there was any

16:26 right

16:26 nkozo: seems like a bug to me

16:27 justin_smith: why not use resolve to look up the var?

16:27 nkozo: because resolve doesn't work in my more-complex case

16:28 but I need to re-evaluate it

16:28 TimMc: technomancy: I know about pom.properties, but that's not available with lein repl.

16:29 technomancy: TimMc: right, which is dumb.

16:29 we should make the same thing work everywhere

16:29 TimMc: I once tried cobbling something together that could read from project.clj or pom.properties or... Yeah.

16:29 arohner: I'm upgrading from nrepl to cider, and trying to get some old behavior back. Previously, if I was inside a form, (re-find foo bar), the minibuffer would show the arity part of the docstring. How do I get that back?

16:29 TimMc: Unfortunately, I don't have any suggestions on what to change.

16:30 technomancy: TimMc: what about writing pom.properties to target/classes?

16:32 llasram: arohner: The `eldoc` minor mode is what handles that

16:32 Wait

16:32 I lied

16:32 Or at least you need more than to just turn it on :-)

16:33 arohner: llasram: good, because I have 'cider-turn-on-eldoc-mode

16:33 llasram: haha

16:34 Ugh, well, I'm running an old version of CIDER (without that function), so am afraid I'm not able to help

16:36 arohner: llasram: ah, figured it out. I misspelled the hook name when converting my config file

16:36 I should have just thrown out my nrepl config and started over

16:44 TimMc: technomancy: Something like that, yeah!

16:45 technomancy: We have a client library that would very much like to be able to report its own version when it talks to the server so that we can debug errors more better.

16:45 technomancy: TimMc: I'll see if I can get it into 2.4.1

16:45 TimMc: woot

16:56 nkozo: justin_smith: just for the record, I reported the (def v) bug at http://dev.clojure.org/jira/browse/CLJ-1446

16:59 justin_smith: OK

17:07 pjstadig: nkozo: the same problem would occur with defonce

17:10 nkozo: pjstadig: defonce macroexpand to a def, but you can use it to resolve the var in the let step of the test case

17:18 pjstadig: note, there was a similar case reported for defonce: http://dev.clojure.org/jira/browse/CLJ-1148

17:37 seancorfield: In Scala, if I have two functions, f and g, that return Option[Int] and I want to conditionally add the ints if both are present, I can do: for (x <- f(); y <- g()) yield x+y - in Clojure, f and g would likely return nil or an int so what is the most elegant way to do that same computation?

17:38 hiredman: seancorfield: if you were to use algo.monads you could do the same as in scala

17:38 seancorfield: Yeah, I was hoping for something idiomatic in the core tho'...

17:38 gfredericks: does algo.monads have a for-like macro helper?

17:39 hiredman: seancorfield: funny because you have the last commit to master in the algo.monads repo

17:39 seancorfield: only because i updated the pom or the contributing file :)

17:39 I have the last commit on quite a few contrib libs because of that...

17:39 hiredman: gfredericks: it has some kind of notation

17:40 justin_smith: seancorfield: not nearly as elegant, but the semantics work (defn combine-if [a b] (if-let [ab (remove nil? [a b])] (apply + ab)))

17:40 seancorfield: background: this came up because of a discussion about Java 8 which adds an Optional<T> type with map and flatMap functions

17:40 justin_smith: well with + we don't even need the if-let actually

17:40 hfaafb: clojure? i 'ardly know her!

17:41 justin_smith: (defn combine-if [a b] (apply + (remove nil? [a b])))

17:41 whodidthis: how do i "\"cools\"" -> "cools"

17:41 seancorfield: so you can write: Optional<Integer> a= f(); Optional<Integer> b = g(); Optional<Integer> c = a.flatMap( x -> b.map( y -> x + y ) );

17:42 gfredericks: https://www.refheap.com/86569 ;; <-- forsome

17:42 seancorfield: justin_smith: that's quite nice... and rewritten as (->> [(f) (g)] (remove nil?) (apply +)) looks fairly clean (to me)

17:43 gfredericks: justin_smith: seancorfield: doesn't work if you want nil when any input is nil

17:43 seancorfield: ah, good point gfredericks

17:43 justin_smith: gfredericks: true, it gives you the additive identity instead

17:43 gfredericks: justin_smith: also if just one is nil it gives you the other one

17:43 it's the shrug monad

17:44 justin_smith: heh

17:44 that part was intentional (even if wrong)

17:44 gfredericks: after using test.check I'm a fan of the for syntax for monadic things

17:45 forsome is missing the :let feature

17:45 I don't think :when applies

17:45 seancorfield: gfredericks: that macro is what i'm looking for... pity there's nothing in core like that :)

17:46 gfredericks: another problem quasisolved with macros!

17:46 seancorfield: and, yeah, getting a or b or 0 from justin_smith's code was the problem i kept running into when trying to solve this with just core functions :(

17:49 it's a pity when-let doesn't accept multiple bindings and test each for truthiness... (when-let [a (f) b (g)] (+ a b))

17:49 arrdem: seancorfield: when-let+ :P

17:49 seancorfield: :)

17:50 hiredman: it is there, in algo.monads

17:50 exactly that

17:51 that is literal what domonad does with the maybe monad

17:57 seancorfield: yeah... maybe I'll break down and use monads :)

17:57 (domonad maybe-m [a (f) b (g)] (+ a b))

18:17 allenj12: when i use goog.require('example.core') in html script, will it be reffering to the same namespace i declare in my example.cljs? or does it take a new name under core or something

18:18 nDuff: allenj12, the names map directly, no changes.

18:19 allenj12: nDuff: interesting, goog.require cant seem to find the namespace then.

18:19 nDuff: thanks

18:22 mi6x3m: hey clojure, is support-forward-navigation? a good function name

18:22 I can't decide on a name

18:25 justin_smith: mi6x3m: are you checking whether you should support forward nav, or whether something else should?

18:25 or does?

18:25 mi6x3m: justin_smith: I check whether a component supports it

18:26 justin_smith: i'd say supports-forward-nav

18:26 I think nav there is unambiguous

18:26 even supports-fwd-nav maybe (that could be going to far)

18:26 arrdem: I agree with "supports" rather than "support"

18:26 just sounds awkward otherwise

18:27 mi6x3m: supports-forward-nav it is :)

18:27 justin_smith: support- indicates to me that it is a request, and we are checking if the request asks us to support that thing

18:27 mi6x3m: ok, some more questions about names. callback-js! for installing a function to be called from javascript, cookie for returning a named session cookie, cookies! for setting a bunch of cookies

18:28 justin_smith: callback-js, to me, sounds like the name for a function that would execute javascript's callback (or cause it to be executed)

18:29 maybe install-js-callback! ?

18:29 mi6x3m: yeah, good plan

18:48 allenj12: has anyone ever gotten this warning WARNING: unsigned-bit-shift-right already refers to: #'clojure.core/unsigned-bit -shift-right in namespace: cljs.core, being replaced by: #'cljs.core/unsigned-bi t-shift-right

18:49 toxmeister: allenj12: yes, that will go away if you upgrade you cljs to the branch using clj 1.6...

18:49 allenj12: it's because cljs already defined that fn earlier than clojure did (only was added w/ 1.6.0)

18:51 allenj12: am not sure if there's already a release of that branch, but easy enough to build yourself (also see: https://groups.google.com/d/msg/clojurescript/MEFJ5D7g8yM/ndrzWn6KxpMJ)

18:51 allenj12: toxmeister: seems like they just updated cljs

18:52 toxmeister: that warning has been there for me ever since i switched my projects to clj 1.6 and there was talk about this issue on the ML a few months back

18:53 now that CLJ has that fn already, it can be removed from CLJS

18:55 allenj12: http://dev.clojure.org/jira/browse/CLJS-514

18:55 allenj12: toxmeister: i updated cljs and dont get that error anymore.. it seems to have been changend in the last few days

18:57 toxmeister: allenj12: which cljs rev are you on? must be on the 1.6 branch too then…

18:57 allenj12: "0.0-2234"

18:59 toxmeister: allenj12: am using self built 2246 - the official ticket for this is still open though (http://dev.clojure.org/jira/browse/CLJS-769)

18:59 allenj12: toxmeister: i wonder why my problem went away then

19:02 toxmeister: allenj12: because of this maybe? https://github.com/clojure/clojurescript/commit/f3e571136d741eb22d0df31f212beb036cae78b7#diff-b64165608bed8fb21a132890b4e2fca2R30

19:03 devn: _ato: technomancy: xeqi: new clojars logo! https://github.com/devn/clojars-web/commit/aced5706430bd54fcdb2ee97fdb48e2450e731b5

19:03 allenj12: devn: i like it

19:03 toxmeister: hmmm

19:04 TEttinger: ha! that's clever, devn

19:04 arrdem: devn: cheeeeese

19:04 TEttinger: (inc devn)

19:04 lazybot died

19:04 devn: it looks better on the purple background

19:04 technomancy: devn: science!

19:04 devn: huzzah!

19:05 technomancy: <3

19:06 arrdem: so. much. purple!

19:06 allenj12: (inc devn)

19:06 devn: technomancy: the guy who did the original comps is out. our illustrator/art/icon person (Kelly Rauerdink) did this. I suspect when Mic gets back from vacation he'll have some tweaks to the logo placement on the homepage and stuff, but for now this looks decent

19:06 technomancy: indeed

19:07 devn: gotta run. cheers!

19:09 mi6x3m: is it possible reify doesn't see the methods of an inner interface?

19:09 for this interface http://djproject.sourceforge.net/ns/documentation/javadoc/index.html I get "Can't define method not in interfaces: createWebBrowserDecorator

19:09 the interface is JWebBrowser.WebBrowserDecoratorFactory, sorry

19:10 technomancy: TimMc: https://github.com/technomancy/leiningen/commit/12ec7b92002995b92f3f02c0317728d9c34c3c09

19:10 thoughts?

19:12 hiredman: mi6x3m: there is no such thing as an inner interface

19:12 mi6x3m: yeah, I used a false term, but it's not a solution to the problem I guess

19:12 somehow the method isn't visible

19:13 works if I use proxy

19:14 toxmeister: mi6x3m: how are you referring to this interface? Inner classes need to use `$` instead of `.` as separator

19:15 mi6x3m: toxmeister: (reify JWebBrowser$WebBrowserDecoratorFactory []

19:15 (createWebBrowserDecorator [target component] (f target component)))

19:15 without the [] after Factory, this is from the proxy test

19:16 toxmeister: mi6x3m: hmmm… dunno then...

19:17 allenj12: toxmeister: o wow i just got that warning again randomly, o well.

19:18 toxmeister: allenj12: probably didn't use lein cljsbuild clean before then...

19:20 amalloy: (inc devn)

19:20 lazybot: ⇒ 20

19:20 amalloy: (inc devn)

19:20 lazybot: ⇒ 21

19:20 amalloy: i understand lazybot dropped these

19:24 arrdem: (inc devn)

19:24 lazybot: ⇒ 22

19:29 xeqi: is there a function that will return all possible interleavings of a list of lists?

19:31 ie: [[1 2] [3 4]] -> [[1 2 3 4] [1 3 2 4] [1 3 4 2] [3 1 2 4] [3 1 4 2] [3 4 1 2]]

19:32 amalloy: certainly there's nothing built in, but i don't think it's too difficult to write

19:34 xeqi: in fact, i think it's just all permutations of (apply concat lists), right? so you can just grab permutations from contrib.combinatorics

19:34 justin_smith: xeqi: maybe with clojure.math.combinatorics/combinations ? https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L88

19:34 amalloy: nah, has to be permutations, not combinations. but that's on the right track

19:36 justin_smith: xeqi: is there some pattern bhind the fact that orders starting from 2 or 4 are missing in your example?

19:36 amalloy: oh, right. yeah, i'm so wrong. permutations is no good

19:37 xeqi: justin_smith: ah, meant the final lists kept ordering from the originals

19:37 TimMc: technomancy: Does that mean I could load the resource "pom.properties" either from lein repl in the project or from a jar URL resource loader in a library?

19:38 xeqi: so in that example, 1 must occur before 2, 3 before 4

19:38 allenj12: so i tried :optimizations :advanced and now it says goog is not defined and i cant go back lol

19:38 technomancy: TimMc: correcto

19:39 lein run, lein repl, lein swankety, whatever

19:39 TimMc: Then awesome.

19:39 I'll see if I can test this out tonight.

19:39 technomancy: it's implemented as a :prep-task, similar to how javac and compile run before any in-project code

19:39 that would be great

19:39 xeqi: justin_smith: so combinations might work, thanks

19:39 technomancy: would like to cut a release over the weekend

19:40 bit later than I told gfredericks but hopefully not too bad

19:40 xeqi: ah, not quite

19:40 TimMc: Is that on master?

19:40 justin_smith: at the very least the tactics used in c.m.c should be applicable

19:40 technomancy: TimMc: yeah

19:40 justin_smith: even if none of those functions do it quite right

19:40 xeqi: yep, thanks for the pointer

19:40 TimMc: Cool, I'll see if I can test it on the train home, then.

19:41 amalloy: xeqi: https://www.refheap.com/09e3d1c185f2ea905b814531d

19:42 easier to do by hand than with combinations, i think

19:42 i even happen to produce answers in the same order as you did

19:50 out of curiosity, xeqi, what do you need to know possible interleavings for?

19:53 sritchie: seancorfield: saw that you discovered the maybe monad earlier :)

19:56 zimri-lim: re: Ring, what is a 'legacy servlet container'. Is this assuming all Java servelets are legacy, or are there non-legacy servlet containers?

20:03 Jaood: zimri-lim: I guess there are legancy and non-legacy servlet containers, the most popular servelet cointaner in the clojure world is jetty

20:03 amalloy: although i'm pretty sure embedding jetty is more popular still, for clojure at least

20:03 Jaood: zimri-lim: and there's http-kit which is a http server desgined for clojure (ring) applications

20:04 zimri-lim: which has nothing to do with servlets

20:06 amalloy: I guess is more popular because it predates http-kit and is more convenient for java legacy apps

20:06 xeqi: amalloy: I'm playing around with parallel properties, so I'm seeing if I can do the interleaving comparison from Hughes' c/w talk

20:06 seancorfield: sritchie: I wouldn't say "discovered", just that I was resisting using the monads library in the hope of a solution in core that was sufficiently elegant :)

20:08 sritchie: But I still agree with Evan's position on how to present Elm - without mentioning the M-word (and without a lot of the type theory that is behind the implementation of Elm)

20:09 sritchie: The Haskellers on the Elm mailing list can be very resistant to Evan's position at times :)

20:09 sritchie: seancorfield: the monad thing is compelling because the same pattern that everyone’s familiar with with lists...

20:09 works for maybe, and for reactive stuff, and for futures,

20:09 so, boom, you already know how to code those things

20:11 seancorfield: but yeah, that whole group is really amazing with how hardheaded they are

20:11 how completely arrogant, rather

20:12 seancorfield: yeah, it's almost like they are willfully trying to exclude new programmers by insisting on using "computer science terms" instead of day-to-day language

20:12 arrdem: yeah that's the one thing that keeps turning me off about learning haskell.. I really enjoy the shall we say quiet craftsmanship? here, and that's one thing totally lacking in the other camp.

20:12 seancorfield: explaining how the maybe monad works doesn't require using the M-word and pouring the "monad laws" and all the other stuff on newbies

20:13 I've always liked Haskell - I was very excited when it first appeared and I really believed it could bring FP to the mainstream (foolish me!).

20:13 Jaood: are there any Haskell monads tutorials?

20:14 seancorfield: Hundreds!

20:14 Jaood: I kid I kid

20:14 seancorfield: :)

20:14 Jaood: ;)

20:15 seancorfield: But you just can't get very far discussing problems with Haskell programmers without being bombarded with applicatives, functors, monoids and sorts of other stuff that - in my opinion - completely distracts from the actual patterns in play.

20:16 arrdem: amalloy: useful material maybe, just made my toolkit. https://www.refheap.com/86575

20:16 seancorfield: I'm not denying the usefulness of common terminology - but that stuff is only "common" in a relatively small community, compared to the programming world at large.

20:16 scriptor: this is a common issue in mathematics

20:16 seancorfield: And there's a level of genericity there that is also a distraction. Yes scriptor I agree - and I _am_ a mathematician :)

20:16 scriptor: I've seen articles before pointing out how specialists in one field can't just easily pick up a paper from another subfield and understand it

20:17 ah

20:17 erm

20:17 arrdem: seancorfield: I think their stance and I would tend to agree with them, is that the "common patterns" are really special cases of the more general patterns they are describing. Teaching programming in those terms is really the only fix, and I agree it's a difficult one.

20:17 scriptor: I was all of one class short of a math minor, so hah!

20:17 zimri-lim: Jaood: ok. so there's no reason not to use the "lein ring war" command, even though the doc mentions that it's used for legacy web services?

20:17 seancorfield: My BSc is Math w/Comp Sci and then I did a PhD in FP language design and implementation - so SASL, Miranda, ML etc were all bread and butter for me back in the early-to-mid-80's...

20:19 arrdem: yeah, I think the fact that we have so many "monad tutorials" speaks to a fundamental problem in trying to teach them in that way / context - and something else is needed

20:20 lots of programmers are perfectly happy learning about for-comprehensions without knowing anything about monads etc

20:22 arrdem: seancorfield: I think the reality of the thing is that we've been teaching computer science in the context of building explicit control flow in imperative languages for decades now and despite being a hold over from the days when men were men and wrangled raw untyped pointers in raw PDP-8 assembly or whatever it continues to influence how everyone learns programming.

20:23 justin_smith: arrdem: even as the underlying hardware stops being strictly sequential

20:23 amalloy: incidentally, arrdem, it seems like (-> foo (->assert even?) (inc)) is just (-> foo (doto (-> (even?) (assert))) (inc))

20:23 seancorfield: but you can teach programming without jargon - and outside of hardcore comp sci that's exactly what is done... but FP has stayed primarily academic until fairly recently and it's had a long time to cement its jargon :)

20:23 arrdem: amalloy: sure, I just think that the ->(>)?assert is nicer.

20:24 seancorfield: I mean we seem to have no problem teaching math and physics jargon, so I think that's a fallacious argument.

20:24 seancorfield: just because we have "jargon" doesn't mean it's the right jargon

20:25 s/the right/good/g

20:25 seancorfield: It's a different audience. There are millions of programmers (in terms of jobs) but relatively few mathematicians and physicists

20:25 stephenjudkins: seancorfield: "jargon" is subjective and relative

20:25 i think it's perfectly fine to tell people they should know what a monad is, it's been really useful to me, and not that complicated

20:25 akhudek: does anyone know if you can validate data you pass into a function defined with prismatic’s defnk? Supposedly defnk now supports schemas, though it’s not clear what you can do with them.

20:26 seancorfield: If programming was a career of the same scale as physicists, then having jargon as a barrier to entry is fine - but it is an obstacle to scaling the education process needed for millions of programmers

20:26 stephenjudkins: and to be honest, if knowing what a monad is was indeed the barrier to entry for programming, i'd be perfectly happy - but that's just not the case

20:27 stephenjudkins: i think the "you just hate knowledge/learning things" reflexive response to people's criticism of FP is stupid, though

20:27 seancorfield: agreed

20:27 arrdem: seancorfield: but only because we've been teaching this sequential model of machine execution as "programming", a model which the hardware, software and network guys are now trying desperately to escape.

20:28 stephenjudkins: like, i am pretty thoroughly aware of how monad transformers work, i just think they are a horrible painful nasty abstraction for day-to-day programming

20:29 and that they're the best/only way might suggest that (gasp!) current FP languages have some big problems and may not be sufficient to take over the world

20:29 arrdem: HERETIC

20:29 amalloy: ~guards

20:29 clojurebot: SEIZE HIM!

20:29 seancorfield: LOL

20:30 but that is indeed the quagmire of argument you get into as soon as you push back on this stuff ("jargon")

20:30 arrdem: (inc amalloy)

20:30 lazybot: ⇒ 128

20:30 arrdem: seancorfield: have you read EWD's letter to the UT Board about the CS curriculum here?

20:30 seancorfield: and it's certainly possible to teach FP to complete beginners without any of that stuff

20:31 amalloy: unfortunately the heretic is cloaked in the Maybe monad. the guards were going to Just sieze him, but he got away and there's Nothing left

20:31 arrdem: amalloy: I'm quoting you on that...

20:31 TimMc: :-D

20:32 sritchie: seancorfield: oh man, just jumped back in

20:32 amalloy: good luck finding a suitable context

20:32 sritchie: I had asked on IRC -

20:32 scriptor: heh, guards

20:32 sritchie: seancorfield: but, here’s the thing

20:32 the monad is obviously a pattern

20:32 you just wanted it for maybe

20:32 so what’s the “everyday language” suitable to introduce that pattern?

20:32 given that elm chose the pattern, I guess

20:33 scala just calls it “for syntax”, I guess

20:33 clojurebot: Titim gan éirí ort.

20:33 seancorfield: right, and there's no mention of the M-word here http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html

20:34 sritchie: sure, but it’s also not sharing an interface with java’s lists

20:34 which you could argue that it should, now that they have map, filter, etc

20:34 seancorfield: Optional has map, flatMap, filter

20:34 sritchie: yeah, this implements filter,

20:34 and so does a list, now…

20:34 seancorfield: well, streams do :)

20:34 sritchie: but they share no interface

20:34 so I can’t write code that will work on both

20:35 like, “lift” is really useful

20:35 take a function, and make it work on some monad

20:35 and you can’t write that without the common interface...

20:35 but you have to name the interface

20:36 take A -> B and make Option[A] -> Option[B], etc

20:37 seancorfield: I'd have to see how far you could push Java's generics for that...

20:38 amalloy: seancorfield: no further than the java 8 stuff already did

20:38 seancorfield: amalloy: and they added a whole bunch of new type inference to make that work in Java 8

20:38 amalloy: you just need a common superinterface FlatMappable (ie, Monad), instead of 8 different interfaces that all contain flatMap

20:41 and then you can write something like: public <A,B,M extends FlatMappable> Function<M<A>,M<B>> lift(Function<A, B>);

20:44 stephenjudkins: what word makes clojurebot swear in irish?

20:44 amalloy: ~swear in irish

20:44 clojurebot: excusez-moi

20:45 stephenjudkins: syntax

20:45 arrdem: clojurebot never swears in irish, he will occasionally apologize in welsh

20:45 amalloy: ~swear in irish please?

20:45 clojurebot: Gabh mo leithscéal?

20:45 stephenjudkins: i'm so confused

20:45 amalloy: close enough. have a cookie

20:52 seancorfield: amalloy: looks like they only partially implemented generalized target-type inference in Java 8 ... so there's still a bunch of stuff it can't figure out :(

20:52 and I'm more familiar with the behavior of C++ templates (which really weren't based on types)

20:58 but, yeah, there are definitely some oddities in the new Java 8 stuff... since Optional is a final class, its flatMap type signature doesn't match the flatMap on Stream (even if they had a common interface to implement)

20:59 hiredman: and now java is stuck with it for 10 years

21:10 devn: technomancy: xeqi: I have a surprise for you: https://github.com/devn/clojars-web/tree/devn-404 -- check that out and go to the 404 page

21:13 ill give you a hint: https://www.dropbox.com/s/0wfnlwsg1p1qbj8/xeyes404.png

21:13 :D

21:13 TEttinger: I gotta say, devn, https://github.com/devn/clojars-web/blob/d99aeeefc74938087c821bbda655ca713bc651e8/resources/public/images/rich-portrait-frame.png is pretty creepy

21:13 arrdem: (inc devn)

21:13 lazybot: ⇒ 23

21:14 arrdem: devn: dude. that's hillarious

21:14 devn: im not sure im going to use that image yet. it's a funny picture of him. i've been toying with the idea of making it look less like vector art and more like a painting

21:15 serious business

21:15 lol

21:15 and just in case you're looking at just the screenshot, yes, the cursor follows your mouse

21:16 err the eyes follow your cursor

21:34 allenj12: in quil if im using :fullscreen is there a way to get the screen height or width?

21:35 o nvm, there is a funtion called that, i just did something wrong

22:38 umpa: ,(println "hello!")

22:38 clojurebot: hello!\n

22:41 umpa: How do I loop recure with multiple conditions ? https://www.refheap.com/86579

22:43 muhuk: umpa: what's the error message you're getting?

22:44 umpa: https://www.refheap.com/86580

22:45 umpa: eh, no.

22:45 umpa: https://www.refheap.com/86579

22:48 muhuk: umpa: see the fork I've pasted

22:48 umpa: mhuk: nice

22:49 muhuk: umpa: one thing: I wouldn't overwrite x and y within the loop, makes it harder to read the code.

22:51 umpa: mhuk: true

22:51 allenj12: ,(.-value 3)

22:51 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: value for class java.lang.Long>

22:53 allenj12: ,(.-value "hello")

22:53 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: value for class java.lang.String>

23:39 akhudek: oh wow, including docx4j 3.1.0 in lein caues a stackoverflow in lein deps :tree

23:41 ah whew

23:41 upgrading lein fixed it

Logging service provided by n01se.net