#clojure logs

2016-02-27

00:00macroliciouswell, in my lein created project root, I have a src directory, and in that, a seesaw directory, with what I assume to be needed in that
00:00hiredmanno, you shouldn't have anything like that
00:00macrolicioushiredman: well, I'm trying to run the simple calculator app with 'lein run -m calculator.core'
00:01hiredmanif you tell lein you depend on seesaw, you should not have seesaw source in your project, lein will make it available for you
00:01macrolicioushiredman: ah ok… so, I assumed lein would pull down seesaw and put it whereever-it-should-be… but then when that approach threw the file-not-found-error I tried to put it there manually
00:03hiredmanmacrolicious: what does your project.clj look like?
00:08macrolicioushere it is: http://pastie.org/private/uxnlrtez7fdxwegt97ai8g
00:10hiredmanhave you cleaned out the seesaw stuff you put in src yet?
00:12hiredmando that, make sure you saved those files, and run 'lein run -m calculator.core' again
00:13hiredmanthat paste isn't all one file is it? you included project.clj and src/calculator/core.clj in the same paste right?
00:14macroliciousit is all one file ;-|
00:14hiredmanso delete the whole project, run lein new … again
00:15hiredmanthen install the 'tree' command if you don't have it, then run it, and you'll see the directory structure of a lein project
00:15hiredmanproject.clj directs the build
00:15hiredmancode goes in src/
00:16macroliciousok… was about to share the tree output, but pastie is throwing a 503… I'll run lein new again...
00:16hiredmanno, don't
00:16macroliciousok
00:16hiredmanthe tree outfit is for your benefit
00:16hiredmanoutput
00:16macroliciousok
00:18hiredmanlein does allow you to put arbitrary clojure code in project.clj (beyond the defproject form which describes the build) but you should never do that
00:19hiredmanthe execution context of any code in project.clj is not what you want (which is why it could not find seesaw)
00:23macroliciousgotcha… rerunning everything in a new lein app...
00:41macrolicioushiredman: dependencies working now! yay! thanks ;-)
01:29macroliciousgetting a new error which cites a blank offending symbol: http://codepad.org/PvIQx2Jr
01:32macroliciousInteger?
01:33amalloymacrolicious: i would check your input file for weirdo characters like  
01:33macroliciousok… tried that by opening in vim and using ':set list' which didn't show anything… what's a better way to look?
01:35amalloywell, one thing you could do is retype the offending line by hand, since you know you won't be adding weird characters
01:36amalloyif that doesn't help, i don't really know what's going on
01:36macroliciousamalloy: I'll retype it
01:37amalloydpeg pls. i don't play on these experimental branches to deal with player ghosts
01:39amalloyoops
01:39amalloywrong channel there
01:39macroliciouslol… I was thinkng I had breached some protocol...
01:40amalloyunless you are dpeg in disguise, you're doing fine
02:16tolstoyDo people use "tabs" instead of spaces much anymore? In any coding?
02:17amalloymakefiles
02:17amalloyand there are still people who prefer it to spaces, in stuff like C/java/python, although i think they are a minority
02:17tolstoyWell, yeah, but ... I seem to be working with people who do it with CSS and gulp.
02:18tolstoyYeah, aside from taste issues, it's not so nice with Github, less, etc, etc.
02:18tolstoyOr Emacs with "untabify" on save, or whatever it is I have going
02:19tolstoywhitespace-cleanup? Something like that.
02:22rhg135I once pressed my tab key and then got yelled at. Maybe we need to not default to that.
02:22TEttingeramalloy: it could be neat to have a "player ghost" in a programming context. an isolated track of execution based on an earlier run, possibly with ghost-like highly-limited side effects
02:23TEttingerespecially for tests
02:23TEttingerlike a "ghost" running an earlier version
02:24TEttingersee? it wasn't totally the wrong channel
03:52Nvoidls
06:17vivekramaswamyHello All, a quick question regarding cider-repl on emacs when I use the function (read-line) on the repl, the repl is able to take my input and then just hangs, do I need some special key to return from the function
07:47justin_smithvivekramaswamy: the repl's *in* is not directly connected to your emacs - nrepl is a socket repl and CIDER is deciding what to send to the repl. If you need things like read-line it's frankly simpler to use inferior-lisp or inf-clojure, if there's a trick to make it work with CIDER I don't know of it
08:27vivekramaswamyjutin: thank you for your reply
11:21arkh,(clojure.set/union nil #{1})
11:21clojurebot#error {\n :cause "clojure.set"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "clojure.set"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.net.URL...
11:23justin_smith,(require 'clojure.set)
11:23clojurebotnil
11:23arkh,(clojure.set/union nil #{1})
11:23clojurebot#{1}
11:24arkhthank you
11:24justin_smithnp
11:24arkh,(update-in [] [:a] (clojure.set/union #{1}))
11:24clojurebot#error {\n :cause "Key must be integer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Key must be integer"\n :at [clojure.lang.APersistentVector assoc "APersistentVector.java" 345]}]\n :trace\n [[clojure.lang.APersistentVector assoc "APersistentVector.java" 345]\n [clojure.lang.APersistentVector assoc "APersistentVector.java" 18]\n [clojure.lang.RT assoc "RT.java" 792]\n [...
11:25justin_smitharkh: too many parens
11:25justin_smith,(update-in [] [0] clojure.set/union #{1})
11:25clojurebot[#{1}]
11:25justin_smithalso :a is not a valid index in a vector
11:25justin_smith,(update-in {} [:a] clojure.set/union #{1}) ; perhaps you wanted this
11:25clojurebot{:a #{1}}
11:26arkhoh - whoops. I did
11:27arkhalso, parens around latter update-in args was the thing hanging me up - thanks
11:28justin_smitharkh: yeah, update-in and swap! are examples of functions that use less parens that you might expect - you just keep tacking things on almost as if it were backwards forth
12:02inhortteHello. I'm using boot in a cljs project with a clj backend. This line: (task-options! serve {:handler 'martenblog.handler/app :reload true}} lets my clj app (using compojure) serve content via the server, but how do I get "/" to point to my generated "app.js" from my cljs? It resides in /target/js but I can only serve things from /resources. Is there anything like ring.middleware.resource/wrap-resource that will let me serve m
12:03justin_smithinhortte: what I do is add resources/public/app.js to my clean targets, and then tell the cljs compiler to output to that location
12:04justin_smiththat way uberjar bundling works properly etc.
12:06inhorttejustin -> being an ameteur, can you give me an example? :)
12:06justin_smithinhortte: I use leiningen, not boot, these are just leiningen configs
12:06justin_smith:clean-targets and :cljsbuild
12:07justin_smithI just assume boot has similar options for which files get auto-cleaned and where cljs build output can go
12:07inhortteok. I suppose there will be boot equivalents, or I can write something in clojure in build.boot.
12:07justin_smithyeah
12:08inhortteOk. I just got it working by making symbolic links after the compile, but automagically is always better.
12:08gfredericksgenerating generators is trippy
12:08inhortteThanks for the kick in the brain. I'm off to try.
12:08justin_smithgfredericks: yeah sounds like something where shrooms would help
12:10gfredericksweird to debug too
12:10justin_smithinhortte: there should be some kind of :compiler key for the cljs config for a build, and then that can use an :output-to key that tells it where the file goes, if it's anything like the leiningen config (and I don't know why they would make them arbitrarily different, these are clojurescript compiler options after all)
12:10justin_smithgfredericks: once again, shrooms
12:11inhorttejustin -> all right. it is possible. thanks again.
13:55tolstoyIn cljs, is there a way to "apply" to a goog.closure method? (apply goog.string.format "..." ["a", "b"])?
14:03justin_smithtolstoy: isn't there a thing in the js interop that does that?
14:05justin_smithtolstoy: should just be (.apply goog.string.format (cons "..." ["a", "b"])) ? or do you need to turn the arg list into a js array for that to work...
14:10justin_smithhmm, format is unhappy about templates when I try that...
14:34tolstoyYeah. I as mainly interested in shortening the name, but a proper require fixed that.
16:34justin_smithI just went through my cljs replacing some callbacks with core.async, and the results are so nice
17:09gfredericks,(def cool-map {Double/NaN 42})
17:09clojurebot#'sandbox/cool-map
17:10gfredericks,(= cool-map cool-map)
17:10clojurebottrue
17:10gfredericks,(= cool-map (into {} cool-map))
17:10clojurebotfalse
17:10gfredericks,(= cool-map (-> cool-map (assoc 1 2) (dissoc 1)))
17:10clojurebotfalse
17:10justin_smith,(= (into {} cool-map) (into {} cool-map))
17:10clojurebotfalse
17:10gfredericks,(= cool-map (with-meta cool-map {1 2 3 4}))
17:10clojurebotfalse
17:10justin_smithcool map, bro
17:11gfredericksNaN-as-map-key is the only scenario where I've been able to get this to happen
17:11gfredericksI don't know what the expected behavior is or why
17:11justin_smithit's also the only one I know of
17:11gfredericksit doesn't happen for sets
17:11justin_smithwell, NaN isn't equal to itself, but sometimes clojure short-circuits that test because object identity, right
17:11gfredericksyeah I'm imagining that's the implementation explanation
17:12gfredericksjust don't know if it's the correct behavior
17:12hyPiRionequality is hard
17:12gfredericksI feel like the first two should have the same answer, whichever answer it's supposed to be
17:12gfredericksso it feels like a bug
17:12gfredericksI bet there's a 4-year-old ticket about this somewhere
17:13gfrederickstest.check found this for me (thanks, test.check!)
17:13gfredericksI guess I'll just tweak the test to not test this case
17:14gfredericksI don't see any tickets when searching for NaN on jira
17:15gfrederickspuredanger: do you know if this is a bug? (let [x {Double/NaN 42}] (not= (= x x) (= x (into {} x))))
17:15gfredericks,(let [x {Double/NaN 42}] (not= (= x x) (= x (into {} x))))
17:15clojurebottrue
17:17gfredericksactually I guess this is in the same category as other NaN comparisons
17:18gfredericks,(let [x [Double/NaN]] [(= x x) (= x [Double/NaN])])
17:18clojurebot[true false]
17:19gfredericks⇑ so I guess everything's already weird about NaN comparisons
17:19gfrederickspuredanger: disregard
17:20hiredman_gfredericks: isn't that almost certainly an array map vs. hash map thing?
17:21gfrederickshiredman: ⇑ I just showed similar behavior with a vector
17:21notostraca,"(+\u180E1\u180E1\u180E1)"
17:21notostracaoh, no lazybot?
17:21clojurebot"(+᠎1᠎1᠎1)"
17:21notostracaclojurebot I mean
17:21gfrederickshiredman: I think it must be the identical? check giving "bad" results
17:22irctcaaatest
17:22irctcaaatest1
17:23irctcaaaI'm assuming this channel is distinct from Slack's #clojure channel?
17:23gfredericksirctcaaa: yep
17:24notostraca,(+᠎1᠎1᠎1)
17:26notostraca~ping
17:29TEttinger,(+᠎1᠎1᠎1)
17:30TEttingerare messages coming in at a limited rate for anyone else?
17:30TEttingerI suppose I'm not sure why I asked that since I won't see a response
17:31hiredmansomething odd is going on with freenode
17:31TEttingerdefinitely.
17:32TEttingerclojurebot appears netsplot
17:34hiredmanclojurebot is actually offline, and timing out trying to connect to freenode, from the same server I am running my irc client on
17:35will_smI used boot for a school project, wish I had used lein
17:36will_smanyone no a tool that I can use in boot to generate documentation for my code?
17:36will_smknow*
17:42nbergerDidn't use it, but it seems like https://github.com/funcool/boot-codeina could be what you are looking for
17:43TimMcTEttinger: How can you tell? It's a low traffic time for the channel anyhow.
17:43TimMc(re: limited rate)
17:45TEttingerTimMc: because I only saw 7 messages come in when I sent a message myself, in big batches
17:51TimMcinteresting
18:17pilnei wonder if i could teach lisp to improvise a musical passage on the fly in real time with an input of only the backing tracks....
18:18justin_smithpilne: easier if the backing tracks are high level data, but both have been done
18:19justin_smiththat is, both backing track as raw PCM from a DAC and backing track as event data eg. MIDI
18:19pilnemidi would be pretty easy to accomplish as an in
18:19pilnebut drat
18:19pilnelol
18:20justin_smithpilne: an interesting thing is that a lot of the stuff you have to do to make an improvising program work is similar to low level UI code (eg. doing UI without any UI library doing it all from scratch), eg. it's all about how humans perceive timings and how humans distinguish events, and simulating that stuff in code
18:20justin_smitheg. how far apart to readings have to be before humans think they are actually two things and not just one jiggly thing?
18:21justin_smith*two readings
18:22pilnethat's true... pattern matching based on time separation
18:22pilneiiiiinnnnnnteresting
18:22justin_smithand "far apart" has multiple dimensions - time, space, and quality
18:22pilnei'd stroke my goatee right now if i still had it
18:22justin_smithhaha
18:22pilneit still might be a fun experiment
18:22justin_smithso it's not just time sepration, other qualities of the signal suffice as well, and all add up to a "differentiation factor" that takes them all into account
18:23pilnewell, no might, just feels odd to recreate what has already been done (probably better than I could too)
18:23pilnei kinda figured the immutable and concurrency would make it easy to reap huge dividends there
18:23pilnein clojure
18:23justin_smithit's a fascinating field
18:23justin_smithif you have the hardware to back it up and make it happen in real time, yeah
18:24justin_smithDSP in real time isn't always so simple
18:24pilneyeah, i'd probably stard with reading from pre-recorded midi
18:24pilne*start, because my hardware isn't ancient, but it isn't a workstation
18:24justin_smithdefinitely easier - the midi already decided a bunch of those thresholds for you
18:24pilneleveraging the gpu for parallelization sounds like a fun challenge too
18:25justin_smithto use a term you might also recognize from image processing, the "feature detection" has already been done
18:25pilnebecause ideally i'd like it to somewhat analyze (not just store) what it has already done.
18:25justin_smithsimilar to parsing a structured thing like an svg and analyzing shapes vs. parsing a jpeg and analyzing shapes
18:26pilnei don't do much image processing, but i've heard it in the tutorials my gf has listened too.
18:27justin_smithyeah, I just mention it because the concerns are remarkably similar, but if you don't know image processing either that's neither here nor there
18:27pilnei'm more of a data/math/abstract/crypto/wierd-shit guy
18:27pilnei understand it on an abstract level though :) so it did help
18:28justin_smithwell I am sure you can still imagine how hard it would be to take a jpg (a matrix of pixel values) and decide where objects start and end
18:28pilneyeah
18:28justin_smithand people's intuition of how hard that is tends to be closer to the mark compared to audio, for some reason
18:29pilnei can kinda understand that, most of us are quite visual in learning :)
18:29justin_smithlike, people ask for the audio equivalent of "photoshop plugin that removes girls from a crowd scene with one button click" as if that was a reasonable thing
18:29justin_smith(eg. plugin that automatically isolates instruments or sound sources)
18:30pilneunless everything is on a physically separate track on the medium they are providing... LOL
18:30pilnebut.. i've spent a long time around sound/physics in my academia and hobbies
18:30pilneso i might have a leg up on the average person
18:33pilneand that is true i was thinking the real time feed would have separate inputs for each "section" that it would be improvising on top of in order to let the computer have more of a "feel" for what is going on
18:34pilnemy gut just told me that something with concurrency, immutable data (for both pass-through and concurrency), and stronk makros would make it "easier"
18:35pilnethat or it wants more sushi
18:38justin_smithpilne: oh man I've been on a low calorie diet for the last couple of weeks (health and stuff, you know) and it's basically just a constant angry message coming from my gut saying "WHY ARE YOU TRYING TO STARVE TO DEATH" haha
18:38justin_smithit's good though, one learns to ignore it eventually
18:38pilneyeah... i need to get over my garfield-inspired fear of dieting and just start again.
18:38justin_smithpilne: nothing good can be Garfield inspired.
18:39pilnei've been on this fucking rollercoaster too many times lol
18:39pilnegarfield taught me that diet is just die with a t
18:39pilneand reinforced that lasagna is life (i had an italian grandmother lol...)
18:41justin_smithoh, lasagna is just fine, it's just that the healthy portion for a human who is not in heavy weight training or running marathons is actually kind of tiny
18:41justin_smithanyway this has nothing to do with clojure, sorry
18:41pilneyeup... but before i can get back to powerlifting, i need to get back in decent shape, nah... i'm tangential as all heck IRL too
18:56WickedShellI'm getting an error that is kinda blowing my mind. 'Exception in thread "LWJGL Application" java.lang.ClassCastException: swiftgcs.gui_helpers.PanelItem cannot be cast to swiftgcs.gui_helpers.PanelItem' PanelItem is a defrecord, why could a PanelItem not be cast to itself?
19:14pilneWickedShell-: i do not know why that would be happening, but i saw something similar happening to someone in c the other day, the resolution had to do with the constructor
19:16WickedShellpilne, I'm struggling to reproduce it which is driving me crazy. I've seen this problem twice out of 100 runs, which is making debugging it really diffiicult... I'll check my constructors, thanks
19:19pilneit doesn't even happen all the time??? that would be frustrating, is there anything else those 2 runs have in common?
19:19pilnethat do not occur in the others?
19:20WickedShellSeems to be the first time I call it within that context, but nothing else.
19:21amalloyWickedShell: you're reloading some of the files in your program but not others, probably
19:21WickedShellamalloy, just in terms of between runs? (using lein, without having turned on direct compilation)
19:21amalloyno, like from in your repl
19:22WickedShellamalloy, I totally reastart the repl everytime I change source :P
19:22WickedShellTo hard to keep all the different threads callbacks updated for changes on the GUIj
19:22amalloyi would be that about 98 times out of 100 you do that
19:22amalloyand then 2 times out of 100 you run into that error
19:23WickedShellif the repl is restarted I'm not sure how thats happening? (I'm sure that I'm missing what you're trying to tell me)
19:24amalloyi'm telling you the only way i've ever seen anyone get an error with a record being unable to be cast to its own type is when the file containing the record has been reloaded at runtime, but some other file that depends on it hasn't been
19:25WickedShellright but I don't ever reload at runtime, at least not by any command I do
19:31justin_smithWickedShell: there's middlewares that will try to reload your stuff - I know of nothing in clojure that causes that error except bad reload state
19:31justin_smithmaybe something calls load-file for some stupid reason?
19:31WickedShellany idea what middleware can cause that?
19:32WickedShellI have no calls to load-file anywhere in my code, so it would have to be in middleware somewhere
19:33justin_smithcider.nrepl.middleware.refresh/wrap-refresh - unless it's poorly named I assume it is there to reload code
19:33justin_smithhttps://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/refresh.clj
19:34WickedShellHmm as far as I'm aware I'm not using cider... (just the default nrepl which I thought was different)
19:34justin_smithWickedShell: yeah you'd probably know if you were using cider, just a tricky place auto-refresh could sneak in
19:35rhg135I'm pretty sure cider does no reloading automatically
19:36justin_smithrhg135: sure, but it has a plugin that can do so and WickedShell does not think he is reloading any code, and he has a bug that is only caused by code reloading
19:36rhg135my code- are usually in a non-loadable state so that'd be a nogo
19:36justin_smithas far as I know...
19:36rhg135oh
19:36WickedShellwell and I know that from me hitting lein repl to the bug none of the source was modified
19:37justin_smithhmm
19:37justin_smithoh, the other cause of that is not running lein clean
19:37justin_smithlein does bad caching sometimes
19:37justin_smithit's super annoying
19:38justin_smithso one part of your code is seeing an old aot / cached artifact for a file, and another gets the newly loaded code
19:38justin_smitheven if the source is identical, it creates two classes with the same name
19:38justin_smithleading to errors like the above
19:38WickedShellmy deps :tree if that helps: http://pastebin.com/LNJE4trg
19:38WickedShelljustin_smith, thats all I can think of to do
19:38rhg135I aliased leinrepl to `lein do clean, repl`
19:38WickedShellI actually removed direct linking except for release builds as it caueses lein to loose its mind
19:39amalloyrhg135: that sounds awful
19:39WickedShellI guess I'm going to move back to lein clean; lein repl everytime and accept that it takes ~45 seconds to launch after any change :P
19:39amalloystop AOT-compiling stuff, if you don't want stale classfiles
19:39rhg135amalloy: so is constant wtf stack traces
19:40rhg135aot deps...
19:40rhg135not like I launch it often
19:40WickedShellAOT is there for uberjar mostly I can move that into the release build only... not sure why I moved it out of the release into the normal one
19:44justin_smithWickedShell: my favorite thing is to make a tiny namespace, turn on aot for that namespace only, and make sure it has no explicit deps other than clojure.core. Then in the namespace you implement whatever methods you need so the java junk can call you (whether that's the startup/shutdown stuff for jsvc or just a -main), and inside the -main you can do a require / resolve / call of your actual real startup code, none of which gets aot compiled
19:45justin_smith(defn -main [& args] (require 'my-real.ns) (apply (resolve 'my-real-ns/-main) args))
19:45justin_smiththat -main doesn't even need to be called in any app code, so staleness never hits you during dev
19:46WickedShellWould I have to AOT any proxy's?
19:47justin_smithWickedShell: you only need to AOT the things that java is calling directly
19:47justin_smithand that trick short-circuits all recursive AOT
19:47justin_smithjust make sure that namespace only does the require at runtime and not in the ns decl
19:48WickedShellThat's why I'm worried about the proxy's as I have to pass them to java listeners
19:48justin_smithpassing them is fine!
19:48justin_smiththis is only for things that java calls directly without us calling the java stuff first
19:48justin_smithcreating and passing a proxy to some method will work as usual
19:48justin_smithunless you mean you are passing the classname of the proxy to the java command
19:49justin_smithI think the word I was looking for here was "entry point" - you only need your entry point to be aot
19:51justin_smithbbl
20:37gfredericksis anybody equipped to run a line of cljs for me real quick to make sure I'm not crazy?
20:37gfredericks(in an up-to-date version preferably)
20:46gfredericksI think I've convinced myself it's a bug
20:47gfrederickshash gives NaN for NaN & both infinities, one of the consequences of which is if you put any of those 3 values in a set you get a stack overflow
21:11justin_smithgfredericks: my little (println "Hello world!" (into #{} [NaN])) prints the same thing to the js console as the equivalent clojure would to the terminal
21:12justin_smithgfredericks: tested this to -- Hello world! #{NaN Infinity}
21:12justin_smithgfredericks: cljs version is 1.7.228 - currently the default from the mies template
21:15amalloywhy should hashing to NaN cause a stack overflow? i'd expect some other error
21:15clojurebotPardon?
21:15amalloyyou know what you heard, clojurebot
21:38will_sm(+ 1 2)
21:38clojurebot3
21:58justin_smithgfredericks: now that I saw your jira, yeah, the version in your code does throw
22:00justin_smithhttps://gist.github.com/noisesmith/84f5b099d868d55d784f
22:03justin_smithI also just updated with the stack trace