#clojure logs

2016-01-05

01:11engblomsouterrain: I am using Oracle's jdk8... And Raspbian Jessie.
02:20TEttinger,(def flop [f] #(apply f (reverse %&)))
02:20clojurebot#error {\n :cause "Too many arguments to def"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Too many arguments to def, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.RuntimeException\n :message "Too many arguments to def"\n :at [clojure.lang.Util runtimeException "Util.jav...
02:21TEttinger,(def flop #(apply % (reverse %&)))
02:21clojurebot#'sandbox/flop
02:21TEttinger,(flop / 2 0)
02:21clojurebot0
02:21TEttinger,(flop / 2 1)
02:21clojurebot1/2
02:32Kneiva,(flop / 2 2 1)
02:32clojurebot#error {\n :cause "Unable to resolve symbol: flop in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: flop in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: flop in this co...
02:40arrdemSilly java q... if I have a class `c` with private method `m`, can I call `m` on other instances of `c` from an instance method of `c`?
02:42KneivaI don't think so.
02:42arrdemI think private restricts you to your own instance, but I'm not sure.
02:44opqdonutI think you can
02:45KneivaActually, you can.
02:45KneivaInteresting.
02:46arrdemI'd kill for `auto` in Java.
02:47opqdonutyep, it works
02:47opqdonutas the docs say, "Access level modifiers determine whether other classes can use a particular field or invoke a particular method. "
02:47opqdonuti.e. they work per class
02:48Kneivaarrdem: http://pastebin.com/WhhVRLMR
02:48arrdem(inc Kneiva)
02:48arrdemrip lazybot
04:52jonathanjre flip: tracebacks get a bit uglier since the function is no longer called "remove" but "fn--12345" and the call stack also gets a bit weird (especially if you have an async callback to a flipped function)
05:28justin_smithjonathanj: good point, but the weird traceback horse is pretty much out of the barn by now too
05:29gaqwashi
05:31arrdemwelcome
06:09justin_smithTEttinger: you might appreciate this https://twitter.com/christianbok/status/684224785501425664/photo/1
06:13ridcullyis there a way to give that inner anon fn a name? like `~(symbol (str f "-flipped"))?
06:14justin_smithridcully: with a macro of course
06:14justin_smithI don't think it's possible in a regular function call
06:25justin_smith,(meta (fn foo []))
06:25clojurebotnil
07:13ridcullyis it intentional, that yada uses o.c/core.cache, but does not end up with a dep for it?
07:20arrdemIMO that's a bug, you can always :exclude it downstream if you had to.
09:07jonathanjjustin_smith: i'm still hoping that one day "weird tracebacks" will be a campfire ghost story we tell the clojure young'ns
09:08visofhi guys
09:08jonathanjridcully: how are you finding yada?
09:08visof,(read-string "032002311333110030223330")
09:08clojurebot239850788873268438744N
09:08visof,(== 239850788873268438744N 032002311333110030223330)
09:08clojurebottrue
09:08jonathanjridcully: the last time i tried to read the documentation, it seemed horribly out of sync with reality
09:08justin_smithvisof: it's base 8
09:09visofjustin_smith: how can i make it 10 ?
09:09jonathanjvisof: zero prefixed numbers are traditionally how you write octal
09:09visofmake it read as it's
09:09justin_smithvisof: by not having a 0 in front?
09:10justin_smith,(Long/parseLong "032002311333110030223330")
09:10clojurebot#error {\n :cause "For input string: \"032002311333110030223330\""\n :via\n [{:type java.lang.NumberFormatException\n :message "For input string: \"032002311333110030223330\""\n :at [java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]}]\n :trace\n [[java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]\n [java.lang.Long parseLong "Long.jav...
09:10justin_smithergh
09:10justin_smith,(Long/parseLong (subs "032002311333110030223330" 1))
09:10clojurebot#error {\n :cause "For input string: \"32002311333110030223330\""\n :via\n [{:type java.lang.NumberFormatException\n :message "For input string: \"32002311333110030223330\""\n :at [java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]}]\n :trace\n [[java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]\n [java.lang.Long parseLong "Long.java"...
09:11ridcullyjonathanj: well the docs have huge gaps right now - so i cant tell, if something is missing or wrong. i am fooling around with it right now
09:11poooglese
09:11visof,(Long/parseLong "032002311333110030223330")
09:11clojurebot#error {\n :cause "For input string: \"032002311333110030223330\""\n :via\n [{:type java.lang.NumberFormatException\n :message "For input string: \"032002311333110030223330\""\n :at [java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]}]\n :trace\n [[java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]\n [java.lang.Long parseLong "Long.jav...
09:11ridcullyjonathanj: yesterday i put schema and catacumba together, so i thought i give yada a try too, since it does that already
09:11visof,(Long/parseLong "032002311333110030223330" 10)
09:11clojurebot#error {\n :cause "For input string: \"032002311333110030223330\""\n :via\n [{:type java.lang.NumberFormatException\n :message "For input string: \"032002311333110030223330\""\n :at [java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]}]\n :trace\n [[java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]\n [java.lang.Long parseLong "Long.jav...
09:11visof,(Long/parseLong "32002311333110030223330" 10)
09:11clojurebot#error {\n :cause "For input string: \"32002311333110030223330\""\n :via\n [{:type java.lang.NumberFormatException\n :message "For input string: \"32002311333110030223330\""\n :at [java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]}]\n :trace\n [[java.lang.NumberFormatException forInputString "NumberFormatException.java" 65]\n [java.lang.Long parseLong "Long.java"...
09:11visof,(Long/parseLong "32002311333110030223330" 1)
09:11clojurebot#error {\n :cause "radix 1 less than Character.MIN_RADIX"\n :via\n [{:type java.lang.NumberFormatException\n :message "radix 1 less than Character.MIN_RADIX"\n :at [java.lang.Long parseLong "Long.java" 408]}]\n :trace\n [[java.lang.Long parseLong "Long.java" 408]\n [sandbox$eval193 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval193 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval ...
09:11justin_smithvisof: it's too big for a long
09:12ridcullylong long long is to long for gcc
09:12pooogles(ignore my typing in the wrong shell...)
09:14visofhow can i convert octal to base 10?
09:15ridcully,017
09:15clojurebot15
09:15jonathanjridcully: how are you finding yada?
09:15ridcully,8r17
09:15clojurebot15
09:15jonathanjridcully: i wanted to use it for a project i started a few weeks ago, but i felt super lost reading the documentation
09:16visof,10r15
09:16clojurebot15
09:16ridcully,(Long/parseLong "17" 8)
09:16clojurebot15
09:16jonathanjafter wrestling with liberator and all its quirks i almost regret not trying to forge ahead with yada
09:20ridcullyjonathanj: i can't tell yet, just playing around. i also have zero experience with the clojure web stuff - used ratpack, springboot, grails
09:24jsabeaudryIs it possible to subscribe to all topics of a publication in core.async ?
10:15shiranaihitojonathanj: i was uncomfortable with Ring for some reason i don't remember now, so i made a cute little 'web framework' on top of Jetty.. configuring an app's 'routes' looks like this: https://www.refheap.com/113377 - if you like it, i can send you some pieces of code that should help you whip up a similar thing
10:17shiranaihitojonathanj: the things in vectors are 'middleware' functions that get run before the actual request handler, and can intercept requests and responses a lot like Servlet "filter chains" (or some such) in Java
10:20jonathanjshiranaihito: i'm kind of way too invested at the moment to change things that much, but it's interesting
10:20jonathanjRing still doesn't really have a good async story
10:20shiranaihitojonathanj: oh, right.
10:20shiranaihitoyeah, that may be a part of why i decided to make my own thing
10:21shiranaihitobut i seem to recall also being annoyed or feeling constrained by something in Ring
10:21shiranaihitoplus i wanted to define my 'routes' in a hierarchical fashion
10:22MJB47have you tried bidi?
10:22MJB47(for routing)
10:22MJB47https://github.com/juxt/bidi
10:23jonathanji'm using bidi instead of compojure for routing in my app, i think it's fantastic
10:47alive876+
12:20sdegutisIs there a tool to locate unused vars in a given project?
12:20sdegutisThanks, good day.
12:21noncom|2sdegutis: don't think so, since i think it is undeterminable
12:21noncom|2anything can happen at runtime
12:21sdegutisFor sure? Hmm.
12:21sdegutisOh true. But let's pretend super-crazy things don't happen, and the craziest thing that can happen is that the namespace is given an alias, so instead of refering foo the programmer typed a/foo.
12:22noncom|2yeah, even if you could try and create something that would heave through your code and see if probably some vars are used somewhere, but again, with macros this looks like not a very straightforward thing to do...
12:22noncom|2simply too much unpredetermined behavior
12:23noncom|2idk, well, for your needs maybe simply finding a mention of the var name somewhere else in the text would do...
12:23noncom|2cursive has something like that
12:26nanukodoes anybody have any expereince using test spies in clojure?
12:28sdegutisnoncom|2: good point, I'll just keep using grep
12:28sdegutisThat said, Emacs's grep feature makes this way easier.
12:28noncom|2sdegutis: they say there's also some magical helm search thing, i did not use it though
12:29nanukosilver searcher for emacs is great for grepping through large code bases
12:29sdegutisnoncom|2: I didn't like helm 2 years ago, too bloated for me; I stick with ido etc
12:30sdegutisMaybe helm got less bloated since then, but more likely the opposite happened.
12:30sdegutisido-vertical-mode makes ido helm-like enough for me.
12:30noncom|2ah, interesting to know. i did not try helm myself, but thanks for a review of it :)
12:30sdegutis:)
12:30kwladykafor me emacs has all the same what intellij. Only one thing what is better is way how emacs select block of text. It is not normal selection when you can't move cursor. But i don't know emacs well :)
12:30sdegutisOh snap, I wrote ido-vertical-mode?
12:31noncom|2yes, ido-vertical-mode :)
12:33justin_smithjsabeaudry: iirc you can do that by having a topic function that selects every message
12:33sdegutisman it's gotten forked a lot since then
12:38sdegutisYay! I just deleted my only explicit use of lazy-seq and lazy-cat in this codebase!
12:50stvoanyone find a good replacement for prismatic to keep up on clojure news?
12:56noncom|2stvo: what do you mean, a blog?
12:58stvoprismatic used to collect all the recent blogs and such that had to do with clojure, and put it into a feed. So i could always have fun stuff to read
12:59stvomaybe a date-limited google search would work just as well, haven't tried that one yet.
13:00preschemawhat's the correct way to do (:require [x.y.z :as y.z])? that is, I want to do something like [x.y.z :as z] but reference it as y.z instead of z
13:00noncom|2stvo: well, what about planet clojure?
13:00justin_smithpreschema: (:require [x.y.z :as y.z])
13:00justin_smithpreschema: it works exactly as you suggest
13:01preschemajustin_smith, oh haha. thanks!
13:03stvononcom|2: that looks like a good resource. will bookmark it, thanks
13:03preschemaare there any reasonably popular wiki softwares written in clojure?
13:09noncom|2stvo: also https://plus.google.com/u/0/communities/103410768849046117338
13:11stvononcom|2: nice. thanks
13:11sfz-preschema: only one I know of is https://github.com/jkk/clj-wiki
13:12sfz-preschema: though this one seems more recent/active https://github.com/simon-brooke/smeagol
13:13preschemathanks... neither seems very popular unfortunately
13:40sdegutisHey great job.
13:49devthso many abandoned/incomplete clj docker api clients. why didn't someone just wrap https://github.com/spotify/docker-client instead?
13:50devthtime to brush up on my java interop i guess
13:50justin_smithdevth: maybe it doesn't even need wrapping
13:50justin_smithinterop is pretty easy
13:51devthjustin_smith: yeah i think i'll attempt using it directly
13:51TEttingerjustin_smith: did you ping me maybe? my backlog shows nothing but I have a notification
13:51justin_smithyeah - my first go is to always use the API, and if that becomes a pain in the ass I look for a wrapper, and if it is absent/sucky I make a wrapper
13:51justin_smithTEttinger: oh, I linked a tweet I thought you would like
13:51devthcool, sounds like a good plan.
13:52TEttingerI knew it was the smith of noise!
13:52justin_smithTEttinger: https://twitter.com/christianbok/status/684224785501425664
13:52justin_smithTEttinger: really just an image of some text, which kind of sucks, but it's a cool idea
13:53TEttingerhttps://twitter.com/MrsXTN/status/684397266443079680
13:53TEttingersomebody knows what's up
13:53justin_smithhah
14:08sdegutisI wrote a function in about 35 lines of code which do the majority of what I've ever used SASS/LESS for.
14:09sdegutisThe only thing it can't do yet is spit out nested media-queries as a root style containing the other styles.
14:09sdegutisThe point here is that Clojure is way awesome.
14:10sdegutisAnd it obsoletes DSLs and sub-languages like SASS/LESS extremely easily.
14:10justin_smithsdegutis: have you seen garden?
14:10sdegutisjustin_smith: Yes, I tried it out for a few days and it was just awkward and hard to use, on account of trying to mimic Hiccup.
14:11justin_smithk
14:11sdegutisjustin_smith: the one I wrote is much more like Sass/Less in syntax: vectors represent a level, all strings in a level represent comma-separated selectors, all maps within a level represent attributes; placement order does not matter.
14:11sdegutisAnd, of course, levels can be nested.
14:12sdegutisSo I can do this now: ["#my-page" {:background "blue"} [".group" ".subgroup" {:color "red"}]]
14:12sdegutisThe rules feel much more intuitive to me this way.
14:13nanukois it possible to redef a type?
14:14justin_smithnanuko: you can run deftype with a new definition. But this does not change any instances of the other type - it shadows it, it does not mutate the type.
14:14justin_smithnanuko: what are you trying to do?
14:14nanukojustin_smith: i’m trying to mock a type’s function for testing
14:15justin_smithnanuko: you don't need to do anything with the type, just use reify and define the protocols / interface that the original defined
14:16nanukooh, got it
14:16nanukojustin_smith: thanks
14:16justin_smithnanuko: deftypes can only have methods via an interface or protocol, so the client code should be calling methods of that interface or protocol
14:19j-pbwhat is the best way to read froma lazy seq with a timeout?
14:20j-pbI got a potentially infinite stream of messages encoded as a seq, but want to stop if there is no new realizable message in the seq
14:21sdegutisnanuko: is it possible for you to just use functions rather than types? that would make it easier to "mock out" functions during tests by using dependency injection
14:21justin_smithj-pb: and "no new realizable message" expresses itself as an indefinite delay in getting the next item in the lazy-seq?
14:21sdegutisbtw why doesn't component just say "dependency injection framework"?
14:21j-pbjustin_smith: yeah
14:21sdegutisIt took me a while to realize that's pretty much all it is.
14:21justin_smithj-pb: this sounds like a poor match for the lazy-seq abstraction, and a better fit for a queue or channel (eg core.async)
14:22j-pbit's what kafka-clj does
14:22j-pbtbh I don't find it that bad, it would be somewhat better if seq's could use deref's timeout functionality
14:22justin_smithj-pb: that's not the only api kafka-clj provides. And yeah, I ditched that and just used the lower level stuff myself. It's not a good use of lazy-seq.
14:23j-pbjustin_smith: yeah but using the simple consumer is a lot slower in my tests
14:23justin_smithj-pb: I'm not talking about using the simple consumer
14:23justin_smithI'm talking about using the java stuff
14:23justin_smithvia interop
14:23j-pbyeah I know
14:23j-pbI was erefering to the other ways kafka-clj provides ^^
14:24justin_smithahh, of course
14:24justin_smithI use some of their abstractions, just the lower level ones
14:24justin_smithI end up connecting the incoming messages to a core.async channel, reading from kafka inside a core.async/thread loop
14:25justin_smith(since go isn't for IO)
14:25j-pbyeah, that would probably also work, I'm not the biggest fan of core.async tbh ^^
14:25justin_smithwell, you could also use a PersistentQueue inside an atom or agent
14:26j-pbwith threads its somewhat better, but with go loops not being first class citizens I always get go loop leaks
14:26j-pbyeah
14:26justin_smithI think that fits the abstraction of a network socket comm better, and allows a tiemout deref
14:26j-pbyeah, seqs should support timeouts though ^^
14:27justin_smithonce you care about timeouts you care about side effects, and that's not the domain of lazy-seqs or seqs in general
14:28j-pbnot nessecarily though, you care about a value being ready yet right? A lazy seq might take a long time to produce values but will do so without side effects.
14:33devthcan i use lein to eval a single expression and return the result?
14:35momerath42devth: not sure about passing anything back through lein, but you could always call out to a shell script with your result and then exit
14:36devthwhat i'm trying to do is spin up the clojure docker image to eval an expression
14:36devthmaybe it'd make more sense to run a repl inside docker then send expressions to it
14:48nanukosdegutis: i’m using another library, otherwise i would be using a function
15:13j-pbjustin_smith: https://gist.github.com/anonymous/b5e83b7c75f97236dfea
15:14j-pbI'll just have to see if it doesn't kill performance completely D:
15:14j-pb:D
15:15justin_smithj-pb: couldn't that be (deref (delay ...)) and then the caller could put it in a future or another thread if they choose?
15:16j-pbjustin_smith: verrry good point
15:16justin_smithoh never mind "cannot be cast to future"
15:16j-pbah damn ^^
15:17justin_smithj-pb: but you can do it with a promise
15:18justin_smitha promise requires a let block, but it has the advantage of the caller being able to decide if it needs to be on another thread (or how to put it on a thread)
15:18j-pbhrm, how would that look though?
15:19justin_smith(let [p (promise)] (deref (deliver p (when ...)) timeout-ms ...))
15:19j-pbjustin_smith: I think you would still have to deliver the promise in a future to not block the calling thread
15:19justin_smithj-pb: deliver returns the promise
15:19justin_smithhmm
15:19j-pbohh interesting
15:19justin_smithj-pb: testing...
15:20justin_smithj-pb: no you are right, needs a thread regardless :P
15:20j-pb^^ would have been tooo nice :D
15:21justin_smithand once you need a thread, just use a future no need to muck with the promises
15:21j-pbyeah
15:41j-pbjustin_smith: it's about 75 times slower on a raw (range) however, since kafka is also pretty slow it's only 50% slower ^^
15:41justin_smithhah
15:41j-pbso I'ts actually usable :D
16:56juanjohi there
16:57arrdemwelcome
16:57juanjoi'm trying to compile clojure localy from the sources in github
16:57juanjoi've already installed and and maven
16:57juanjobut when I run ant, i get this error
16:58juanjoError: /Users/juanjo/clojure/build.xml:44: Unable to find a javac compiler
16:58juanjoIf i run javac -v I get
16:58juanjoUnable to locate an executable at "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javac" (-1)
16:58juanjoI'm using Mac OS X
16:59juanjodo you have any suggestion?
17:00ystaeljuanjo: what jdks have you installed on your mac?
17:01juanjoi think 1.7
17:01juanjoAt least there is a file /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/javac
17:01ystaelwhat are your JAVA_HOME and JDK_HOME set to?
17:02juanjothe first to/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
17:02juanjothe second empty
17:02ystaelthat's likely the problem
17:02juanjoand java -version 1.8.0_66
17:02ystaelexport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
17:03juanjois there a 1.8 jdk?
17:03ystaelyes, you can get it from oracle
17:03juanjoanyone works for compiling clojure?
17:04arrdemClojure requires JDK better than 1.6, so 1.7 or 1.8 will work, but you should use 1.8 unless you have a reason not to.
17:04juanjook, downloading now
17:04juanjothanks
17:13sdegutisHi.
17:13sdegutisIs there a shortcut for (for [a as b bs] [a b]) ?
17:16ystaelsdegutis: (map vector as bs)
17:16sdegutisystael: Nice!
17:16sdegutis,(map vector [:a :b] [1 2])
17:16clojurebot([:a 1] [:b 2])
17:16sdegutis,(for [a [:a :b] b [1 2]] [a b])
17:16clojurebot([:a 1] [:a 2] [:b 1] [:b 2])
17:16sdegutisystael: not quite
17:17arrdemsdegutis: because you're looking for the cross product of two seqs no there isn't. for is the shortcut.
17:17ystaelsdegutis: derp
17:18ystaelclearly all matrices in my universe are diagonal
17:18sdegutisarrdem: ahh, good to know.. well, it's pretty short so I guess that's great :)
17:18sdegutisystael: :D
17:35Trioxinshould it be easy to use DL4J in Clojure?
17:37sdegutisDoes (map vector xs ys) only go up to the shortest of the two?
17:37justin_smithyes
17:37sdegutisAh yep.
17:38sdegutisdocstring is explicit about it this time (woo!)
18:12amandabbhi i'm trying to make a clojurescript project where i read in an edn file in the same directory as my source. (:require [clojure.edn :as edn]) is giving me an error No such namespace: clojure.edn does clojurescript have edn support?
18:13justin_smithamandabb: I think that read-string doesn't have the eval option in cljs, so you don't need clojure.edn, you can just use cljs.core/read-string
18:14justin_smithhmm, wait, one sec, that's wrong
18:14ianhedoesitcljs.reader/read-string
18:14ianhedoesitjustin_smith: ^
18:14justin_smithaha! thanks
18:14justin_smithyeah, that's what you use instead of clojure.edn on the cljs side
18:14ianhedoesityeah, the naming changes are a bit odd.
18:16justin_smithamandabb: typically with cljs I end up using transit, which has a json encoding, and is reliable and fast on both the clojure and cljs side
18:16amandabbjustin_smith: really? i kinda wanted to use edn i like it better
18:16justin_smithbut if you have a local cljs-only app, I can see cljs.reader/read-string or cljs.reader/read being useful
18:16justin_smithamandabb: transit gives you edn
18:16justin_smithit just stores it as json in between
18:17amandabbim trying not to use that many external libraries
18:17amandabbor any really
18:17ianhedoesitwhy?
18:17justin_smithcool
18:17clojurebotbecause that's not how macros work
18:17justin_smith(inc clojurebot)
18:17ianhedoesitlol
18:17amandabbwell this is my first clojurescript project i want to become familiar with core stuff first
18:17ianhedoesithm
18:17justin_smithfair
18:18justin_smithamandabb: of course you can directly use json via js/JSON
18:18justin_smithinterop
18:18justin_smithbut yeah, edn is nice
18:18amandabbif this was json there'd be sooooooooooooo many commas lol
18:18amandabbso much prettier this way
18:19justin_smith,,,,,,,,,,'(,,,,,,,,clojure,,,,,,,,,,,,does,,,,,,,,,,,,not,,,,,,,,,,,,,mind,,,,,,,,,,,,,commas,,,,,,),,,,,,,,,,,,,
18:19clojurebot(clojure does not mind commas)
18:19amandabboh i know
18:19amandabbim saying i have a lot of comma separated values in this data file and if it were json it wouldnt be very pretty
18:20justin_smithright, that is a good point
18:20amandabbi'm still trying to read in the file
18:20amandabblike this? (def data (cljs.reader/read-string (slurp "data.edn")))
18:20justin_smiththat looks about right, yeah. Or you can make a PushBackReader out of the file and use reader/read
18:21amandabbi'm getting TypeError: Cannot read property 'read_string' of undefined
18:21justin_smithamandabb: also, read-string only gives you the first form in the file
18:21amandabbdo i need to require something?
18:21amandabbit's just a single map variable so thats fine
18:21justin_smithsounds like you need (require 'cljs.reader) for that to work
18:21amandabbohhh ok
18:22amandabbweird i'm still getting the same error
18:22justin_smithin general you should require / use / load any namespace you use - especially since require and use only actually load the first time you do it
18:22justin_smithcljs.user=> (cljs.reader/read-string "{:a 0}") => {:a 0} - works on my local cljs
18:23amandabbhmmm
18:23amandabbill paste all my code i guess
18:23justin_smiththat's after (require 'cljs.reader) of course
18:24amandabbhttp://pastebin.com/qjSYTCyy
18:24justin_smiththat's not how the ns form works
18:24justin_smithinside ns you want (ns game.core (:require cljs.reader))
18:25amandabboh right i missed the colon oops
18:25amandabbthanks
18:25justin_smithI know it's weird, but standalone require is different from require inside ns, even though they call the same code
18:25amandabbyeah that is weird
18:25justin_smithamandabb: also the ' - not used inside ns
18:28amandabbjustin_smith: Use of undeclared Var game.core/slurp any ideas?
18:29amandabbdoes cljs not have that either?
18:29justin_smithhmm - you might need to call something via interop
18:29justin_smithsince js usually is restricted from using the file system for security reasons
18:29justin_smithis this node?
18:30amandabbno i just wanted to draw in the html canvas in clojurescript. this is just a figwheel template from lein
18:32justin_smithamandabb: OK - js doesn't let you read files
18:32justin_smithotherwise random websites would wreck you
18:33amandabbhmmmmm
18:33justin_smithusually we send files from the server
18:33justin_smithor give the user a button to push to select a file to "upload" to the js
18:33amandabbi really dont want these 200 lines of data config stuff in my code though
18:33justin_smiththen slurp it in your server code and send it to the frontend
18:33justin_smiththis is where transit becomes handy btw
18:34justin_smithit can still be a data file - it's just that the js side can't do the slurping
18:34justin_smithunless the end user manually clicks a button and selects the file of course
18:34amandabbi dont even have a server
18:34justin_smiththat's a problem
18:35justin_smithamandabb: js is intentionally prevented from using files
18:35amandabbwell im just writing a little client side game in cljs
18:35amandabbi guess ill just stick it at the bottom of my code
18:35justin_smithOK, then either you need a server that can send it data, or you need to embed the data into the compiled js output
18:35justin_smiththat would work
18:35amandabbis there any way to embed it
18:35amandabbfrom another file?
18:36justin_smithwith a data url or whatever I guess, but once again, this is where we would usually use a server, but I guess it can do the same thing off the file system
18:37amandabbcan you have multiple cljs files?
18:37justin_smithsure, of course
18:37amandabbor am i stuck with just this one core.cljs
18:37amandabbo
18:37justin_smiththey all get compiled into on js file
18:37amandabboh ok so how can i reference one from the other? more of that require stuff?
18:37justin_smithexactly
18:38justin_smithyou can require your code the same way you would require someone else's
18:38amandabbok ill try that
19:01domgetter"Upgrades should be done using apt rather than Leiningen itself." but if I do "sudo apt-get install leiningen" it says "leiningen is already the newest version." I'm on Linux Mint 17.2
19:02domgetterdo I have to do something other than apt-get install or lein upgrade ?
19:02arrdemdomgetter: yeah ignore that, uninstall leiningen via the package manager and do a local install to ~/bin using lein itself.
19:02justin_smithdomgetter: don't use apt to install lein
19:02arrdemdomgetter: all the lein packages are woefully out of date
19:03justin_smithapt's idea of "newest version" is not canonical
19:03justin_smithdomgetter: if you are worried about stability, it is simple to checkout any specific lein version with "lein upgrade version.i.want"
19:03domgetterOkay I now understand not to use apt-get to install lein, but arrdem, if I uninstall lein, how do I do a local install "using lein itself"?
19:07domgetterI mean, how can I use lein to do anything if I've uninstalled it? It seems contradictory
19:08domgetterOr did I misunderstand?
19:08ianhedoesitdomgetter: http://leiningen.org/
19:08justin_smithdomgetter: you put it in a directory that is on you path
19:08justin_smithdomgetter: it's a shell script
19:10domgetterjustin_smith: I'm trying to understand what arrdem wrote. If I've uninstalled something, how can I use it to do anything? Is leiningen different from lein?
19:11arrdemlein is the name used for leinigen's binary and is shorthand because nobody gets the spelling right and typing is hard :P
19:12arrdemmost of the extensions for leiningen are named lein-*
19:12domgetterokay so lein and leiningen are the same thing. got it
19:13domgetterI am still confused about your phrase "using lein itself"
19:13domgetteris that a different "lein" than the "leiningen" to which you referred earlier in your statement?
19:13arrdemnope.
19:13arrdemjust follow the install directions on leiningen.org
19:13ianhedoesitdomgetter: just follow the instructions on leiningen.org
19:13ianhedoesitoh
19:13domgetterI think there's some miscommunication
19:14domgetterwhen I say "different" I mean "different thing actually on my comptuer"
19:14domgetternot "short version of the same name for a general thing"
19:14arrdemthat'll give you a script, the file name of which is lein, and then you just run lein bootstrap to make lein set itself up.
19:16domgetterwhat danger is there in following the instructions on leiningen.org and not uninstalling whatever apt-get installed?
19:16domgetter(since the instructions don't say to uninstall any existing thing)
19:16justin_smithdomgetter: wrong thing being on your path
19:16justin_smithusing the wrong one by mistake
19:17arrdemyou'll have a package manager controlled copy likely at /usr/local/bin/lein and a new copy wherever you install it two. what justin_smith said.
19:17domgetterokay thank you
19:17domgetterthanks for everyone's advice, I know I can get hung up on little things.
19:18ianhedoesitdomgetter: it seems it might be helpful for you to learn a little bit more about how apt works/what it does
19:21amandabbok justin_smith im back
19:21arrdemSo before I go and write something totally evil
19:21arrdemAre there any existing Clojure libraries for generating Java?
19:21amandabbgot some dinner. question: can i not just have two files both with the same namespace and then reference variables without requires and imports and such?
19:22ianhedoesitarrdem: I'm confused
19:22justin_smithamandabb: files are mapped 1:1 to namespaces
19:22amandabbjustin_smith: at the top of two files i put (ns game.core)
19:22justin_smithamandabb: a namespace spread over multiple files is a bad idea (though I guess maybe technically possible)
19:23justin_smithamandabb: the way require works is that it finds the right file path based on the ns you require and loads it
19:23justin_smithit only loads one file for one require (recursively)
19:23arrdemamandabb: justin_smith: it is possible to have multiple namespaces in a file, as well as to spread a namespace over several files, however it is _awful_ practice.
19:23domgetterianhedoesit: it's just a package manager, no?
19:23rplacaarrdem: I think I've heard if such a thing
19:23amandabbwell
19:23justin_smitharrdem: yes
19:23ianhedoesitdomgetter: yes, but do you know what that entails?
19:23ianhedoesitdomgetter: why it's important and much different to get lein from leiningen.org than installing it via apt?
19:23domgetterianhedoesit: it will install packages and their dependencies at the versions specified?
19:24amandabbi have this data file and i dont want it to be in the same file as my other cljs file. would it be that bad to just have two files both in the same namespace?
19:24arrdemamandabb: justin_smith: Clojure may do this in places, but Clojure isn't especially good Clojure.
19:24amandabbit's just a single variable
19:24rplacaarrdem: I don't know a reference, but if it exists ztellman would know
19:24domgetterianhedoesit: I know that the versions can be old. that's fine. that's not what I was confused about
19:24justin_smithamandabb: you are asking for a lot of pointless hassle if you do it that way
19:24justin_smithamandabb: just give each namespace a file and visa-versa, much easier
19:24amandabbok i wont then
19:25arrdemrplaca: yeah I think alan dipert did one a while back and I think ztellman has worked with it
19:25amandabbshould i do a subnamespace or..?
19:25amandabblike game.core.data?
19:25rplacaamandabb: actually that's not that bad - just load a file directly while you're in a different namespace
19:25arrdemrplaca: or at least posted it at some point.
19:25justin_smithamandabb: there is no such thing as a subnamespace
19:25amandabb>.<
19:25amandabbi dont know what to do
19:25arrdemamandabb: namespaces are not higherarchical
19:25justin_smithamandabb: foo.bar.baz is not meanignfully a child of foo.abar
19:25rplacaamandabb: using load-file
19:25amandabbi cant use load file
19:25amandabbi think
19:25justin_smithamandabb: put the stuff in a file, use require
19:25amandabbim using cljs
19:26justin_smithamandabb: what's so hard about putting each thing in an ns, and requiring what you need?
19:26amandabbwell i was wondering if they should be the same namespace or not
19:26justin_smithamandabb: sorry, I shouldn't have nipicked about "sub-namespace" - it isn't a thing, but right now that doesn't really matter
19:26amandabblooks like most people say it's bad
19:26rplacaamandabb: ahh - I don't have enough experience there but I bet you could do it with some interop magic
19:26justin_smithrplaca: you can't load files from js, it's a security issue
19:28futuroamandabb: hmm...probably having a ns like foo.data where you put your defs/defonces is the easiest way
19:28rplacajustin_smith: good point. Maybe pre-compilation
19:30futuroamandabb: I'd probably give it it's own file right along side the other ns's, like I'd do with a util ns
19:30amandabbyeah im trying now
19:30amandabbrequire syntax is still kinda confusing to me
19:30amandabbis use deprecated?
19:31arrdemamandabb: pretty much
19:31arrdem(:require [foo :refer :all]) is preferred at least
19:31amandabbwhat
19:31amandabber
19:31amandabbwhat does the default do?
19:31amandabb (:require [foo])
19:31amandabbthat
19:32futurothough personally I prefer (:require [foo.data :as data])
19:32arrdemby default won't refer anything, it will just ensure that the other namespace has been loaded.
19:32arrdemhttp://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/refer
19:32amandabbthat line is a no-op?
19:32arrdemhttp://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/ns
19:32arrdemargh I need to add beter docs for ns
19:33amandabbyeah namespaces really confuse me in clojure
19:33futuroamandabb: you have to require a namespace before you can use it, and some of the directives in a require call give you different features
19:33amandabbso much stuff, as, refer, require, import, use, etc.....
19:33amandabbmost languages i've used just have one
19:35futuro(:require [foo]) means you can get access to function/data from the foo namespace by putting 'foo/' before whatever you want to access, and you don't have to worry about name collisions
19:35amandabbns, refer, require, use, import, exclude, load, refer-clojure, exclude, only, rename.. i think that's all of it
19:36amandabbo ok ill just do that
19:37futuroso you could have two functions named the same thing in two different namespaces, say foo/count and baz/count, and you can require foo inside your baz namespace, then use foo's version of count with foo/count, and baz's version of count with just count
19:37futurothe :as part lets you define a short name for the include
19:37futuroso if you have (:require [datascript.core :as d])
19:37futuroyou could use functions from datascript.core either by prepending the function name with 'datascript.core/' (minus the quote marks)
19:38futuroor with 'd/'
19:38futuroand that's about all you need to know to get started requiring things in clojurescript
19:40futurothere are two more directives to bring in macros; 1) :refer-macros inside of a require call, and (:use-macros), which is alongside a :require call
19:40futurobut when you need macros you can look those up
19:56{blake}OK...got a long process...want to output stuff to the screen while it's in-process. If I do a println, it comes out, but it's too much whitespace, so I want to do a print so I can put a bunch of indicators on a single line. Like a series of ".", e.g., "....". But print appears to cache its output so as to defeat the purpose and flush adds a newline. Any thoughts?
19:57justin_smith{blake}: flush
19:57justin_smith,(doc flush)
19:57clojurebot"([]); Flushes the output stream that is the current value of *out*"
19:57{blake}justin_smith: flush adds a newline, as I noted.
19:57justin_smith{blake}: uhh...
19:58{blake}justin_smith: Well, it is for me. =P
19:58{blake}In REPL and on commandline.
19:58justin_smithit shouldn't, it doesn't in my repl
19:58justin_smithkingfisher.core=> (do (print "a") (print "b") (flush) (print "c")(flush)) => abcnil
19:58{blake}Well, it does if you forget to remove the "ln" after the "print" while experimenting, smarty-pants.
19:59justin_smithhaha
19:59{blake}lol, year's off to a rip-roaring start! wooo!
19:59{blake}(thanks)
20:03Trioxinis CIDER in emacs more productive than intellij idea?
20:09ianhedoesitTrioxin: it's entirely up to your work style.
20:13justin_smithTrioxin: if you don't know emacs or intellij, intellij is more normal so most people would adapt to it faster
20:13justin_smithbut really some people prefer an emacs or vim, some people prefer an ide, they are different ways of doing things
20:29Trioxini know intellij well. never used emacs
20:31ianhedoesitTrioxin: then there's no real reason to learn an editor and a language.
20:31ianhedoesitunless you are already familiar and productive in Clojure and want to learn emacs. or just want to learn emacs in general.
20:37ridcullyamandabb: if its fixed data, you can slurp them in a defmacro
20:37amandabbnot sure what you mean. do u have an example?
20:38amandabbi got it working in any case
20:44ridcullyamandabb: put your e.g. setup.edn in resources/, add a clj file with basically a (defmacro pre-load [filename] (slurp (io/resource filename)). in your cljs call (pre-load setup.edn)
20:57celwellDear Clojurians, my (funded) startup is looking for a Clojure Engineer to work onsite at our Westwood, Los Angeles office: http://www.builtinla.com/job/clojure-engineer Please email me (chris at purpledelivery dot com) with any questions.
23:25nowprovisionI could probably test this but thinking out loud here, when doing a backup via mysqldump is the bulk of cpu usage in the client or the server?
23:25nowprovisionwrong room