#clojure logs

2015-08-06

01:05sdegutisHelp, I need Clojure help:
01:05sdegutisI need to figure out how to Clojure this:
01:05sdegutis ._ o o
01:05sdegutis \_`-)|_
01:05sdegutis ,"" \
01:05sdegutis ," ## | ಠ ಠ.
01:05sdegutis ," ## ,-\__ `.
01:05clojurebot""
01:05sdegutis ," / `--._;)
01:05clojurebot#<RuntimeException java.lang.RuntimeException: Unsupported escape character: \_>
01:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
01:05sdegutis ," ## /
01:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
01:05sdegutis ," ## /
01:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
01:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
01:07sdegutisHow can be done?
01:08scriptorI'm sorry, what?
01:08Kneivasdegutis: put that in a file, slurp it, profit
01:08scriptor^
01:09sdegutisThanks I will try to store it in long_horse.txt
01:09sdegutisamalloy: how am i doing
01:10amalloysdegutis: no more giant pastes of ascii art, please
01:11sdegutisamalloy: Phew, thanks.
01:12sdegutisOkay I think it's ready.
01:12sdegutis,(slurp "long_horses.txt")
01:12clojurebot#error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkRead nil -1]\n [java.io.FileInputStream <init> "FileInp...
01:12sdegutisThe file seems to be here, I don't understand.
01:28sdegutisThanks, regards
04:37tgoossensHow to create a new exception type in Clojure?
04:37tgoossensgen-class
04:37tgoossensor other wya?
04:50EmpperiI usually just use ex-data
04:50Empperiwhich doesn't provide a specific exception type but allows me to pass clojure data within the exception
04:50Empperiwhich is usually what I really want
06:36sm0keI am using this java api which is supposed to be used like Foo<Long> bar = foobar(0)
06:37sm0keWhich is all good, but it seems to default to Foo<Integer>
06:37sm0kethat is when used from clojure
06:37sm0keeven though i am passing foobar a long
06:38sm0keSo clojure has no generic is there a way to get around this
06:43justin_smithsm0ke: the jvm itself has no generics
06:43justin_smithsm0ke: that said, I am not sure how to use a polymorphic method that will take a long or int, because clojure likes to cast longs to ints if it finds an applicable int method
06:44sm0kehurmm
06:44sm0keis that true?
06:45justin_smithwhich part? the first part 100% - generics are a javac thing that has no representation in the bytecode
06:45sm0keWould forcing a (foobar (long 0)) help?
06:45justin_smithyou could try, or even a ^Long typehint
06:45justin_smithnot sure
06:46justin_smithI bet Bronsa would know, if he were around
06:46sm0keyes he has helped me a lot with type hints before
06:48sm0keI had this phase where i was on a microoptimizing spree and type hinted everything in my code
06:48sm0kegot a lot of help on typehiting primitives etc
06:48sm0keMetadata can only be applied to IMetas
06:48sm0kewhy the hell am i getting that!
06:48sm0keI am doing something like (.foobar o ^Long 0)
06:49sm0ke,(inc ^Long 0)
06:49clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
06:49sm0ke,(inc ^long 0)
06:49clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
06:50clausewitch0 is a java.lang.Long, which cannot have the metadata you want to set on it.
06:51clausewitchtype-hinting can only be done when defining variables (def, let ...)
06:51sm0kenot true
06:51sm0ke,(let [^Long o 0] (inc o))
06:51clojurebot#error {\n :cause "Can't type hint a local with a primitive initializer"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.UnsupportedOperationException: Can't type hint a local with a primitive initializer, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.UnsupportedOperationException\n :message "...
06:51sm0kehehe take that
06:52lumafieh, that's exactly what clausewitch was talking about. defining a symbol with let
06:54clausewitch,(do (def x 1) (let [^Long y x] y))
06:54clojurebot1
06:54clausewitchWhen inlining a value the type-hinting seems to detect that it's superflous.
06:54sm0keso what now ? how do i force a polymorphic method `foo` which takes int or long to force using long
06:55sm0kei am going to try (long 0) now, dont make much sense to me as 0 is already long
06:55sm0kebut justin_smith says otherwise
06:55justin_smithsm0ke: you could use reflection to explicitly use the long method... but that is ugly af
06:55sm0kejustin_smith: right thats a way
06:56justin_smithsm0ke: no, I wasn't trying to say that (long 0) would act differently from 0... I'm actually not sure if that would make a difference or not, but would suspect not
07:11PupenoI moved my source code to src/clj and adde this to my project.clj: :clj {:source-paths ["src/clj”]}, but I still get an error: Can't find ‘projectx.core' as .class or .clj for lein run: please check the spelling. What am I missing?
07:12clausewitchhave you made a lein clean?
07:13clausewitchand is the path of the file really "src/clj/projectx/core.clj" ? @Pupeno
07:13PupenoI run lein clean, but still getting the error. Yes, that path is correct.
07:15clausewitch@pupeno, does the core.clj-file compile when you open it and execute it expression by expression in emacs cider or similar?
07:16Pupenoclausewitch: yes... I didn't change anything else than move from src to src/clj (and src-cljs to src/cljs)
07:17clausewitchmy most common problems use to be either mis-spelled namespace name (check closely!), or something broken in the file or that I'm connected to multiple JVMs with different classpaths and search in the wrong classpath...
07:18clausewitch@pupeno maybe lein check gives you some clue as well.
07:19Pupenoclausewitch: lein check fails with a similar error: Exception in thread "main" java.io.FileNotFoundException: Could not locate projectx/core__init.class or projectx/core.clj on classpath., compiling:(/private/var/folders/k9/pgnpg2h92bv157mw70mhznk80000gn/T/form-init206702167269887237.clj:1:124)
07:20PupenoClearly lein is not picking up on :clj
07:22clausewitch@pupeno , when I read {:source-paths ["src/clj”]} you pasted above, the last cite mark looks a bit fishy. Is it the ordinary one (") in your project.clj-file?
07:23PupenoYes, it's an ordinary double quote.
07:25Pupeno:source-paths ["src/clj"] (not inside clj) worked.
07:26clausewitch@pupeno well, my best bet is that there is a misspelling somewhere. could to execute the file from form by form? lein repl and cut and paste to the repl worst case...
07:27PupenoThere was no misspelling anywhere and yes, all my code was fine, I only moved and it was working before. The way you specify the source path in a lein project is :source-paths ["src/clj"], not :clj {:source-paths ["src/clj"]} which is what https://blog.8thlight.com/andrew-zures/2014/03/08/combining-clj-and-cljs-libraries.html recommended
07:27clausewitch@pupeno but hey! you should not put the source-paths in a :clj key!
07:28Pupenoclausewitch: yes, that's what I said.
07:28clausewitch@pupeno the :source-paths for ordinary clojure code is in the "root" of leiningen config...
07:28clausewitchOK :)
07:30clausewitchcould you put your project.clj in a gist or something?
09:23kwladykahmm which library should i use to abs?
09:23kwladykaalgo.generic?
09:23BronsaMath/abs
09:24Bronsa,(Math/abs -1)
09:24clojurebot1
09:25kwladykaBronsa, mmm so easy answer :)
09:25kwladykaBronsa, so i called as java function?
09:26kwladykabecause i see https://clojure.github.io/clojure-contrib/math-api.html is deprecated
09:26kwladykaand i am a little confuse
09:27Bronsahttps://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
09:27Bronsajava.lang.Math should have most of what you need, why bother using wrapper libs when you can directly interop
09:27kwladykaBronsa, so directly from Java
09:28kwladykaBronsa, to not mix languages but in this case it has sense to use Java directly
09:28Bronsayes
09:28Bronsakwladyka: "not mix languages" doesn't make much sense in clojure
09:28kwladykaBronsa, ?
09:28Bronsakwladyka: clojure is built on the jvm to leverage its libs
09:29kwladykaBronsa, yes but i mean about code
09:33snowellWhat's conceptually different between (Math/abs -5) and (abs some/lib -5)?
09:33snowellIn a sense, the interop is actually easier to figure out, and certainly to maintain
09:59sveriHi, How do I realize lazy seqs in selmer when not using for? Is there a way to do that?
10:02Empperidoall
10:03Empperiis my guess :)
10:03Empperidon't know selmer
10:03sveriEmpperi: yea, that works, but I have to do it in clojure then
10:11Empperitold you I don't know selmer :)
10:11Empperiright, some kind of templating library
10:13tdammersdo you have a strong use case for selmer?
10:14tdammers'cause otherwise I'd recommend going with something more clojure-y, like hiccup or enlive
10:14tdammersselmer is pretty limited even compared to its brethren in other languages (say jinja2 or twig)
11:07sdegutisBack.
15:02kwladykais function like (filter-not f) instead of (filter f)? Something with oposit boolean value to filter
15:04scriptor,(filter odd? (range 10))
15:04clojurebot(1 3 5 7 9)
15:04scriptor,(remove odd? (range 10))
15:04clojurebot(0 2 4 6 8)
15:05scriptorkwladyka: is that what you want? ^
15:05sg2002, (select odd? (range 10))
15:05clojurebot#error {\n :cause "Unable to resolve symbol: select in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: select 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: select in t...
15:05herrwolfeusing clojure trace, is there a way to tell if a transaction on a ref is being retried?
15:06kwladykascriptor, ah right... i always use remove with sets, i totally miss that
15:06kwladykathx
15:11sveritdammers: not really, from my point of view it's just the go-to templating library coming from a different framework like django
15:12tdammerssveri: I don't know how well django fares, haven't used its templates a lot
15:13sveritdammers: yea, no problem, I am just saying. I also used hiccup and enlive a lot, I just think that newcomers might recognize the templating principles from selmer more than hiccup or enlive (of course, YMMV)
15:14tdammersofc
15:14tdammersselmer is more traditional
15:14tdammersand in fact, if your workflow involves frontend people (web designers and the like) who aren't comfortable with programming, then selmer is the better choice
15:18{blake}Hiccup is awfully close to HTML. My front-end peep didn't have a problem with it at all. (As another data point.)
15:18{blake},clojure.core/println
15:18clojurebot#object[clojure.core$println 0x4735824e "clojure.core$println@4735824e"]
15:18{blake},core/println
15:18clojurebot#error {\n :cause "No such namespace: core"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such namespace: core, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "No such namespace: core"\n :at [clojure.lang.Util runtimeException "Util.java" 221]}]...
15:18{blake},println
15:19clojurebot#object[clojure.core$println 0x4735824e "clojure.core$println@4735824e"]
15:19{blake}&println
15:19lazybot⇒ #<core$println clojure.core$println@bc5eb66>
15:19{blake}I thought that had changed.
15:41{blake}Was there ever a good reason to not have the namespace qualified? Seems like if I had a different core, like "mylib.core" with a println, it would collide.
15:53gfrederickswhat's bothering you exactly, and what's the failure scenario?
15:55Bronsa{blake}: that's just how objects print
15:55amalloywhat do you mean, {blake}? what did you think had changed?
15:55{blake}Just trying to get a mental model of what's going on.
15:56{blake}Well, what's changed is that older versions would NOT display the qualifying namespace, just the last part of it.
15:56BronsaI don't think so
15:56Bronsathat's the default Object toString
15:58{blake}I'm looking at the difference between clojurebot and lazybot. (Because I've seen it on my machines between 1.6 and 1.7)
15:58Bronsaah, I thought you were talking about clojure
15:58Bronsa&*clojure-version*
15:58lazybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
15:58Bronsa,*clojure-version*
15:58clojurebot{:major 1, :minor 8, :incremental 0, :qualifier "alpha3"}
15:58{blake}OK, between 1.7 and 1.8 there was a change.
15:59Bronsayes, in how the repl prints objects and exceptions
15:59{blake}Is it just display related?
16:00{blake}(OK. Cool. I'm trying to write stuff up and this invariably results in all kinds of little questions.)
16:00swn_I have a function foo that works, but when I call (repeatedly 5 #(foo arg1 arg2)) it doesn't get called. Why might that happen?
16:03alex_engelbergswn_: repeatedly returns a lazy sequence, so foo is only evaluated as you request more items from that sequence.
16:03puredangerIt's lazy and you didn't ask for anything from it
16:09sdegutisIs there a performance advantage of (def foo (comp bar quux)) instead of (defn [x] (bar (quux x))) ?
16:12Bronsasdegutis: written exactly like that, comp doesn't create a new class while defn does
16:12sdegutisOh. Wow. Did not know.
16:12sdegutisThat's impressively intimate knowledge of Clojure, Bronsa.
16:15sdegutisGood bye.
16:26thearthursorry to show my ignorancs here, though when reading the docs for clj-refactor I keep seeing instructions like "1st tabstop lets you type out the namespace, the example in [example :refer [foo]]" and I'm not sure what to google for to find out how to type a tabstop. the emacs manual defined tabstops as column numbers for indenting, which I suspect is not the same thing. What is a tab stop in this context? and how do I type one?
16:28magnarsyou press tab to jump between tab stops
16:28thearthurhitting tab in this context does nothing I can see
16:29magnarssounds like yasnippet isn't working properly for you
16:31magnarsI don't think digging into why is very interesting to the people in this channel, so please do open an issue on the github repo for more help if you need it. :-)
16:36swn_got it, thanks
16:53thearthurmagnars: problem is already known and fixed, and yas-monor-mode must be enabled for clojure-mode
16:53thearthurmagnars: thanks very much. These little things make a huge difference, and I'm giving a talk on this at the SF meetup in about three hours, so it's nice to have it working
17:07{blake}in-ns has no source? =P
17:08amalloy{blake}: no, it is a special form
17:08{blake}amalloy: I'm reading the documentation and not getting what it buys you versus ns. It looks like both create empty namespaces.
17:09amalloyns is built on top of in-ns
17:09amalloyyou never really have a good reason to use in-ns yourself unless you have accidentally created a broken namespace that doesn't have ns in it
17:10TimMcamalloy: What about switching namespaces as the REPL>
17:10TimMc*at the REPL?
17:10amalloyns is fine for that, TimMc, although in-ns works too
17:10TimMcah, OK
17:10amalloy,(macroexpand-1 '(ns foo))
17:10clojurebot(do (clojure.core/in-ns (quote foo)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))) (if (.equals (quote foo) (quote clojure.core)) nil (do (clojure.core/dosync (clojure.core/commute (clojure.core/deref (var clojure.core/*loaded-libs*)) clojure.core/conj (quote foo))) nil)))
17:10{blake}clojure.org/namespaces => At the Repl it's best to use in-ns, i
17:11amalloyso, (ns foo) expands to (in-ns foo) followed by a bunch of useless junk that doesn't really matter
17:11{blake}amalloy: OK, cool.
17:11stuartsierra`(ns foo)` automatically refers all of clojure.core, which will break namespaces that use `:exclude-clojure`
17:12amalloyyes, that seems to be the difference
17:12amalloyso like, i use in-ns in the repl too, but "most of the time" ns is fine
17:13{blake}I haven't had much call for using ns in the REPL. Oh...but I suppose I would if I were debugging a running one.
18:14futurocan anyone point me to docs related to the 'map->' macros/fns?
18:14futuroI'm seeing it used in the component library (and referenced elsewhere), but I can't find documentation on it
18:14hiredman,(doc defrecord)
18:15clojurebot"([name [& fields] & opts+specs]); (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given f...
18:15futurohiredman: I'll give the docs for defrecord a look, thank you
18:15hiredmanyep
18:16sdegutisWhy in the world does defn creaet a Jaba class¿
18:16sdegutis*create
18:16hiredmanrefering to them as `map->` functions maybe confusing to some people, they are the factory functions defrecord creates
18:16sdegutishiredman: yeah Clojure doesn't really have a single consistent naming convention
18:17sdegutisThen again what language does?
18:27futuroahh, ok, having that terminology is very useful
18:27futuroI've only ever seen them as map->"Insert some record name here", so I didn't really know what to call them
18:30hiredmanyeah, they are "just" functions, but they happen to appear out of thin air whenever there is a defrecord
18:30Bronsasdegutis: a java class is the only compilation unit the jvm understands
18:31sdegutisBronsa: But (def foo (comp baz quux)) doesn't create a Java vlass?
18:31Bronsasdegutis: (fn ..) creates a java class, (defn expands to def+fn, juxt doesn't
18:33sdegutisBronsa: So what does (def foo 2) compile to?
18:35amalloysdegutis: it adds a line to the my.ns.__init static initializer which sets the var my.ns/foo to Long.valueOf(2)
18:35Bronsasdegutis: it just gets compiled in a static method f the naespace init class setting foo to 2
18:36Bronsasdegutis: or, if compiled at the repl, it just invokes #'foo.bindRoot(2)
18:36Bronsas/compiled/executed/
18:39sdegutisamalloy: AMAZING
18:39sdegutisI never knew Java was suck an unnecessarily convoluted language!
18:40amalloyso far nobody is talking about java
18:50{blake}The vector form of require...is that essentially [namespace {:key value...}], only with the curly braces sugared out?
19:08rpaulo_]
19:18sdegutisamalloy: Long.valueOf(2)
19:19amalloywell, it's not java's fault that clojure stores boxed Longs instead of primitive longs
19:22sdegutisOh JVM.
19:35wickedshellI'm reading a stream of data off a serial port and passing it into a byte array of size 256. I'm reusing the array but unfortunately do to the reuse internally it seems that I keep getting new objects returned causing a *large* number of garbage collections which is causing a problem
19:35wickedshellIs there anyway to get a mutable refernce to just the byte array without any other handling? It's a special case here where reusing the buffer is required
19:36hiredmanyou likely think you re-using the byte array, but are not actually doing that
19:36hiredmanso the best thing to do is share a small bit of code that shows you reusing the byte-array
19:37wickedshellthe ref has stayed the same the whole time
19:37wickedshelllet me paste it in somewhere
19:39hiredmanthe jvm gcs are very good too, so in order for a 256 byte byte-array to be causing lots of garbage collection you must be creating a ton of them in a very tight loop
19:39wickedshellhiredman, http://pastebin.com/g3H1CjHz
19:40wickedshellyeah I have a continous input stream of ~1mb/s or so
19:40wickedshellbut I have to handle the messages as fast as possible
19:40wickedsheller decimal place was wrong, sorry ~100kb/s
19:41hiredmanwhat makes you think that a large number of garbage collections is causing whatever problem you are seeing? (also what problem are seeing?)
19:42wickedshellI'm watching in jvisualvm climb up to to 750MB used then it drops down to ~100mb after GC. This is the only additional work that is being performed
19:42wickedshellbasically excess amount of time being spent in the GC (particualrly on a memory constrained system which is the target)
19:43hiredmanso that is more or less how the gc works, allocations happen until it hits a threshold then they are free'ed at once
19:43wickedshellright, my concern is that I really don't need to be reallocating in this case
19:44hiredmanI don't see anything in the code that would lead me to conclude that it is doing lots of allocations, what makes you think it is?
19:45wickedshella large byte[] that keeps growing in the profiler, and it's the only place I use the byte's. Although it is possible that instead some other class has a ton of internal byte[]'s
19:45wickedshellI can't figure out a good way to track down what is causing allocations
19:45justin_smitha byte[] doesn't grow
19:46wickedshelljvisualvm lumps stuff by class name
19:46hiredmanwell, you can verify if that code is causing allocations or not by disabling it and running the rest of the project
19:46amalloy,(get (into-array ["test"]) 0)
19:46clojurebot"test"
19:46wickedshellso all byte arrays are under the same name
19:47amalloyhuh. i didn't know you could use get on arrays
19:47hiredmanif memory usage drops then either it is that code or something downstream
19:47wickedshellamalloy, I'm stupidly reliant on that due to other libraries :P
19:47hiredmanamalloy: RT.get special cases arrays
19:48hiredmanso then disable things that are logically downstream of that code, if the memory usage remains constant, then it something downstream
19:48hiredmanetc etc
19:48wickedshellyeah, going through it now.
19:49amalloythis code is probably allocating a lot of Byte objects, but not byte[]s
19:49hiredmanwhich jvm are you using on your target? a lot of linux distros on things like the pi install jvms that are not very good by default
19:50hiredmanoh
19:50hiredmanof course because of the get
19:50wickedshellopenjdk
19:50wickedshellalthough I also deploy to jdk8
19:51hiredmanjust so long as it isn't jamvm or whatever
19:51hiredmanwickedshell: amalloy brings up a good point, are you sure you are seeing byte arrays allocated or are you seeing Byte objects?
19:52wickedshellByte[] is the prmary culpriate but Byte is the 4th largest consumer atm
19:52wickedshellso yeah I'd say amalloy is right on the large number of byte's
19:52hiredmanyou are also comparing the byte array to nil, which is weird
19:52hiredmansomething in a byte array cannot be nil
19:53amalloywickedshell: Byte[]!? are you sure you don't mean byte[]?
19:53wickedshell~543 thousand Byte's atm going up at ~50k a second, till it hc's
19:53clojurebotPardon?
19:53wickedshellamalloy, your right
19:53wickedshellbyte[] and java.lang.Byte
19:54amalloyanyway hiredman is right that you can't ever get a nil out of that array, so in addition to performing poorly i have to imagine your code is incorrect
19:54wickedshellthe array has nil values in it
19:54amalloyno, it doesn't
19:54hiredmanit cannot
19:54wickedshelloh no your right
19:54wickedshellI still need a get later though :/ stupid library wants to parse MAVLink one byte at a time
19:55wickedshellrequires a byte passed in then returns a message if it got one
19:55hiredmanuse aget
19:55hiredmanand you will want to type hint the byte array
19:56wickedshelleven though the byte array was declared with byte-array I should still retype hint it?
19:56hiredmandeclared where?
19:57wickedshellfirst line of the paste
19:57wickedshell(def buffer (byte-array 256))
19:57hiredman(def buffer (byte-array 256)) creates a byte array puts it in the var bound to buffer, it does not convey any typing information to the compiler
19:58hiredman(or in another point of view it does, the compiler just ignores it)
19:58wickedshellcan I hint it at that point or do I need to hint on the aget line? I've been somewhat unsure on the scoping of hints and generally have them in let statements
19:58hiredmanwickedshell: I would rebind it to hinted a local
19:59hiredman(let [^bytes buffer buffer …
20:00hiredmanyou should consider setting *warn-on-relection*
20:00wickedshellI periodically turn it on/off. It's never been unhappy there
20:01amalloywell yeah, because you are using an untyped get operation
20:01amalloyif you used aget you would see reflection warnings i think
20:01hiredmanwell, "polymorphic"
20:10xcthulhuHey! I am a clojure veteran, clojurescript n00b
20:11xcthulhuI am trying to write an isomorphic implementation of bitpay’s bitauth library in clojure/clojurescript
20:11xcthulhuhttps://github.com/bitpay/bitauth
20:12xcthulhuI managed to make a 100% API compatible implementation in clojure: https://github.com/xcthulhu/clj-bitauth
20:12xcthulhuBut I’m retarded at wrapping javascript in clojurescript and unit testing this stuff
20:12xcthulhuA little hand holding for a n00b would be appreciated!
20:12xcthulhuty
20:19BinaryResultLove gaming & Clojure? Disco Melee is hiring remote devs to build our social streaming platform https://docs.google.com/document/d/1AZNGw7QaoN7jY8MjwpxcKcTTwqjUM7q--2W3aRM36yI/edit?usp=sharing
20:24TEttingerBinaryResult: I'm kinda curious if this is a mass mailing thing
20:24TEttinger(supply more info to confirm non-bot-ness?)
20:28BinaryResultsure what would you like to know?
20:28BinaryResultsee us for yourself http://beta.discomelee.com/
20:28BinaryResult:)
20:29TEttingerjust wanted to make sure it wasn't like a spambot that saw #clojure and substituted "#" with "Love gaming and "
20:29BinaryResultunderstood
20:29TEttingerglad you picked clojure
20:30TEttingerthat site looks nice
20:30BinaryResultyea going very well so far :) I'm more of a founder/investor non-technical but our CTO is very selective
20:30BinaryResultty
20:30BinaryResultlots in store
20:30BinaryResultneed the team to build it out
20:31BinaryResulthave to run to hockey game, hope to hear from all the clojure gamers ;)
20:31TEttingerI'm guessing the business angle is, "holy crap every console is adding social features, if we can make a better platform we can sell the platform for gobs of gold"
20:31TEttingerwhich seems solid to me
21:51sovertondoes anyone here use figwheel?
21:52justin_smithyup, it's the best
21:53sovertonI'm trying to get figwheel to bind to a non-localhost ip address, but it seems to ignore the :server-ip setting in the project.clj file. It's driving me crazy.
21:53justin_smithwouldn't it be easier to make a tunnel with ssh?
21:53justin_smithseems like binding to a non-localhost port is just asking for trouble
21:54sovertonwell, it's not a real device. It's on a virtual network.
21:54justin_smithOK
21:56sovertonthe reason I avoided ssh tunneling is because I'm running MS windows 8.1 in virtualbox so I can test out my page on internet explorer. I don't know much about ms windows in the first place.
21:56soverton(I'm running Linux, btw)
21:57justin_smithcan't you map the figwheel port over the vm?
21:59sovertonyeah, I can try that. I just thought that maybe I was screwing something up in the figwheel config section, but I guess I'll just do a workaround like port mapping...
21:59clojurebotI don't understand.
22:02sovertonjustin_smith: thanks for the help :)
22:04justin_smithsoverton: it might be possible, I just wouldn't know how
22:14andrew_hi everyone. i'm trying to write a nested lazyseq structure -- something like ((nil nil ("A" "B") nil) (nil ("C" "D "E"))) -- to csv using clojure.data.csv, but the innermost lazy seqs just don't seem to want to be evaluated. could anyone point me in the right direction?
22:15TEttingerandrew_: you want to evaluate ##("A" "B") ?
22:15lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
22:15andrew_yeah
22:15TEttingerI assume you don't want that classcastexception
22:16TEttingeryou may want one of the dorun, doseq, doall family of macros
22:16TEttinger,(class (map inc [1 2 3]))
22:16clojurebotclojure.lang.LazySeq
22:16TEttinger,(doall (map inc [1 2 3]))
22:16clojurebot(2 3 4)
22:16andrew_i'm trying to write to csv and get something like ",,,A B,," but instead i'm getting ",,,clojure.lang.LazySeq@whatever,,"
22:17TEttingerohh
22:17TEttinger(doc doall)
22:17clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
22:17TEttingerhm I think that isn't the right one
22:18andrew_it feels like i might need to do some kind of recursive doall or something
22:19TEttinger,(repeat 3 (repeat "A"))
22:19clojurebot(("A" "A" "A" "A" "A" ...) ("A" "A" "A" "A" "A" ...) ("A" "A" "A" "A" "A" ...))
22:19TEttinger,(str (repeat 3 (repeat "A")))
22:19clojurebot"((\"A\" \"A\" \"A\" \"A\" \"A\" ...) (\"A\" \"A\" \"A\" \"A\" \"A\" ...) (\"A\" \"A\" \"A\" \"A\" \"A\" ...))"
22:19TEttingerdamn, how to reproduce this with a bot...
22:19TEttinger&(str (repeat 3 (repeat "A")))
22:20TEttinger&(str (repeat 3 (repeat 7 "A")))
22:20lazybotExecution Timed Out!
22:20lazybot⇒ "clojure.lang.LazySeq@f960151f"
22:20TEttingerthere we go.
22:20TEttinger&(pr (repeat 3 (repeat 7 "A")))
22:20lazybot⇒ (("A" "A" "A" "A" "A" "A" "A") ("A" "A" "A" "A" "A" "A" "A") ("A" "A" "A" "A" "A" "A" "A"))nil
22:20TEttingerso that's one way
22:20TEttinger&(pr-str (repeat 3 (repeat 7 "A")))
22:20lazybot⇒ "((\"A\" \"A\" \"A\" \"A\" \"A\" \"A\" \"A\") (\"A\" \"A\" \"A\" \"A\" \"A\" \"A\" \"A\") (\"A\" \"A\" \"A\" \"A\" \"A\" \"A\" \"A\"))"
22:21TEttinger&[(str (repeat 7 "A")) "," (pr-str (repeat 7 "A"))]
22:21lazybot⇒ ["clojure.lang.LazySeq@48f3b8c0" "," "(\"A\" \"A\" \"A\" \"A\" \"A\" \"A\" \"A\")"]
22:21andrew_there it is
22:21andrew_nice
22:22andrew_i mean, reproducing it anyway
22:22justin_smithso for the readable version, us pr rather than print, pr-str rather than str
22:22andrew_ok, i'll give that a shot
22:22andrew_many thanks
22:23justin_smithandrew_: also, with a lib like data.csv this might be handled smartly for you already
22:23justin_smithandrew_: for exampl,e, I doubt you want the , that pr-str might put into a collection
22:25andrew_i actually do want that comma in this case -- i wonder if data.csv is a little too fancy for me here
22:34wickedshellDifferent problem (still tracking down the memory problem) but I came across this function. I have a for loop that when called from another function (java repaint of a component) it doesn't print anythingn within the for loop, but if I manually call it from the REPL with the same agruments it prints the contents in the for loop. http://pastebin.com/8KXXCFb2 anyone ever encountered something like this?
22:34wickedshell(all the early content prints out before the for loop regardeless of where its called)
22:50TEttingerwickedshell: for returns a lazy sequence
22:51wickedshellTEttinger, ohh so you're saying its never evaulating the prints?
22:51TEttingerso the repl evaluates the lazy sequence, but just calling (for [x (range)] (print x)) won't do anything if you aren't in the repl
22:52TEttingerif you did that in doall, or changed 'for' to 'doseq', it would infinite loop printing numbers
22:53TEttingerand yeah, what it's printing in the repl is the evaluated lazy seq (the better term may be realized, rather than evaluated, here, not sure)
22:53TEttinger&(for [x (range 4)] (print x))
22:53lazybot⇒ (0123nil nil nil nil)
22:53TEttingerprint returns nil
22:53TEttingerthe (nil nil nil nil) is the return
22:54TEttingerit printed 0123 at the same time because quirky irc bot
22:58wickedshellTEttinger, thanks! I'm an idiot. I had solved that before and just spent another hour on it by accident.... :( thanks!
22:59TEttingerheh, it's a really easy mistake to make
22:59TEttingerfor is a little... misleading if you expect it to be like a java/C/C++/C# for loop
23:00TEttingerit really behaves closer to a haskell or python for comprehension, and I think haskell doesn't even call it for
23:48magnarsthearthur: cool, glad you got it working. :) how did the talk go?