#clojure logs

2014-06-13

00:15tolstoyAny clue why this doesn't return any attributes: {:find [?attrs] :in [$ ?str] :where [[_ ?attrs ?str]]}?
00:18tolstoyHm. Maybe I have to define some sort of full text search in there?
00:21tolstoyOr: "If both the entity and attribute positions of a clause are unbound and the value is specified, the value must be an entity id."
00:23xeqimichaniskin: I'll be interested to hear if you get the full tree you're looking for
00:25michaniskinxeqi: i'll let you know. it's slow going, though, and difficult to debug when things aren't working.
00:27michaniskinxeqi: 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
01:06justin_smithmichaniskin: 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
01:08beamsoosgi?
01:09justin_smiththat was the one indeed
01:09justin_smithI am sure michaniskin has seen this, and probably thought it looked silly http://en.wikipedia.org/wiki/OSGi
02:33hellofunkyes
02:45Jaoodhellofunk: no way
02:48IbrahimAyes way
02:56dbasch&(str (get ["yes" "no"] (rand-int 2)) " way")
02:56lazybot⇒ "yes way"
02:56beamsohaha.
03:00jonasen&(str (rand-nth [“yes” “no”]) “ way”)
03:00lazybotjava.lang.RuntimeException: Unable to resolve symbol: “yes” in this context
03:01allenj12does anyone else find om to be confusing?
03:02beamsoseemed easier than angular to me (from tutes and initial dev work)
03:04allenj12beamso: hmm im new to all this kinda stuff, and the om tutorials kinda shove alot in your face at once
03:04john2xsufficiently complex manipulation of the DOM is inherently confusing
03:05jonasen&(str (rand-nth ["yes" "no"]) " way")
03:05lazybot⇒ "yes way"
03:06allenj12so 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?
03:06beamsoit renders inside the div
03:06allenj12gotcha
03:06beamsoyou probably shouldn't render the div again (or attempt to)
03:09allenj12beamso: hmm alright
03:11dbasch&(str (last (take (inc (rand-int 2)) (cycle ["yes" "no"]))) " way")
03:11lazybot⇒ "no way"
03:11allenj12when you <! from a chan what might your val look likeL
03:15allenj12beamso: would it help if i read the js tutorials first?
03:17hellofunkallenj12 the value on a chan could be anything, even another channel
03:18allenj12hellofunk: hmm kk
03:18hellofunkallenj12 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
03:18beamsoallenj12: i'd recommend looking at the o'reilly clojurescript book or a javascript book if you're struggling
03:18allenj12hellofunk: clojurescript im fine its just om :(
03:19allenj12sorry i ment js react tutorials
03:19hellofunkit can't hurt to read them but i'm not and i'm also learning om.
03:21allenj12hellofunk: ahh kk i guess i just need to look more, are you using any source besides the gitub wiki?
03:22hellofunknope that's the one (or two) that i'm using
03:22hellofunkjust go through them a few times over and over
03:22allenj12hellofunk: yea, thats my plan now
03:22hellofunkreification, 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.
03:23allenj12hellofunk: indeed :)
03:29allenj12is transact pretty much swap?
03:44borkdudemy emacs cider autocomplete thing is broken. When I press tab, I get "List expression: ..."
03:44borkdude*Lisp
03:49ddellaco_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)
03:52borkdudeddellacosta you can just use throw to throw an exception ;)
03:53clgvddellacosta: either the Zip format specification or the implementation details might help there. I'd bet you have more success probabilities with the former
03:54ddellacostaborkdude: 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
03:56clgvddellacosta: so you are not trying to build an invalid zip archive for testing with respect to filenames?
03:58ddellacostaclgv: I should put it like this: I'm trying to duplicate this behavior in my code somehow: https://www.refheap.com/86541
03:58ddellacostaclgv: I'm willing to consider any way to do that, but I'm a bit stumped right now.
03:59ddellacostaclgv: rather, I want to duplicate that in my tests, I should clarify
03:59ddellacostaclgv: ...and then I can ensure I'm handling it correctly.
04:01clgvddellacosta: there are lots of results on google for that one, e.g. https://github.com/zeroturnaround/zt-zip/issues/34
04:01ddellacosta(updated that refheap with the two lines that provoke it in the code)
04:02ddellacostaclgv: okay, thanks, I'll see if that leads me anywhere.
04:04clgvddellacosta: äöü;)
04:05ddellacostaclgv: 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.
04:05ddellacostaclgv: 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.
04:06Glenjamincan you just with-redef something to throw a canned exception?
04:07clgvddellacosta: 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
04:07ddellacostaGlenjamin: can you use with-redefs with Java methods?
04:07Glenjaminno, you'd need a wrapper
04:08ddellacostaclgv: that's not going to guarantee that it will be handled in the same way in production though.
04:09Glenjamin(defn zipfile-entries-seq [^java.util.zip.ZipFile zipfile] (enumeration-seq (.entries zipfile)))
04:09Glenjaminthen with-redef that
04:09clgvddellacosta: ok let me rephrase. I'd put it in the last clojure function that interfaces zipfile
04:09clgvlast => nearest to the java layer
04:10clgvddellacosta: 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
04:11ddellacostaclgv: 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.
04:12ddellacostaclgv, Glenjamin: anyways, thanks for the help. I'll keep fiddling around with this.
04:12clgvddellacosta: the last comment indicating the fix seems to me could be the way to break it on purpose
04:13clgvwe are in an evil mood today, breaking things on purpose ;)
04:13ddellacostaclgv: ? You mean in the link you gave me? How so?
04:13Glenjamini think its reasonable to mock/stub at the boundary between your code and not-your-code
04:13Glenjaminbut i can see why you might prefer a real integration test
04:14ddellacostaGlenjamin: 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.
04:15clgvddellacosta: that one: new ZipFile(file, Charset.forName("Cp437")); - I'd bet using cyrillic from UTF-8 and applying an ANSI charset should break, no?
04:15ddellacostaGlenjamin: 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.
04:16clgvddellacosta: stubbing a custom seq similar to enumeration-seq would be the next better choice I guess
04:16Glenjamin,(doc enumeration-seq)
04:17clojurebot"([e]); Returns a seq on a java.util.Enumeration"
04:17ddellacostaclgv: 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
04:17clgvGlenjamin: for java's enumerators
04:17Glenjaminyeah, just wondering if its lazy
04:17Glenjaminas the stack trace shows two calls to nextElement
04:17clgvddellacosta: via Java? create a non-utf8 string (possible?) and create a file with it
04:18clgvGlenjamin: it is certainly lazy since enumerators are ;)
04:18clgvGlenjamin: it's probably the second item encountered that throws
04:19clgvah scratch that. I bet on some overloaded version
04:20Glenjaminah yes, very different line numbers
04:21Glenjaminddellacosta: can you make a zipfile with a non-ascii char in the name, then load as ascii?
04:21clgvI am not sure why it reports line 513 since this is a return statement in java 7
04:22ddellacostaGlenjamin: I haven't had much luck with that so far.
04:22clgvddellacosta: do it programmatically if OS X prevents you from doing it manually
04:23borkdudeI 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
04:24ddellacostaclgv: yeah, I'll give that a shot if I can't figure out a way to stub this Java method
04:26clgvborkdude: dependency issues - hoooray!
04:27borkdudeclgv do you know how to solve this?
04:29clgvborkdude: nope. I am glad that I can decide manually when to upgrade my clojure ide ;)
04:29clgvI always check new releases on a private computer before using them at work...
04:30borkdudeclgv what 'ide' are you using?
04:31clgvnon-emacs. I still use CCW ;)
04:31clgvI had a look at cursive and lighttable but there was no compelling reason to switch so far
04:32clgvguess I dont wanna change the running and reliable system ;)
04:34Psy-Qi'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
04:36clgvPsy-Q: split the "parser superclass" into sever functions that can be used from the specialized functions
04:37clgv*several
04:42borkdudeso what is the best place to go with my cider issue, this channel or other one?
04:44allenj12borkdude: definatley emacs channel id say
04:46clgvborkdude: some of the maintainers of cider are often here at a later time, maybe 5-6 hours from now
04:47allenj12does 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
05:02clgvwas there ever an explanation why exceptions might not contain stacktraces anymore after reevaluating a namespace?
05:07borkdudehmm https://gist.github.com/borkdude/6301d3a1f05e37074276
05:07borkdudeI am now using Emacs Prelude and the cider-nrepl plugin, but it doesn't seem to pick it up
05:17Psy-Qclgv: 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?
05:19borkdudeone step further: https://gist.github.com/borkdude/0426d75b3c562d9581e2
05:19clgvPsy-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
05:19borkdudeinstalled cider-nrepl 0.7.0-snapshot. Please install cider-nrepl 0.7.0-snapshot?
05:19clgvPsy-Q: provided you switch to functional style completely and use the right libs your code will shrink considerably anyway
05:20Psy-Qclgv: 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
05:20clgv*code size
05:20Psy-Qclgv: i might even get by with one function that takes the appropriate regex and path per store, i think :)
05:20clgvPsy-Q: oh maybe you need only one function then, since you can pass those as parameters
05:20clgvPsy-Q: ^^ :D
05:20Psy-Qclgv: hah, same thought :)
05:21Psy-Qthis'll be really, really enlightening to implement
05:21Psy-Qeven if it takes me a month :P
05:21clgvPsy-Q: but you should break down parts of the functionality into smaller functions
05:21clgvso that you do not end up with one messy 50 lines function ;)
05:22Psy-Qclgv: 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.
05:22Psy-Qso maybe i was already splitting it more or less appropriately for FP
05:22clgvseems like it.
06:21oholiabthis 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?
06:28ggherdovhi. 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?
06:30hugoduncanmichaniskin: if you want a list jars on the classpath, look at bultitude
06:32guymeHi!
06:33philandstuffggherdov: yes. they wrote books titled "effective c++" and "effective java"
06:33ggherdovphilandstuff: ok
06:34clgvoholiab: not as you describe it. but you can embed a repl or nrepl in your running program
06:35oholiabclgv: thanks
06:36oholiabalternatively 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)
06:36clgvggherdov: seems like it. google finds "Effective C++..." and "Effective Java ..."
06:36oholiabi.e. the equivalent of ruby's "inspect"
06:36oholiab*print
06:37clgvoholiab: sounds like you want `prn`
06:37oholiabclgv: nice
06:37oholiabthanks
06:37clgvwell thats a book title to clain "Effective Clojure" :D
06:37clgv^^
06:38clgv*claim
06:38oholiabI was about to tell you you were wrong about prn and then I realised I was manually casting to a string
06:38oholiabthat could have been awkward
06:39oholiabclgv: thanks for your help :)
06:39clgv,(println (range 10))
06:39clojurebot(0 1 ...)\n
06:39oholiabI knew all of this stuff once and then I didn't write any clojure in ages
06:39clgvdamn he is cheating
06:40oholiabthat's taking lazy evaluation a bit too far
06:40oholiab:P
06:40clgvah no
06:40clgv,(str (range 10))
06:40clojureboteval service is offline
06:40clgvnow he seems annoyed :P
06:40oholiablol wut
06:40clgv&(str (range 10))
06:40lazybot⇒ "clojure.lang.LazySeq@9ebadac6"
06:41clgv&(pr-str (range 10))
06:41lazybot⇒ "(0 1 2 3 4 5 6 7 8 9)"
06:48Glenjamin,:working?
06:48clojurebot:working?
06:49ggherdovclgv: indeed, the key word was "effective" in the book title. I missed it, reading the message in the newsgroup.
06:50oholiabwelp all that time I spent trying to add recursive config loading to this project and it already has it
06:50oholiabI am such a dumbass
07:02borkdudealready someone awake who knows how I can get cider-nrepl plugin working?
07:14agarmanemacs live
07:15agarmanborkdude: 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
07:42borkdudeagarman I just switched form emacs live to Emacs Prelude, because in live it stopped working as well
07:43borkdudeagarman but no luck in prelude neither :-s
07:45borkdudebut in prelude I have a different problem. the cider-nrepl plugin isn't recognized
07:47agarmanborkdude: have you tried deleting your elpa directory?
07:48agarmanborkdude: multiple conflicting versions can get downloaded and elpa will happily try to use all of them
07:48borkdudeI have removed cider and clojure-mode from elpa
07:48borkdudethen re-installed
07:48agarmanand it's still not working?
07:48borkdudewell, it's working but not completely. the autocomplete won't work, which was my problem in the first place
07:48borkdudehttps://gist.github.com/borkdude/0426d75b3c562d9581e2
07:48agarmanah, repl autocomplete?
07:48borkdudeagarman yes
07:49agarmanokay, emacs-live didn't seem to have that enabled because AC breaks once a buffer gets too large
07:50agarmanREPL buffers cause AC to break
07:50borkdudeI remember having used this in emacs-live
07:50agarmanI enable company mode in my emacs live
07:50borkdudecompletion--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
07:50agarmanand for nrepl middleware
07:51agarmanyou need to add that stuff to your lein profile
07:51borkdudeI got this in my profiles.clj under :user :plugins : [cider/cider-nrepl "0.7.0-SNAPSHOT"]
07:52agarman0.7.0 wasn't working for me when I tried it
07:52agarmanI'm using 0.6.0
07:52borkdudecider 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)
07:52borkdudeI can try 0.6 then
07:53agarmanyeah 0.6.0 is stable
07:54borkdudehmm, how can I install an older version in emacs from package-list-packages?
07:55borkdudethere should be something like a project.clj for elpa
07:57agarmanborkdude: 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
08:04agarmanborkdude: I started to switch to http://tapoueh.org/emacs/el-get.html because it's less surprising than elpa
08:04borkdudeagarman ok, I think I'll switch back to emacs live now and then work from there again (I like the defaults better)
08:05agarmanborkdude: ^_^
08:14borkdudeagarman what do you get when you type in a repl for instance '(diss' followed by a tab?
08:14borkdudeI'm working with the newest emacs-live from master
08:17agarmanborkdude: I add https://www.refheap.com/86550 to my ~/.live-packs/`whoami`-packs/init.el
08:17agarmanborkdude: so I have company mode running in my repl
08:18agarmanborkdude: AC everywhere else...and you'll want to change the default bindings for completion in one or the other
08:19borkdudeok
08:24borkdudeis emacs-live still actively maintained btw? last commit is couple of months ago
08:26agarmanborkdude: if Sam Aaron abandons it, someone will take over...
08:26Hodappyou an emacs-live user?
08:26agarmanborkdude: until there's a new stable release of cider, there's not much to do with Emacs-Live
08:26borkdudeagarman 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.
08:27HodappI am liking emacs-live, though I find some of the default settings to be a bit obnoxious.
08:27agarmanHodapp: I use it currently...though I may switch to just using el-get in the future
08:28borkdudethe thing I don't like of emacs-live is the slow startup time compared to prelude
08:28agarmanborkdude: I start emacs on boot, so I don't notice
08:28agarmanborkdude: https://gist.github.com/agarman/9715019
08:29borkdudeagarman ok cool
08:29agarmanborkdude: that's assuming OSX
08:29borkdudeagarman I have osx
08:30agarmanI then have an alias in my bash_profile
08:30agarman"reattach-to-user-namespace emacsclient -s emax -t"
08:30agarmanwhich assumes you have used brew to install reattach-to-user-namespace
08:31engblomReading 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?
08:31engblomCan this be done in an ACID way?
08:31agarmanengblom: read-string will potentially eval
08:32borkdudeagarman I don't know the reattach thing, but I might check it out
08:32agarmanborkdude: it's mostly for tmux in iterm
08:32borkdudeagarman do you use emacs via iterm?
08:32agarmanborkdude: yes
08:32borkdudeagarman hm, I don't, I like the cocoa better
08:32agarmanborkdude: I have my iterm config up on gist
08:33agarmanborkdude: I'm open to dumping iterm, though I'd miss it's buffer history if whatever I switched to didn't have it
08:34borkdudeagarman buffer history as in clipboard?
08:35agarmanborkdude: no CMD-OPT-B will let you look at the state of the term through it's history
08:36borkdudeagarman ah yes, I see that now
08:36borkdudeI just use up arrow ;)
08:36agarmanborkdude: I use flycut for OSX paste-history
08:36agarmanborkdude: up arrow doesn't work for top
08:36agarmanborkdude: or looking at stuff in old tmux windows
08:36borkdudeagarman I use alfred for clipboard history
08:37borkdudeagarman I tried to use tmux, but when scrolling didn't work as expected I got annoyed
08:39CookedGryphonI'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?
08:40szymanowskiHi, 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?
08:41CookedGryphonhave you tried just extending it? or are you just assuming it won't work?
08:42agarmanCookedGryphon: have you tried addAll?
08:42szymanowskijava.lang.Number extension seems to be the thing
08:43CookedGryphonagarman: ah, yeah that looks like it
08:44engblomIs there anything similar to this for clojure? https://hackage.haskell.org/package/acid-state
08:44CookedGryphonagarman: 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
08:45engblomhttp://acid-state.seize.it/
09:33mikerodIt's interesting. You can do something like `(defn .myFn [x] x)`
09:33mikerodHowever, you cannot call it like `(.myFn 1)`
09:34Glenjamin,(defn .dot [] "dot")
09:34clojurebot#'sandbox/.dot
09:34Glenjamin(.dot)
09:34mikerod"IllegalArgumentException No matching field found: myFn for class java.lang.Long clojure.lang.Reflector.getInstanceField (Reflector.java:271)"
09:34Glenjamin,(.dot)
09:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)>
09:34mikerodIs what I get
09:34Glenjamin,(#'.dot)
09:34clojurebot"dot"
09:34mikerodIt is interpreted as the dot special form
09:34mikerodyes, I figured directly accessing the var first would work.
09:34Glenjamin,(macroexpand '(.dot))
09:34clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)>
09:35Glenjaminah, interop is a reader thing i guess
09:35mikerodOh.
09:35mikerodI guess that surprises me
09:36Bronsanot a reader thing
09:36philandstuff,(macroexpand '(.dot :fake-target))
09:36clojurebot(. :fake-target ...)
09:36Bronsa(.foo bar) gets transformed to (. bar foo) by macroexpand
09:37philandstuffhuh, where did that "..." come from?
09:37Bronsa,'dot
09:37clojurebotdot
09:37Bronsa,'(dot dot)
09:37clojurebot(dot dot)
09:37Bronsauh
09:38philandstuff,(macroexpand '(.foo :fake-target))
09:38Bronsa,(macroexpand '(dot dot))
09:38clojurebot(. :fake-target ...)
09:38clojurebot(dot dot)
09:38philandstuff,(macroexpand '(.foo :fake-target bar baz))
09:38clojurebot(. :fake-target ...)
09:38philandstuff*shrug*
09:38Bronsaoh
09:38Bronsa,*print-length*
09:38clojurebot2
09:38Bronsathat's useless
09:38Bronsa,(set! *print-length* 10)
09:38clojurebot10
09:38philandstuff,(macroexpand '(.foo :fake-target))
09:38clojurebot(. :fake-target ...)
09:39Bronsa,*print-length*
09:39clojurebot2
09:39Bronsa:|
09:40Glenjamin,(binding [*print-length* 10] (macroexpand '(.foo :fake)))
09:40clojurebot(. :fake ...)
09:40Glenjamin:s
09:40mikerodBronsa: 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.
09:40Glenjamini assume (.method target) -> (. target method) is a reader thing, because i dunno what the macro would be called
09:41mikerodGlenjamin: it is a special form I am thinking.
09:41mikerodstatic final Symbol DOT = Symbol.intern(".");
09:41mikerodhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L51
09:42erlisneed 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
09:42BronsaGlenjamin: the transformation is hardcoded here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6567-L6578
09:42erlisis there a way to abort this execution?
09:43philandstuffcider-interrupt?
09:43erlisI don't want to kill the repl just abort the executing command
09:43philandstuffthat is, M-x cider-interrupt
09:43erlisphilandstuff let me try that
09:44erlisdid it, nothing happens
09:46erlisI think I'll kill it :(
09:46erlisis there a way to automatically load all files in my project in cider
09:47erliswithout having to C-c C-k file by file?
09:48Glenjamini usually have a scratch.clj which does (ns user (require [blah blah blah]))
09:50erlisI have in my .core file this (ns project.core (:require [path.module1 :as m1] [path.module2 :as m2]))
09:51erlisthe problem is that if I do C-c C-k in that file it will error complaining that module1 and module2 are not loaded
09:51erlisso I have to go to module1 file and to C-c C-k and also to module2
09:51erlisthen it works
09:51erlisbut imagine that now I'm having almost 7 files
09:51erlisthat's why I don't want to kill my REPL
09:52Glenjaminthats odd, if you eval that file i'd expect the ns form to require all the deps like it would normally
09:52Glenjamini don't use emacs, so can't advise more
09:53andyfBronsa: 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.
09:53andyfI'm probably doing something wrong, but thought I'd ask to see if you knew of any limitations there.
09:54erlisGlenjamin that's what I was hoping too
09:55Bronsaandyf: yeah tools.reader shouldn't leave out any metadata
09:55andyfBronsa: OK, I'll keep experimenting and open a case if I think I can narrow it down to tools.reader
10:05justin_smitherlis: any chance you put a - in the filenaes / path somewhere for module1 and module2?
10:06justin_smitherlis: 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:07justin_smithGlenjamin: 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:21erlisjustin_smith: no, I don't have any dash
10:21erlisbut I noticed that when I do cider-jack-in I got an error
10:21erlisI ignore it and everything works fine (that's what I think)
10:22justin_smith"an error"
10:22erlispp something
10:22erlistrying to reproduce it
10:23erlislol now it's not happening
10:23erlisbut check this is my header
10:23erlisor better said, my ns declaration
10:23erliscan I paste here?
10:24Bronsause a nopaste
10:24erlishow?
10:24clojurebotwith style and grace
10:24Bronsa~refheap
10:24clojurebothttps://www.refheap.com/
10:24Bronsaerlis: ^
10:25erlishttps://www.refheap.com/86554
10:25erlisthat's my ns declaration
10:26erlishttps://www.refheap.com/86556
10:26erliserror when I C-c C-k
10:27erlisyou can access this code here: www.github.com/erlis/4Clojure
10:27erlisI would like to C-c C-k in core.clj and done
10:31cbperlis: have you tried C-c C-k in elementary.clj?
10:31cbpMaybe there's an error there
10:31erliscbp: no, I do it in answers.core
10:32erlisthat's the file I open first
10:32erlisif I do C-c C-k in elementary then it will give me the error for answers.easy
10:32erlisand so on
10:33rurumate,(bean java.aws.Color/black)
10:33clojurebot#<CompilerException java.lang.ClassNotFoundException: java.aws.Color, compiling:(NO_SOURCE_PATH:0:0)>
10:33rurumate,(bean java.awt.Color/black)
10:33clojurebot#<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0:0)>
10:34scriptorf
10:34erliscbp: wait, I tried now and only gave me the error with elementary
10:34scriptorwhoops, sorry
10:35scriptoralso, apparently pimgus is spamming
10:35erliscbp: so I did C-c C-k in elementary and after that, the same in answers.core works
10:35erliswhat's weird is that if I do C-c C-k in elementary it will work fine, no error there
10:38justin_smitherlis: 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:38justin_smitherr, I mean (require '[answers.core :as core]) of course, don't mind my typo
10:39erlisgood idea let me try that
10:39gfrederickshas anybody installed cider 0.6.0 via the package repos? I tried yesterday and still got 0.5.0
10:39gfrederickswhy can't we just use maven for elisp packages
10:39justin_smitherlis: #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(answers/elementary.clj:142:13)> <- this is your problem
10:40justin_smithsorry, went ahead and did that myself :)
10:40justin_smiththe problem disappears, likely because some other ns requires clojure.set and makes it load properly
10:40erlisand it's working?
10:40justin_smithit's not working
10:40erlisit's working here too
10:40erlisno?
10:40clojurebotno is tufflax: there was a question somewhere in there, the answer
10:40erlislein repl works here
10:41justin_smithit fails because you use clojure.set without requiring it
10:41justin_smithlein repl works
10:41justin_smithbut note that error
10:41justin_smiththat ns does not load
10:41justin_smithin elementary.clj, you need to require clojure.set before you use it
10:41erliswow
10:41erlisif you go to elementary in emacs
10:42erlisand do C-c C-k it will work
10:42erlishow is that possible
10:42justin_smithcider probably requires clojure.set
10:42erlishmmm
10:42justin_smithclojure.set is loaded if any ns required it
10:42justin_smiththat is the problem with using fully qualified names
10:42erlishow did you get that error? using lein?
10:43justin_smithdon't do it
10:43justin_smithit disguises require errors
10:43justin_smithlein repl prints that error
10:43erlislein repl didn't print any for me, let me try again I would like to reproduce
10:43erlisso I learn for the next time
10:44justin_smithhttps://www.refheap.com/86558 what it looks like when I run lein repl in that repo
10:44erlishttps://www.refheap.com/86559
10:44erlisthis is mine
10:45erlis59
10:45erlis:)
10:45justin_smithalso, repl doesn't work that wway
10:45justin_smithyou need to require your code, in-ns just made the ns and did not load your ns from the file
10:46engblomBesides 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:47justin_smithengblom: using the pr version of vanilla datastructures and then loading with clojure.edn/read works
10:47justin_smithor you could use cheshire to emit json, if you care about other languages at all
10:48engblomjustin_smith: and what happens if the program/os/computer is crashing during a write? Or we are going multithreaded?
10:48justin_smitherlis: try doing lein do clean repl, it could be reusing a version that successfully compiled
10:48cbpengblom: then you need a full blown sql database..
10:48erlisI was able to reproduce it
10:49cbperlis: yay
10:49erlisI was doing lein repl outside answers folder
10:49justin_smithhah
10:49erlisthe code snipped you sent me help me with that
10:49justin_smithyeah, being in your project dir would help :)
10:49erliswow
10:49justin_smith(project dir being the one containing project.clj)
10:49erlisthanks justin
10:49justin_smithnp
10:49engblomcbp: Thanks. I had been hoping for something similar to # set PATH so it includes user's private bin if it exists
10:49engblomif [ -d "$HOME/bin" ] ; then
10:49engblom PATH="$HOME/bin:$PATH"
10:50engblomOoops. bad paste
10:50engblomhttp://hackage.haskell.org/package/acid-state <--- That was what I wanted to paste
10:52justin_smithengblom: 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:53justin_smithbut I would be surprised to se a pure clojure replacement for a db get much traction
10:53cbpthere's a reason we're on top of java :-P
10:53justin_smithnot because clojure would be a worse tool for the job than haskell imho, just that isn't the mainstream attitude in clojure circles
10:54cbpIn any case you can choose to use h2 or whatever
10:54engblomThat 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:55engblomBeing able to use the data structures directly as a persistent ACID storage would be nice
10:56justin_smithengblom: I mentioned datomic, that's what datomic does
10:57justin_smithwith a clojure / cascalog flavor
10:57justin_smith*datalog
10:57engblomjustin_smith: But unless I am wrong, it is not opensource and available for free.
10:57justin_smith(cascalog is a competing / less mature datalog in clojure)
10:57justin_smithengblom: you are correct
10:58rurumateless mature.. really? I've been using it a lot
10:58justin_smithengblom: we also have caribou.model, which helps make a database schema for storing clojurey stuff
10:58justin_smithbut it is not meant to be a transperent translation of arbitrary edn to sql
10:59justin_smithrurumate: cascalog? I was under the impression it was less developed than datomic, maybe I am off bas there.
10:59justin_smith*off base
10:59rurumateisn't datomic proprietary?
10:59mdrogalisIs Cascalog actually a datalog? I know it's written that is, but I think there're a few missing properties, like recursion.
11:00justin_smithahh so maybe it is immature :P
11:00rurumatemdrogalis: not sure what you mean. you can call any code within cascalog queries, and these in turn are allowed to recur, of course
11:00Glenjamini thought cascalog was a hadoop querying thing
11:00engblomCascalog seem to be opensource
11:00rurumateGlenjamin: exactly
11:01rurumatenot sure why it's compared to, or portrayed as less mature than datomic
11:01Glenjaminthe use-cases are entirely different afaik
11:01mdrogalisI guess you could always ask sritchie. *Cough*
11:01justin_smithrurumate: so is cascalog datalog, or was I just confused?
11:02rurumatewell I have not used datalog yet but afaik it should look familiar to datalog programmer
11:02sritchiehey, what up?
11:02sritchiejustin_smith: yeah, it’s totally different
11:03sritchiecascalog lets you use a subset of datalog to generate hadoop queries
11:03justin_smithtotally different from datalog that is?
11:03sritchieno, from datomic
11:03justin_smithahh ok
11:03sritchiethe use cases are totally different, I’d say
11:03rurumateone is a real time thing while the other is just a dsl that compiles to hadoop / cascading jobs
11:04mdrogalisThat being said, I've had success using both query constructs with data structures, and not their primary storage targets.
11:04mdrogalisSo thumbs up.
11:06rurumatethere are so many boring ways of doing java interop
11:07michaniskinrurumate: take the cure: https://github.com/tailrecursion/javastar
11:07rurumatethe sad thing is that it's not easy apparently to convert nested java bean-convention objects to a map
11:07michaniskinhahaha
11:07andyfBronsa: yep, I was messing something up. Not easy to get pprint to print all metadata, strangely.
11:08andyfBronsa: But it is easy to get it to pprint *some* but not all metadata on a form
11:09justin_smithrurumate: naive question, what about calling bean on the thing and selecting the keys you want?
11:10justin_smith,(bean "hello")
11:10clojurebot{:empty false, :class java.lang.String, ...}
11:10clgvmichaniskin: what a perversion :P
11:10Bronsaandyf: uh? *print-length* or something else?
11:10rurumatejustin_smith: hmm
11:10michaniskinclgv: it's not boring, at least
11:10rurumateand then write some breadh-first tree search thing
11:10andyfLet me find a short example
11:11rurumatebut general bfs won't work if I have to know what keys I want in each step
11:12rurumatejustin_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:12CookedGryphonhttps://github.com/clojure/java.data provides a better bean than the clojure.core one
11:13CookedGryphonas to-java, from-java, works recursively
11:13rurumateapparently passing the map is not easy, so I have to create a Conf* class & objects for each tree segmment
11:13justin_smithrurumate: maybe compose clojure.edn/read and cheshire/generate-string and then they can just use jackson on their end?
11:13justin_smithor is that not easy enough?
11:13rurumateI just want to convert that hideous structure back into a normal hashmap in one easy step
11:13justin_smithalso you could use jackson to get pojo from json reliably
11:14rurumatethe jackson approach is interesting
11:14justin_smithit is easy to get hashmaps from jackson, I did it recently actually
11:14rurumatebut that would be a heavy dependency
11:14rurumateespecially considering that I already use clojure.data.json
11:15justin_smithit's already a dep of cheshire if you use that
11:15justin_smithcheshire is better by far
11:15rurumatedefine better
11:16justin_smith static ObjectMapper json = new ObjectMapper(); Hashtable[] raw = json.readValue(in, Hashtable[].class);
11:16justin_smith
11:16justin_smithbetter = faster, easier to adapt to custom data types, more stable API across versions
11:16rurumatewell speed and custom datatypes are not an issue here
11:17justin_smithOK, 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:17rurumatehmm
11:17rurumateit was a pain to move from cheshire from data.json
11:18justin_smithI mean if you want, you can just turn the edn into Array and Hashtable instances etc.
11:18justin_smithyou should be able to walk a tree and do that
11:18justin_smithand the java coders should know what to do with those datatypes
11:18rurumatebut still. going through json, if all you want is to convert beans to maps, seems not ideal
11:19justin_smithOK - but I thought you didn't want to covnert beans to maps but rather an edn file to a map?
11:21justin_smithor 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:24andyfBronsa: https://gist.github.com/jafingerhut/4350299162411f738bce
11:24andyfShort answer: Not a problem with tools.reader that I can find
11:25andyfI only thought there was because pprint was showing me some metadata, but not all
11:25Bronsaandyf: weird behaviour by pprint there
11:26BronsaI wonder if that's intended or a bug
11:27clgvandyf: I ran into the same thing a while ago
11:34rurumatejustin_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:35justin_smithOK, got it
11:36justin_smithI guess -> beans -> jackson -> cheshire -> maps would work, but probably be a clumsy / heavy handed way to do it
11:36rurumateyes there got to be another way
11:37rurumateafterall clojure should be easy and fun, not clumsy and dull
11:37andyfBronsa, clgv: I will file a ticket categorized as a Defect, and others will decide whether it is intended or a bug
11:39rurumatethe 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:39clgvandyf: great *hoping-for-a-less-confusing-macro-debugging-future* ;)
11:40andyfI'll send you a link once written. I can include a temporary workaround function to use until Clojure is enhanced (if it is)
11:41justin_smith$doc tree-seq
11:41hyPiRion,1
11:41justin_smith,(doc tree-seq) maybe...
11:42clojurebot1
11:42clojurebot"([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:42justin_smiththere is also clojure.walk/*
11:43justin_smithoh, clojure.walk is only for native clojure datastructures I think
11:53sveri1hi there, does someone know how to integrate test.check with midje or if its possible at all?
11:57gfrederickssveri1: should be possible; at worst you can make your test call test.check/quick-check and make an assertion about the result
11:57gfredericksthis function can help: https://github.com/clojure/test.check/blob/master/src/main/clojure/clojure/test/check.clj#L29-32
12:03andyfBronsa, clgv: Vote early, vote often: http://dev.clojure.org/jira/browse/CLJ-1445
12:07sveri1gfredericks: thank you, looks a bit like a hack, but I gues sits ok
12:11gfrederickssveri1: that's essentially what test.check's adapter for clojure.test does
12:12sveri1As 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:14gfrederickssveri1: you should just include the logic for what you want to check for in your property
12:14gfredericksI don't quite understand what you were describing so I can't suggest the exact way to check for it
12:16sveri1gfredericks: 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:17reiddrapersveri1: 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:19sveri1reiddraper: true, checking the case is nice too :-)
12:20gfrederickssometimes it can be cleaner to generate the expected behavior check as well
12:22gfrederickse.g., you generate a pair [input output-pred] where the latter can somehow distinguish between throwing/returning
12:24justin_smithgfredericks: maybe (try (output-pred (test input)) (catch Throwable t (caught-pred t)))
12:24justin_smithcatching Throwable at runtime is bad, but for a test should be OK
12:25gfredericksI tend to use helper functions that wrap output to [:returned x] or [:threw e]
12:26gfredericks(defmacro catchingly [& body] `(try [:returned (do ~@body)] (catch Throwable t# [:threw t#])))
12:27justin_smithnice
12:30sveri1gfredericks: yea, that works :-)
12:34nathan7gfredericks: that feels like a primitive Either
12:36gfrederickssounds about right
12:36danneuI have a weak understanding of aot-compilation and what it entails. Why does the `compojure-app` template specify `:aot :all` in project.clj?
12:36andyfBronsa, 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:36technomancydanneu: that's not a good idea; it shouldn't do that.
12:37justin_smithdanneu: it means that every namespace should be recursively compiled to bytecode
12:37danneujustin_smith: right, i meant 'why would...'
12:37justin_smithmaybe the idea is in order to reduce boot time on deployment?
12:37gfredericksis there a lein plugin that creates shims for executable jars to avoid AOT?
12:37technomancygfredericks: yeah, see lein-otf
12:38technomancygfredericks: however, as of 2.4.0, uberjars have clojure.main as their main
12:38technomancyso you can just pass an -m arg to point it to your own ns
12:38technomancyerr--clojure.main as their main if they don't specify their own
12:39gfrederickstechnomancy: oh hey nice
12:40danneujustin_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:40justin_smithdanneu: well, aot is contagious I think
12:41justin_smithbut technomancy knows this stuff better than I do
12:41justin_smithalso aot does not mean that the code is done compiling, there is still the vm hotspot optimization that kicks in at runtime
12:41danneuright
12:43technomancy:aot :all is the same as :aot some-namespace.that-requires.all-others
12:45gfredericksthe namespace to require all other namespaces
12:47technomancyand in the darkness bind them?
12:48justin_smithwell, clearly, binding is done on a per namespace basis
12:48pjstadiggfredericks & technomancy: doesn't have quite the same ring
12:49pjstadigwhich wasn't an intended pun at first, but I'll go with it
12:49technomancynice
12:50gfrederickstechnomancy: yes, via the namespace monad presumably
12:50gfredericksIf you don't realize that X is a monad you aren't thinking hard enough.
12:51pjstadigthinking of monads is the thinking of monads monad
12:51nullptrpjstadig: maybe...
12:51justin_smithturning things into jokes via self reference is the nerd humor monad
12:53pjstadigjustin_smith: a corrolary to that is that computer science is a sub-field of mathematics, because mathematicians have the same humor schemata
12:53gfredericksmonads are the borderline-useful-abstraction monad
12:53pjstadiger corollary
12:53pjstadighttp://j.mp/ruined-joke
12:53gfrederickssppeling
12:54justin_smithwow, that tweet is from two years ago, you're psychic
12:54gfrederickspjstadig: I like the implication that jokes are written
12:55gfredericksI guess that's pretty normal though, even among the regular folks
12:55gfrederickswith the snapchats and the hipstagrams
12:57pjstadigjustin_smith: either psychic or i just save it around and use it often, which tells you something about my spelling abilities
12:58gfrederickspjstadig: or maybe it's that spelling & joking contend for the same resources
12:59gfredericksthat hypothesis has the benefit of explaining well-spelled-but-unfunny jokes
13:00justin_smithfunny, correctly delivered, well timed: pick 2
13:00pjstadiggfredericks: this is a fruitful area for research, you should apply for a grant
13:01gfredericksA) Both B and C; B) B; C) none of the above;; pick 2
13:02justin_smithhttp://en.wikipedia.org/wiki/List_of_people_who_have_been_pied
13:03technomancyjustin_smith: even includes missed pies
13:04gfrederickstechnically any thrown pie misses almost everybody
13:04gfredericksyou could also include pies that were accidentally not thrown
13:05gfrederickshttp://en.wikipedia.org/wiki/List_of_people_who_could_have_been_pied
13:06technomancyredirects to http://en.wikipedia.org/wiki/List_of_people
13:06gfredericksomg 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:06pjstadigthis Les Entartistes is a prolific pieing perpetrator
13:06justin_smithI remember finding that, ages ago
13:06technomancyhttps://en.wikipedia.org/wiki/List_of_people_who_have_declined_a_British_honour
13:07justin_smithgfredericks: this one got deleted: http://en.wikipedia.org/wiki/List_of_lists_of_lists_of_lists
13:07gfredericksrepeatedly, apparently
13:08gfrederickssome of the lists of lists linked to appear to just be single pages with sections
13:08pjstadighttp://en.wikipedia.org/wiki/List_of_lists_not_on_Wikipedia_lists
13:09arrdemcomplement set of of the set of lists :P
13:09gfrederickswhy did I start this nonexisting wikipedia page joke
13:09justin_smith,(repeatedly 3 #(list (list (list) (list) (list)) (list (list) (list)) (list (list)) (list)))
13:09clojurebot(((() () ...) (() ()) ...) ((() () ...) (() ()) ...) ...)
13:10justin_smithpjstadig: Russel had something to say about that one
13:10pjstadighttp://toolserver.org/~dispenser/cgi-bin/rdcheck.py?page=Russell%27s_paradox
13:10gfredericks,((fn f [x] (->> (repeatedly rand) (take-while #(< % x)) (map f))) 0.93)
13:10clojurebot(() ((() ())) ...)
13:11justin_smithgfredericks: much more elegant, though I was going for semantic overload on the token "list"
13:22technomancyhttp://blog.jorgenschaefer.de/2014/06/the-sorry-state-of-emacs-lisp-package.html somewhat relevant to some
13:24TimMcgfredericks: I'm partial to https://en.wikipedia.org/wiki/Lists_of_pairs
13:25TimMcI want to put a disambiguation hatnote at the top saying "Also see: [[association list]]"
13:25technomancyhttps://en.wikipedia.org/wiki/List_of_married_couples_among_space_travelers
13:26TimMc:-D
13:26technomancy"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:26TimMcI guess the splitters are winning.
13:27hiredmanif you want to call that winning
13:27justin_smithtechnomancy: fix for the the Melpa version number problem: start all your package numbers with Inf
13:28hyPiRionI expected a section named "In Fiction", but alas
13:29justin_smithor actually, maybe just ZZZZZz
13:29TimMcThis always reminds me of https://en.wikipedia.org/wiki/Celestial_Emporium_of_Benevolent_Knowledge
13:31justin_smiththat list is classic
13:31dbaschtechnomancy: the nice thing about Borges is that all his stories are short and pack a punch
13:31TimMctechnomancy: May I also recommend the webcomic The Secret Knots.
13:32TimMcAnything after 2006 (during which the author seems to have been finding his rhythm.)
13:32dbaschtechnomancy: I know you’ve read some Borges when your projects have names like Tlön or Uqbar :P
13:32technomancydbasch: \m/
13:32TimMcMany of the comics (such as the latest one) seem a bit Borges...ian.
13:33dbaschtechnomancy: http://en.wikipedia.org/wiki/Uqbar
13:33technomancynice; metafictional
13:33dbaschvery lispy
13:33dbaschthat is just begging for some software to be named after it
13:34PigDudedoes eastwood always report functions with arities [foo & bar] as misused when called as (f v), omitting the optional "bar"?
13:34justin_smithmock object of some type?
13:34TimMcSantapau uses story-within-a-story for a lot of his comics.
13:34PigDudeseems like a bug
13:35stephenjudkinsi'm confused about how anonymous functions and -> interact
13:35stephenjudkinswhy does this work:
13:35stephenjudkins' (map #(+ 1 %) [1 2 3])
13:35stephenjudkins, (map #(+ 1 %) [1 2 3])
13:35clojurebot(2 3 ...)
13:36stephenjudkinsand this work:
13:36justin_smithstephenjudkins: macroexpand helps a lot when figuring out ->
13:36dbaschstephenjudkins: that is basically the same as (map inc [1 2 3])
13:36stephenjudkins, (map #(-> (+ (+ 1 %) 5)) [1 2 3])
13:36clojurebot(4 2 ...)
13:36stephenjudkinswhile this does not:
13:36stephenjudkins, (map #(-> + 1 %) [1 2 3])
13:36clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:37justin_smith,(macroexpand '(map #(-> + 1 %) [1 2 3]))
13:37clojurebot(map (fn* [p1__106#] ...) ...)
13:37technomancywhen in doubt, macroexpand
13:37dbaschstephenjudkins: that inserts the vector between + and 1
13:37justin_smith,(macroexpand '#(-> + 1 %))
13:37clojurebot(fn* [p1__131#] ...)
13:37dbaschsorry, not the vector
13:38justin_smiththat's some pretty agressive truncation there...
13:38stephenjudkinsjustin_smith: yeah, it's unfortunate. thankfully i'm just copypastaing to my own repl :)
13:38dbaschthat tries to do things to +
13:39justin_smithit tries to call 1 with + as an argument
13:40justin_smith,(macroexpand '(-> + 1)) embedded in that output
13:40clojurebot(1 +)
13:40TimMc,*print-length*
13:40clojurebot2
13:40TimMcThat's absurd.
13:41justin_smithindeed it is
13:41PigDude,(-> + (partial #(partial % 1)) 3)
13:41TimMchiredman: I think clojurebot's *print-length* of 2 is a bit short...
13:41clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:41hiredmanit is, that doesn't seem right
13:41TimMc,[[[[[[[[]]]]]]]]
13:41clojurebot[[[[[[[#]]]]]]]
13:41TimMcMaybe length and depth are reversed?
13:42justin_smithalright who flipped printing on its side again?
13:42PigDudestephenjudkins: when you do -> +, like dbasch said, you're operating on the plus function
13:42PigDude,((-> + (partial 1)) 4)
13:42clojurebot2
13:43PigDudewell no, that's 5, but thanks clojurebot
13:43hiredmanI suspect someone monkeying with the sandbox
13:43dbasch,(-> + type)
13:43clojurebotclojure.core$_PLUS_
13:43justin_smith,(range 10)
13:43clojureboteval service is offline
13:43hiredman,(+ 1 2)
13:43clojurebot3
13:43hiredman,5
13:43clojurebot5
13:44metellus,4
13:44clojurebot4
13:44hiredmansometimes I wonder why I bother
13:44justin_smith,(range 10)
13:44clojurebot(0 1 2 3 4 ...)
13:50stephenjudkinsi don't yet fully understand what's going on
13:51stephenjudkinsbut thanks for your help. macroexpand will be very useful to me in the future
13:52justin_smithstephenjudkins: clojurebot got in a weird state
13:53arrdem,4
13:53clojureboteval service is offline
13:53arrdemwell at least 3 isn't 4 right now..
13:53dbaschstephenjudkins: -> x a b c is the same as (c (b (a x)))
13:54dbasch(-> x a b c) that is
13:58gfredericks&(macroexpand-1 '(-> x (a b) c (d e f)))
13:58lazybot⇒ (clojure.core/-> (clojure.core/-> x (a b)) c (d e f))
13:58gfredericks&*clojure-version*
13:58lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
13:58gfredericks&(alter-var-root #'*clojure-version* assoc :minor 6)
13:58lazybotjava.lang.SecurityException: You tripped the alarm! alter-var-root is bad!
14:03gfredericksclojurebot: You |tripped| the alarm! alter-var-root is bad!
14:03clojurebotYou don't have to tell me twice.
14:18llasramclojurebot: You?
14:18clojurebotYou tripped the alarm!
14:19llasramInfinite amusement
14:19squidzDoes anybody know how to tell cljsbuild to recompile clojurescript when a given file/directory changes?
14:19squidzI want to recompile when some javascript that is included in my project changes
14:20justin_smithlein cljsbuild auto
14:20justin_smithI like "nohup lein cljsbould auto" in order to leave it running without wasting a window on it
14:20squidzjustin_smith: that recompiles when clojurescript files change, but how do I tell it to recompile when non-clojurescript files change?
14:23squidzjustin_smith: do you know what I mean?
14:23justin_smithI do, but I'm not sure how to do that
14:23justin_smithI 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:24squidzhm okay does anybody have an idea
14:28prachetaspanyone done any sentiment analysis in java/clojure that can recommend a library?
14:32squidzjustin_smith: okay, I have to use :libs in the cljsbuild settings. All changes in the directories listed in :libs will recompile on change
14:33justin_smithoh, nice
14:33justin_smithI expected something like that, but have only done a little cljs so I didn't know the details
14:33igorhi everybody
14:33igormay be someone could help me
14:34igorI'm trying to understand how I use emacs/cider to develop a compojure/ring-based program
14:34igorI understand perfectly that I can change files of the project
14:35justin_smithOK
14:35igorand the program will automatically reload them (like django etc)
14:35igorbut I can't understand
14:35technomancyigor: it's simpler if you just recompile on save from cider
14:35technomancyyou can use a hook if you like
14:35igorhow I can attach directly to the running process
14:35aaelonyprachetasp: I haven't read it yet, but have you seen http://www.packtpub.com/mastering-clojure-data-analysis/book#chapter_6
14:35justin_smithigor: 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:35igorfor example, I would like to
14:36igorwrite something, then press c-c c-c and have it in my process
14:36justin_smithigor: https://github.com/clojure/tools.nrepl it shows how to start a repl from inside your code
14:36justin_smiththen, in emacs, M-x cider prompts for a port to connect to, tell it the port your app is serving
14:37technomancyigor: you just need the HTTP server launched from the same process as the repl.
14:37justin_smithtechnomancy: well, there is that too
14:37technomancyyou can embed nrepl in your program, or you can launch your HTTP server from cider
14:37igorjustin, thank you, that means that I must embed repl to my process
14:37igorthen start the process
14:37igorthen attach to it
14:37igorright?
14:37justin_smithor, as technomancy mentions, you can start the process from inside a repl, one or the other
14:37technomancyigor: that's one option, but you don't need to do that; you can just kick off jetty from cider
14:38justin_smithI find embedding the repl in the process handier (lets me debug uberjars etc.)
14:38technomancyit's nicer for production
14:38igorok, thank you guys, I will repeat it that to be sure that I understand the things right
14:38igorSo
14:38igorI have two options
14:38igor1) embed repl into process
14:38technomancybut it's a bit more setup up-front
14:38igor2) start jetty from cider directly
14:38igorright?
14:38technomancyyeah
14:38justin_smithright
14:39igorok, so and then what option is better for me, depends on the situation
14:39justin_smithtechnomancy: 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:39igorfor example, if I'm developing a production server
14:39igorthat first option is better
14:40igorif I just try to write some small peace of code from scratch
14:40igorit's better to start with cider and run jetty in it
14:40justin_smithsounds about right, yeah
14:41igorOk, 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:41technomancyjustin_smith: true.
14:41justin_smithwell, not no disadvantages
14:41technomancyigor: you get a few conveniences from leiningen launching the repl
14:41justin_smithbut I find it more convenient
14:42justin_smithunless you are going to restart jetty frequently - then starting jetty from a repl is convenient
14:42igorIn what case do I need to restart jetty?
14:42technomancyjustin_smith: do you still use jack-in then?
14:42igorI can change by functions without restarting it, right?
14:42justin_smithno, not jack-in
14:43justin_smithI am still on nrepl, I run "M-x nrepl" instead of "M-x nrepl-jack-in"
14:43justin_smithigor: right, just make sure you give ring your #'handler instead of handler, so it knows to update when the var changes
14:44justin_smiththen, if you rebind some middleware, you may need to redefine the handler, but it will all just work
14:44justin_smithbut otherwise, yeah, redefine a function and its just using the new function, pretty straightforward
14:45igorok
14:45igorthank you very much guys
14:45igorI will try these two methods
14:45technomancyI guess that's the main downside; I'm used to just jacking in and running from there.
14:45tjdis 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:46justin_smithtechnomancy: 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:46technomancyjustin_smith: how is that different from checking *nrpl-server*
14:47justin_smithtechnomancy: 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_alejand1otjd: It's not uncommon to put `!` at the end of an impure function name
14:47justin_smithbut yeah, I could check *nrepl-server* and that would probably work
14:48_alejand1otjd: although, I usually only do it for lower level functions, and not for other functions that depend on impure functions
14:48hiredmanor, you know, configuring logging to log to a file at dev time
14:48justin_smith_alejand1o: but that function doesn't mutate, it just observes state
14:48_alejand1ojustin_smith: yeah, that's a fair point. not sure of a convention then
14:48tjdit's almost like a (deref ...), except the remote resource doesn't have any concurrency semantics to speak of
14:49amalloytjd: there is no such convention
14:49technomancyjustin_smith: pretty sure there's no difference as far as output goes
14:51justin_smithyeah. 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:53gfredericksthinking about making a special kind of var that prints as: #_"helpful info" #"var/name
14:54amalloygfredericks: var is final, so...?
14:54gfredericksI've never seen anybody use #_ to add messages-for-humans to readable things
14:54gfredericksamalloy: clojure.core/type
14:54arrdem,(read-string "#_\"foo\" #'clojure.core/conj")
14:54clojureboteval service is offline
14:55gfredericks#'var/name is what I meant above of course
14:55amalloyso? it still has to be a Var object to live in a namespace, no?
14:55arrdem##(read-string "#_\"foo\" #'clojure.core/conj")
14:55lazybot⇒ (var clojure.core/conj)
14:55arrdemhum... interesting
14:55gfredericksamalloy: yeah I didn't mean a different class
14:55amalloyof course you can build an object that prints that way, but it can't be a var
14:55gfredericksjust different print-method behavior
14:55gfrederickssure it can
14:57amalloyoh, i see
14:58amalloyi didn't get what you meant about c.c/type
14:58gfredericksyeah am be confuse today
15:05cbphmm I could swear there was a forv function
15:05cbpmarco*
15:06johnwalkerwhats forv?
15:06cbplike (into [] (for..))
15:06SegFaultAXPresumably a strict variant of for that yields a vector instead of a list.
15:06clojurebotexcusez-moi
15:06SegFaultAXIs that in c.c?
15:06johnwalkerahh
15:07cbpit's not in core. I thought it was
15:08SegFaultAXcbp: Phew, I thought I had just been mentally ignoring it for the last 2 years. :)
15:09cbpI thought it got added along with mapv :-P
15:12gfredericks&'#'#'#'#'#'#'foo
15:12lazybot⇒ (var (var (var (var (var (var foo))))))
15:13llasramgfredericks: Ha! Reader macros
15:13gfredericksreader macros make a great party joke
15:14llasramOr even a great party game. Try reader macros instead of "Apples to Apples" at your next party!
15:15gfredericks&(read-string (str (apply str (repeatedly 10 #(rand-nth ["#'" "@" "'"]))) "foo"))
15:15lazybot⇒ (quote (clojure.core/deref (clojure.core/deref (quote (var (clojure.core/deref (quote (var (var (quote foo))))))))))
15:15justin_smithor the adult alternative, "quotation rules against sanity"
15:15llasramnice
15:15gfredericks&(read-string (str (apply str (repeatedly 10 #(rand-nth ["#'" "@" "'" "~"]))) "foo"))
15:15lazybot⇒ (var (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref (var (clojure.core/unquote (var (quote (quote foo)))))))))
15:21gfredericks(require '[clojure.walk :as clojure.core]) ;; <- don't do that
15:31TimMc:-D
15:32cbpNo such var: clojure.core/fn
15:33TimMc(require '[clojure.walk :as clojure.lang.RT])
15:33cbpheh i cant go back to the ns i did that
15:34justin_smithcbp: well a restart would clearly fix it, but maybe ns-unmap would do the trick?
15:35cbpjustin_smith: probably remove-ns
15:36justin_smithcbp: I was thinking some combination of ns-publics on clojure.walk with ns-unmap on the contaminated ns
15:37prachetaspaaelony: did see that - working my way through the clojure data analysis cookbook first actually
15:38stephenjudkinsin `fn` or `defn` it's possible to do multiple statements before the final expression that returns
15:40stephenjudkinsis it possible to this with an anonymous expression?
15:41stephenjudkinsi'm doing an if, and i'd like put a debug statement in one of the legs
15:41justin_smithstephenjudkins: yes, with do
15:41cbpstephenjudkins: #(do..)
15:41cbpjustin_smith: damn it
15:41justin_smithbut if it is long enough for do, you would probably want to use fn anyway
15:41stephenjudkinsjustin_smith, cbp : thanks
15:41stephenjudkinsyes, i was debugging by doing that
15:41stephenjudkinsbut `do` seems like a quicker solution
15:42cbpstephenjudkins: debugging? :-P
15:43stephenjudkinscbp: trying to write pure functional stuff, but throwing in some prints to see what's going on
15:43cbpstephenjudkins: doto might be better
15:43cbp,(doto 1 (print))
15:43clojurebot11
15:44stephenjudkinscbp: that is nice
15:45devnxeqi: 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:45devnderp, redundancy department of redundancy
15:46dbaschquick 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:46dbaschlist here: http://pastebin.com/z4BKLUwy
15:47devndbasch: i dont totally follow
15:47stephenjudkinscbp: (doto ... (print)) is a lot like haskell's debug.trace
15:47dbaschdevn: hun-arg is not a valid word, for example
15:47dbaschwithout the dash of course
15:47devnoh, so the cartesian product of that list
15:48devnand then check against a dictionary
15:48dbaschI was a bit disappointed by the results
15:49dbaschdevn: https://www.refheap.com/86565
15:49dbaschdevn: oops https://www.refheap.com/86566
15:52devndbasch: can they be in any order?
15:52devnand can you use the same thing twice?
15:52devnlike MEXMEX
15:53llasram"And the final match of the World Cup will be -- Mexico versus Mexico!"
15:54johnwalkerllasram: who will win?
15:54llasramThat's the great thing about sports -- you never know what will happen
15:54technomancyone team will probably score more points than the other
15:55technomancythat's what usually happens
15:55AimHereNot in football
15:55devnsportsball
15:55AimHereI think 0-0 is about the second or third most likely scoreline
15:55borkdudeI 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:55johnwalkeroh my _god_
15:55johnwalkera new quil release
15:55johnwalkerand clojurescript quil is a thing
15:55dbasch(inc llasram)
15:56devnbasketsball, feetball, basesball -- they make /baskets/, there is more than one base, and there are many feet involved
15:56llasramborkdude: The dynamic value of *ns* is clojure.core except when loading is actually happening
15:56dbaschchichi is actually a word
15:56devnscrabble knows!
15:57llasramborkdude: Which has tripped me up before, but makes sense when you squint at it
15:57nbeloglazovjohnwalker: yep! alpha version of cljs support will be available soon
15:58borkdudellasram I am trying to do (source-fn 'alert) in a listener, so the source of the alert function from seesaw.core is shown
15:58borkdudellasram seesaw tutorial
15:58gfrederickslein-release causes me to release things like every other commit
15:58gfredericksit's just too easy
15:58johnwalker,(inc nbeloglazov)
15:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: nbeloglazov in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:58technomancygfredericks: addictive, innit
16:00johnwalkerwhatever, i'll figure it out later. thanks for your work on quil
16:00johnwalkeri've wanted that for a long time
16:00johnwalkerthe functional mode also looks like
16:01technomancyquil's has a non-imperative mode?
16:01johnwalkerit's new, you should check it out
16:01johnwalkerhttps://github.com/quil/quil/wiki/Functional-mode-%28fun-mode%29
16:01nbeloglazovtechnomancy: 'draw' is still imperative. But other functions can be pure. As well as 'update' function was added.
16:02technomancyyay!
16:02borkdudefully qualifying the symbol worked
16:04technomancyheh, 2+ years between opening and closing https://github.com/quil/quil/pull/19 but it looks like it was worth the wait =)
16:05nbeloglazovtechnomancy: yes, the pull request was very useful :)
16:12TimMctechnomancy: 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:13TimMcThat and it should also update my changelog for me. :-P
16:13nDuffHuh. Last time I looked at lein-release it was missing something critical
16:13nDuff...jar-signing, maybe?
16:14TimMcThat too, maybe.
16:17nkozoI'm having a very weird problem when getting var metadata
16:17llasram(inc hugod)
16:17llasramWell, that not-actually-happening karma is for Alembic
16:18justin_smithnkozo: what's a weird problem?
16:18llasramI 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:18nkozo(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:19justin_smithnkozo: that def inside the let should be replacing the metadata on the previous def
16:20nkozojustin_smith: I thought it was only a lookup, like resolve
16:20justin_smithdef is always namespace scope, it's replacing what existed before
16:20technomancynDuff: is this the lein-release plugin or the new release task in lein 2.4?
16:20technomancyit signs jars now
16:20nDuffI was referring to the plugin.
16:21nDuffre: having a task built in now... shiny!
16:21technomancyTimMc: as for version-awareness, do you know about pom.properties?
16:21justin_smithnkozo: oh, ok, def without an arg will not clobber, you are right
16:21nkozojustin_smith, but the var's value doesn't change, only his metadata.
16:22technomancynDuff: yeah, it's a lot more flexible now
16:22justin_smithnkozo: so it seems def removes metadata, even when called with no args
16:22technomancybasically just a user-overridable chain of tasks to cut a release
16:22justin_smithit is not just a lookup
16:23nkozoso the question is, removing metadata is a feature or a bug? :)
16:23justin_smithnkozo: to me, for def to be called twice on the same var is a sign something is wrong
16:23llasramditto
16:23justin_smithmore "don't do that then"
16:23nkozojustin_smith: is a simple case, check (source defmulti), it does the same thing to lookup the var
16:24llasramAnd causes all sorts of problems in the process
16:24justin_smithnkozo: it checks if it is bound before calling def
16:25justin_smithoh, wait, I am wrong
16:25justin_smithit uses def in the let
16:26nkozoyes, it tries to do nothing if the var already has a multifn
16:26justin_smithright, but it calls def before that
16:26nkozobut seeing this def behaviour, the multifn var metadata will be destroyed in that check
16:26justin_smiththus removing metadata, if there was any
16:26justin_smithright
16:26nkozoseems like a bug to me
16:27justin_smithwhy not use resolve to look up the var?
16:27nkozobecause resolve doesn't work in my more-complex case
16:28nkozobut I need to re-evaluate it
16:28TimMctechnomancy: I know about pom.properties, but that's not available with lein repl.
16:29technomancyTimMc: right, which is dumb.
16:29technomancywe should make the same thing work everywhere
16:29TimMcI once tried cobbling something together that could read from project.clj or pom.properties or... Yeah.
16:29arohnerI'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:29TimMcUnfortunately, I don't have any suggestions on what to change.
16:30technomancyTimMc: what about writing pom.properties to target/classes?
16:32llasramarohner: The `eldoc` minor mode is what handles that
16:32llasramWait
16:32llasramI lied
16:32llasramOr at least you need more than to just turn it on :-)
16:33arohnerllasram: good, because I have 'cider-turn-on-eldoc-mode
16:33llasramhaha
16:34llasramUgh, well, I'm running an old version of CIDER (without that function), so am afraid I'm not able to help
16:36arohnerllasram: ah, figured it out. I misspelled the hook name when converting my config file
16:36arohnerI should have just thrown out my nrepl config and started over
16:44TimMctechnomancy: Something like that, yeah!
16:45TimMctechnomancy: 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:45technomancyTimMc: I'll see if I can get it into 2.4.1
16:45TimMcwoot
16:56nkozojustin_smith: just for the record, I reported the (def v) bug at http://dev.clojure.org/jira/browse/CLJ-1446
16:59justin_smithOK
17:07pjstadignkozo: the same problem would occur with defonce
17:10nkozopjstadig: defonce macroexpand to a def, but you can use it to resolve the var in the let step of the test case
17:18nkozopjstadig: note, there was a similar case reported for defonce: http://dev.clojure.org/jira/browse/CLJ-1148
17:37seancorfieldIn 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:38hiredmanseancorfield: if you were to use algo.monads you could do the same as in scala
17:38seancorfieldYeah, I was hoping for something idiomatic in the core tho'...
17:38gfredericksdoes algo.monads have a for-like macro helper?
17:39hiredmanseancorfield: funny because you have the last commit to master in the algo.monads repo
17:39seancorfieldonly because i updated the pom or the contributing file :)
17:39seancorfieldI have the last commit on quite a few contrib libs because of that...
17:39hiredmangfredericks: it has some kind of notation
17:40justin_smithseancorfield: not nearly as elegant, but the semantics work (defn combine-if [a b] (if-let [ab (remove nil? [a b])] (apply + ab)))
17:40seancorfieldbackground: this came up because of a discussion about Java 8 which adds an Optional<T> type with map and flatMap functions
17:40justin_smithwell with + we don't even need the if-let actually
17:40hfaafbclojure? i 'ardly know her!
17:41justin_smith(defn combine-if [a b] (apply + (remove nil? [a b])))
17:41whodidthishow do i "\"cools\"" -> "cools"
17:41seancorfieldso you can write: Optional<Integer> a= f(); Optional<Integer> b = g(); Optional<Integer> c = a.flatMap( x -> b.map( y -> x + y ) );
17:42gfrederickshttps://www.refheap.com/86569 ;; <-- forsome
17:42seancorfieldjustin_smith: that's quite nice... and rewritten as (->> [(f) (g)] (remove nil?) (apply +)) looks fairly clean (to me)
17:43gfredericksjustin_smith: seancorfield: doesn't work if you want nil when any input is nil
17:43seancorfieldah, good point gfredericks
17:43justin_smithgfredericks: true, it gives you the additive identity instead
17:43gfredericksjustin_smith: also if just one is nil it gives you the other one
17:43gfredericksit's the shrug monad
17:44justin_smithheh
17:44justin_smiththat part was intentional (even if wrong)
17:44gfredericksafter using test.check I'm a fan of the for syntax for monadic things
17:45gfredericksforsome is missing the :let feature
17:45gfredericksI don't think :when applies
17:45seancorfieldgfredericks: that macro is what i'm looking for... pity there's nothing in core like that :)
17:46gfredericksanother problem quasisolved with macros!
17:46seancorfieldand, 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:49seancorfieldit's a pity when-let doesn't accept multiple bindings and test each for truthiness... (when-let [a (f) b (g)] (+ a b))
17:49arrdemseancorfield: when-let+ :P
17:49seancorfield:)
17:50hiredmanit is there, in algo.monads
17:50hiredmanexactly that
17:51hiredmanthat is literal what domonad does with the maybe monad
17:57seancorfieldyeah... maybe I'll break down and use monads :)
17:57seancorfield(domonad maybe-m [a (f) b (g)] (+ a b))
18:17allenj12when 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:18nDuffallenj12, the names map directly, no changes.
18:19allenj12nDuff: interesting, goog.require cant seem to find the namespace then.
18:19allenj12nDuff: thanks
18:22mi6x3mhey clojure, is support-forward-navigation? a good function name
18:22mi6x3mI can't decide on a name
18:25justin_smithmi6x3m: are you checking whether you should support forward nav, or whether something else should?
18:25justin_smithor does?
18:25mi6x3mjustin_smith: I check whether a component supports it
18:26justin_smithi'd say supports-forward-nav
18:26justin_smithI think nav there is unambiguous
18:26justin_smitheven supports-fwd-nav maybe (that could be going to far)
18:26arrdemI agree with "supports" rather than "support"
18:26arrdemjust sounds awkward otherwise
18:27mi6x3msupports-forward-nav it is :)
18:27justin_smithsupport- indicates to me that it is a request, and we are checking if the request asks us to support that thing
18:27mi6x3mok, 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:28justin_smithcallback-js, to me, sounds like the name for a function that would execute javascript's callback (or cause it to be executed)
18:29justin_smithmaybe install-js-callback! ?
18:29mi6x3myeah, good plan
18:48allenj12has 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:49toxmeisterallenj12: yes, that will go away if you upgrade you cljs to the branch using clj 1.6...
18:49toxmeisterallenj12: it's because cljs already defined that fn earlier than clojure did (only was added w/ 1.6.0)
18:51toxmeisterallenj12: 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:51allenj12toxmeister: seems like they just updated cljs
18:52toxmeisterthat 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:53toxmeisternow that CLJ has that fn already, it can be removed from CLJS
18:55toxmeisterallenj12: http://dev.clojure.org/jira/browse/CLJS-514
18:55allenj12toxmeister: i updated cljs and dont get that error anymore.. it seems to have been changend in the last few days
18:57toxmeisterallenj12: which cljs rev are you on? must be on the 1.6 branch too then…
18:57allenj12"0.0-2234"
18:59toxmeisterallenj12: am using self built 2246 - the official ticket for this is still open though (http://dev.clojure.org/jira/browse/CLJS-769)
18:59allenj12toxmeister: i wonder why my problem went away then
19:02toxmeisterallenj12: because of this maybe? https://github.com/clojure/clojurescript/commit/f3e571136d741eb22d0df31f212beb036cae78b7#diff-b64165608bed8fb21a132890b4e2fca2R30
19:03devn_ato: technomancy: xeqi: new clojars logo! https://github.com/devn/clojars-web/commit/aced5706430bd54fcdb2ee97fdb48e2450e731b5
19:03allenj12devn: i like it
19:03allenj12toxmeister: hmmm
19:04TEttingerha! that's clever, devn
19:04arrdemdevn: cheeeeese
19:04TEttinger(inc devn)
19:04TEttingerlazybot died
19:04devnit looks better on the purple background
19:04technomancydevn: science!
19:04devnhuzzah!
19:05technomancy<3
19:06arrdemso. much. purple!
19:06allenj12(inc devn)
19:06devntechnomancy: 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:06technomancyindeed
19:07devngotta run. cheers!
19:09mi6x3mis it possible reify doesn't see the methods of an inner interface?
19:09mi6x3mfor this interface http://djproject.sourceforge.net/ns/documentation/javadoc/index.html I get "Can't define method not in interfaces: createWebBrowserDecorator
19:09mi6x3mthe interface is JWebBrowser.WebBrowserDecoratorFactory, sorry
19:10technomancyTimMc: https://github.com/technomancy/leiningen/commit/12ec7b92002995b92f3f02c0317728d9c34c3c09
19:10technomancythoughts?
19:12hiredmanmi6x3m: there is no such thing as an inner interface
19:12mi6x3myeah, I used a false term, but it's not a solution to the problem I guess
19:12mi6x3msomehow the method isn't visible
19:13mi6x3mworks if I use proxy
19:14toxmeistermi6x3m: how are you referring to this interface? Inner classes need to use `$` instead of `.` as separator
19:15mi6x3mtoxmeister: (reify JWebBrowser$WebBrowserDecoratorFactory []
19:15mi6x3m (createWebBrowserDecorator [target component] (f target component)))
19:15mi6x3mwithout the [] after Factory, this is from the proxy test
19:16toxmeistermi6x3m: hmmm… dunno then...
19:17allenj12toxmeister: o wow i just got that warning again randomly, o well.
19:18toxmeisterallenj12: probably didn't use lein cljsbuild clean before then...
19:20amalloy(inc devn)
19:20lazybot⇒ 20
19:20amalloy(inc devn)
19:20lazybot⇒ 21
19:20amalloyi understand lazybot dropped these
19:24arrdem(inc devn)
19:24lazybot⇒ 22
19:29xeqiis there a function that will return all possible interleavings of a list of lists?
19:31xeqiie: [[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:32amalloycertainly there's nothing built in, but i don't think it's too difficult to write
19:34amalloyxeqi: in fact, i think it's just all permutations of (apply concat lists), right? so you can just grab permutations from contrib.combinatorics
19:34justin_smithxeqi: maybe with clojure.math.combinatorics/combinations ? https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L88
19:34amalloynah, has to be permutations, not combinations. but that's on the right track
19:36justin_smithxeqi: is there some pattern bhind the fact that orders starting from 2 or 4 are missing in your example?
19:36amalloyoh, right. yeah, i'm so wrong. permutations is no good
19:37xeqijustin_smith: ah, meant the final lists kept ordering from the originals
19:37TimMctechnomancy: 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:38xeqiso in that example, 1 must occur before 2, 3 before 4
19:38allenj12so i tried :optimizations :advanced and now it says goog is not defined and i cant go back lol
19:38technomancyTimMc: correcto
19:39technomancylein run, lein repl, lein swankety, whatever
19:39TimMcThen awesome.
19:39TimMcI'll see if I can test this out tonight.
19:39technomancyit's implemented as a :prep-task, similar to how javac and compile run before any in-project code
19:39technomancythat would be great
19:39xeqijustin_smith: so combinations might work, thanks
19:39technomancywould like to cut a release over the weekend
19:40technomancybit later than I told gfredericks but hopefully not too bad
19:40xeqiah, not quite
19:40TimMcIs that on master?
19:40justin_smithat the very least the tactics used in c.m.c should be applicable
19:40technomancyTimMc: yeah
19:40justin_smitheven if none of those functions do it quite right
19:40xeqiyep, thanks for the pointer
19:40TimMcCool, I'll see if I can test it on the train home, then.
19:41amalloyxeqi: https://www.refheap.com/09e3d1c185f2ea905b814531d
19:42amalloyeasier to do by hand than with combinations, i think
19:42amalloyi even happen to produce answers in the same order as you did
19:50amalloyout of curiosity, xeqi, what do you need to know possible interleavings for?
19:53sritchieseancorfield: saw that you discovered the maybe monad earlier :)
19:56zimri-limre: Ring, what is a 'legacy servlet container'. Is this assuming all Java servelets are legacy, or are there non-legacy servlet containers?
20:03Jaoodzimri-lim: I guess there are legancy and non-legacy servlet containers, the most popular servelet cointaner in the clojure world is jetty
20:03amalloyalthough i'm pretty sure embedding jetty is more popular still, for clojure at least
20:03Jaoodzimri-lim: and there's http-kit which is a http server desgined for clojure (ring) applications
20:04Jaoodzimri-lim: which has nothing to do with servlets
20:06Jaoodamalloy: I guess is more popular because it predates http-kit and is more convenient for java legacy apps
20:06xeqiamalloy: I'm playing around with parallel properties, so I'm seeing if I can do the interleaving comparison from Hughes' c/w talk
20:06seancorfieldsritchie: 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:08seancorfieldsritchie: 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:09seancorfieldsritchie: The Haskellers on the Elm mailing list can be very resistant to Evan's position at times :)
20:09sritchieseancorfield: the monad thing is compelling because the same pattern that everyone’s familiar with with lists...
20:09sritchieworks for maybe, and for reactive stuff, and for futures,
20:09sritchieso, boom, you already know how to code those things
20:11sritchieseancorfield: but yeah, that whole group is really amazing with how hardheaded they are
20:11sritchiehow completely arrogant, rather
20:12seancorfieldyeah, 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:12arrdemyeah 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:12seancorfieldexplaining 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:13seancorfieldI'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:13Jaoodare there any Haskell monads tutorials?
20:14seancorfieldHundreds!
20:14JaoodI kid I kid
20:14seancorfield:)
20:14Jaood;)
20:15seancorfieldBut 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:16arrdemamalloy: useful material maybe, just made my toolkit. https://www.refheap.com/86575
20:16seancorfieldI'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:16scriptorthis is a common issue in mathematics
20:16seancorfieldAnd there's a level of genericity there that is also a distraction. Yes scriptor I agree - and I _am_ a mathematician :)
20:16scriptorI'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:17scriptorah
20:17scriptorerm
20:17arrdemseancorfield: 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:17scriptorI was all of one class short of a math minor, so hah!
20:17zimri-limJaood: 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:17seancorfieldMy 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:19seancorfieldarrdem: 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:20seancorfieldlots of programmers are perfectly happy learning about for-comprehensions without knowing anything about monads etc
20:22arrdemseancorfield: 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:23justin_smitharrdem: even as the underlying hardware stops being strictly sequential
20:23amalloyincidentally, arrdem, it seems like (-> foo (->assert even?) (inc)) is just (-> foo (doto (-> (even?) (assert))) (inc))
20:23seancorfieldbut 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:23arrdemamalloy: sure, I just think that the ->(>)?assert is nicer.
20:24arrdemseancorfield: I mean we seem to have no problem teaching math and physics jargon, so I think that's a fallacious argument.
20:24arrdemseancorfield: just because we have "jargon" doesn't mean it's the right jargon
20:25arrdems/the right/good/g
20:25seancorfieldIt's a different audience. There are millions of programmers (in terms of jobs) but relatively few mathematicians and physicists
20:25stephenjudkinsseancorfield: "jargon" is subjective and relative
20:25stephenjudkinsi 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:25akhudekdoes 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:26seancorfieldIf 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:26seancorfieldstephenjudkins: 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:27stephenjudkinsi think the "you just hate knowledge/learning things" reflexive response to people's criticism of FP is stupid, though
20:27seancorfieldagreed
20:27arrdemseancorfield: 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:28stephenjudkinslike, 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:29stephenjudkinsand 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:29arrdemHERETIC
20:29amalloy~guards
20:29clojurebotSEIZE HIM!
20:29seancorfieldLOL
20:30seancorfieldbut that is indeed the quagmire of argument you get into as soon as you push back on this stuff ("jargon")
20:30arrdem(inc amalloy)
20:30lazybot⇒ 128
20:30arrdemseancorfield: have you read EWD's letter to the UT Board about the CS curriculum here?
20:30seancorfieldand it's certainly possible to teach FP to complete beginners without any of that stuff
20:31amalloyunfortunately 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:31arrdemamalloy: I'm quoting you on that...
20:31TimMc:-D
20:32sritchieseancorfield: oh man, just jumped back in
20:32amalloygood luck finding a suitable context
20:32sritchieI had asked on IRC -
20:32scriptorheh, guards
20:32sritchieseancorfield: but, here’s the thing
20:32sritchiethe monad is obviously a pattern
20:32sritchieyou just wanted it for maybe
20:32sritchieso what’s the “everyday language” suitable to introduce that pattern?
20:32sritchiegiven that elm chose the pattern, I guess
20:33sritchiescala just calls it “for syntax”, I guess
20:33clojurebotTitim gan éirí ort.
20:33seancorfieldright, and there's no mention of the M-word here http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html
20:34sritchiesure, but it’s also not sharing an interface with java’s lists
20:34sritchiewhich you could argue that it should, now that they have map, filter, etc
20:34seancorfieldOptional has map, flatMap, filter
20:34sritchieyeah, this implements filter,
20:34sritchieand so does a list, now…
20:34seancorfieldwell, streams do :)
20:34sritchiebut they share no interface
20:34sritchieso I can’t write code that will work on both
20:35sritchielike, “lift” is really useful
20:35sritchietake a function, and make it work on some monad
20:35sritchieand you can’t write that without the common interface...
20:35sritchiebut you have to name the interface
20:36sritchietake A -> B and make Option[A] -> Option[B], etc
20:37seancorfieldI'd have to see how far you could push Java's generics for that...
20:38amalloyseancorfield: no further than the java 8 stuff already did
20:38seancorfieldamalloy: and they added a whole bunch of new type inference to make that work in Java 8
20:38amalloyyou just need a common superinterface FlatMappable (ie, Monad), instead of 8 different interfaces that all contain flatMap
20:41amalloyand then you can write something like: public <A,B,M extends FlatMappable> Function<M<A>,M<B>> lift(Function<A, B>);
20:44stephenjudkinswhat word makes clojurebot swear in irish?
20:44amalloy~swear in irish
20:44clojurebotexcusez-moi
20:45stephenjudkinssyntax
20:45arrdemclojurebot never swears in irish, he will occasionally apologize in welsh
20:45amalloy~swear in irish please?
20:45clojurebotGabh mo leithscéal?
20:45stephenjudkinsi'm so confused
20:45amalloyclose enough. have a cookie
20:52seancorfieldamalloy: 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:52seancorfieldand I'm more familiar with the behavior of C++ templates (which really weren't based on types)
20:58seancorfieldbut, 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:59hiredmanand now java is stuck with it for 10 years
21:10devntechnomancy: 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:13devnill give you a hint: https://www.dropbox.com/s/0wfnlwsg1p1qbj8/xeyes404.png
21:13devn:D
21:13TEttingerI gotta say, devn, https://github.com/devn/clojars-web/blob/d99aeeefc74938087c821bbda655ca713bc651e8/resources/public/images/rich-portrait-frame.png is pretty creepy
21:13arrdem(inc devn)
21:13lazybot⇒ 23
21:14arrdemdevn: dude. that's hillarious
21:14devnim 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:15devnserious business
21:15devnlol
21:15devnand just in case you're looking at just the screenshot, yes, the cursor follows your mouse
21:16devnerr the eyes follow your cursor
21:34allenj12in quil if im using :fullscreen is there a way to get the screen height or width?
21:35allenj12o nvm, there is a funtion called that, i just did something wrong
22:38umpa,(println "hello!")
22:38clojurebothello!\n
22:41umpaHow do I loop recure with multiple conditions ? https://www.refheap.com/86579
22:43muhukumpa: what's the error message you're getting?
22:44muhukumpa: https://www.refheap.com/86580
22:45muhukumpa: eh, no.
22:45umpahttps://www.refheap.com/86579
22:48muhukumpa: see the fork I've pasted
22:48umpamhuk: nice
22:49muhukumpa: one thing: I wouldn't overwrite x and y within the loop, makes it harder to read the code.
22:51umpamhuk: true
22:51allenj12,(.-value 3)
22:51clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: value for class java.lang.Long>
22:53allenj12,(.-value "hello")
22:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: value for class java.lang.String>
23:39akhudekoh wow, including docx4j 3.1.0 in lein caues a stackoverflow in lein deps :tree
23:41akhudekah whew
23:41akhudekupgrading lein fixed it