#clojure logs

2015-01-09

04:54Biofobico.
04:55clgv;
04:55clgv,;
04:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:03TEttinger,#_;
05:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:04rhg135Is ; not a form?
05:05rhg135Anyway I'm out of here, 4am comes too soon
05:08TEttingerrhg135, it is not a form, it's ignored, like #_()
05:11CookedGryphondoes anyone have any hints for debugging core.async? Something is putting a bad value into a channel, but even though I can make the channel explode when the bad value is inserted, the stacktrace is no use because it's all core.async run_state_machine etc.
05:12CookedGryphonis there any way I can determine what code is doing the bad put?
05:21H4nswhat is an efficient way to construct a large map? when i just assoc it together in, say, a reduce, would this create a copy of the map for every item that i insert? is there a way to avoid that and still yield a persistent map in the end?
05:22slipsetyes, there is, and it's used in transducers (I think)
05:23slipsethttps://clojuredocs.org/clojure.core/transient
05:24H4nsah, nice! thanks!
05:25CookedGryphonAre there any clojure core guys about? What's the status of the next release of core.memoize. There's a few things that have been patched in master for months but there hasn't been a release in over a year. Does anyone know if there's something holding back a release?
05:35TEttingerH4ns, yeah transients are awesome for performance, but be aware that they do not support the full group of seq/collection fns
05:36TEttinger(really just the bare minimum)
05:36H4nsTEttinger: i have actual performance issues that i need to deal ith, so they should be fine.
05:37BiofobicoI just start learning clojure as my 1st language, but I'm having a hard time wrapping my head about how programs are written. I have the felling that clojure code is written inside out. I have no problem starting every line of code with a "(", but i find that many times I have to add parenthesis outside the first one. As example: ((fn [who] (str "Hello, " who "!")) "Neo")
05:37TEttingerBiofobico, that's correct. more typically you'd define that fn outside though
05:37H4nsi have some 10 million records to read into memory, and that seems to be beyond the comfort zone where straight maps and persistent collections work well.
05:37BiofobicoIs the any tips for a noob to try to understand better this inside out type of writing?
05:38TEttinger,(defn hello [who] (str "Hello, " who "!"))
05:38clojurebot#'sandbox/hello
05:38TEttinger,(hello "Neo")
05:38clojurebot"Hello, Neo!"
05:38BiofobicoMakes sense now :)
05:39TEttingertypically it's better for things you use more than once to have names, but if you don't want to def something, you can use let
05:40BiofobicoI am following a tutorial and probably that type of syntax will be later on on the tutorial
05:42TEttinger,(let [hello (fn [who] (str "Hello, " who "!"))] (hello "Neo"))
05:42clojurebot"Hello, Neo!"
05:43TEttingerlet is very very common in clojure code, and thankfully it's pretty simple (unless it involves destructuring, but that's so cool it's worth it :D )
05:47Biofobicoso that code is saying that hello = "Hello, " and [who] = "Neo" ?
05:51TEttingerBiofobico, yeah, although [who] isn't quite right, who is "Neo" and the [] just shows that the arguments vector is what's inside it
05:52TEttingeractually not quite right
05:52TEttingerhello is not right away "Hello, !"
05:53TEttingerhello is a fn that takes an argument called who, and sticks who in a string with "Hello, " on one side and "!" on the other, and returns the new string
05:53TEttingerthe tutorial will get to defining fns soon I hope
05:54TEttingerbut it's the most important early concept in almost any programming language, being able to make abstractions
05:56Biofobicothank you for the clarification :)
05:56TEttingeranother popular textbook (one that's probably harder for beginners), Structure and Interpretation of Computer Programs (SICP) refers to programming as the art of giving names to things (paraphrasing here, I haven't read much of SICP)
05:57TEttingerclojure has a lot of really well-named functions in its standard library :)
05:57TEttingerstuff like frequencies
05:57TEttinger,(frequencies [:a :a :a :b])
05:57clojurebot{:a 3, :b 1}
05:58Biofobicoon my online search for clojure tutorials, that book was mentioned a few times but only when one as some clojure experience. Another one was the joy of clojure
05:58the_freytbh SICP is a beginner textbook for CS, not practical programming, one of the 'Hard Way' series of books is maybe a quicker and more hands on intro to how things like assignment and evaluation actually work
05:58TEttingerbrave clojure I have heard good stuff about, not sure about first language stuff
05:58the_freythe O'Reilly Clojure textbook assumes you already know like Ruby or something, a lot of the examples refer to ruby/java
05:59the_freyTEttinger: brave clojure I found pretty useful coming across to clj from ruby/python
05:59TEttingerdon't be afraid to ask questions over IRC though, there's almost always someone online who is able to help
05:59the_freyparticularly the stuff on bootstrapping an emacs cfg
05:59the_frey+1
05:59the_freyclojure irc is one of the best behaved and helpful channels I know of
06:00BiofobicoI only know html and css. i tried ruby, php and python. found ruby and python somewhat similar and php plain alien stuff
06:01TEttingerI've been in #java . I recall answering a question, then getting someone soliciting to pay me to do his homework. I may have convinced him to switch majors to law or finance, one of those things that does better the less ethics you have
06:01Biofobicothen i stumbled on clojure by chance
06:02Biofobicoand while the syntax is very dif from those languages, it made more sense to me
06:03the_freyBiofobico I think the simplicity of how a lot of clojure reduces down to fundamentals probs makes it a good first lang
06:03the_freybut it's not 'C-like' as a lot of langs are (e.g. python/ruby)
06:05Biofobicomy goal is web dev. Since I already know html and css, i decided to learn a prog. language and also javascript
06:06the_freyBiofobico for web dev I'd learn ruby or python tbh
06:06the_freythere are more jobs
06:06TEttingerBiofobico, yeah, the immutable data thing in clojure really helps certain kinds of thinkers reason about programs. if clojure made more sense to you than traditional imperative languages (stuff like java, C, and C++), then it's a good bet the rest of the language will catch on easily
06:06Biofobicoafter i decided to learn clojure, i read that there is clojurescript
06:06the_freyalso javascript is a programming language :P you can use js for the server side stuff with node.js
06:07TEttingerit's really worth it to learn lots of languages, especially at the mid-point of your learning experience
06:08Biofobicoi know js is a programming language :)
06:09the_freyTEttinger I dunno, think it depends on your level of experience, pays to focus aggressively on one first no?
06:09TEttingerI kinda think early on you want to learn the fundamentals in one language, not shifting too much, then once you grasp how things are put together you can start again and learn a second language, this time much faster, until you have learned enough different kinds of language that you can just say, "oh, a delegate in C# is just the same thing as a function signature in haskell"
06:09the_freybut yeah learning clojure is useful as it's so different, it'll make you a way better programmer
06:09TEttingerexactly
06:09Biofobicobut if i understand it correctly, clojurescript is clojure with some modifications
06:10the_freyyep couldn't agree more with what you said there TEttinger
06:10TEttingeryeah, clojurescript also uses clojure (the kind you are learning now) during certain kinds of code
06:11TEttingerso it helps to know clojure first if you want to write macros in clojurescript, but the two are other than that almost identical
06:11TEttingerthe standard lib is almost the same
06:13TEttingerI'd say for a second language, javascript is your best bet. it's obviously a useful job skill for web stuff, heh, and it's very different from clojure in a lot of ways. it will certainly make you appreciate clojure more :P
06:14the_frey+1 JS is a batshit language, but it does teach you how to use functions as data in very practical ways
06:16TEttingerbut there's a good piece of news if you do learn clojure then javascript; I've been looking at something called Ki that makes clojurescript data structures available to JS (using a lib called Mori written by someone in here I think) and lets you intermingle (map inc [1 2 3]) style stuff with javascript code
06:16dysfuncan you get the edn reader to annotate line numbers?
06:17TEttingerso you could pretty easily bring in code you wrote for clojure into your pure JS programs
06:19Biofobicomy plan is to get the basics of clojure, then build a website with it and also clojurescript to force me to push myself and also as a motivation factor
06:20TEttingerah cool
06:21Biofobicothen try to write in js what i wrote in clojurescript
06:21zoti'm having strange problems using cider to connect to remote repl (riemann) — this is cider 0.9.0-SNAPSHOT, although it was failing the same with an earlier version. I get a tramp error like this, every time when I specify just the hostname: ControlPath too long
06:21Biofobicoif that makes any sense as a learning experience
06:21TEttingerBiofobico, yeah it does
06:22zotif i type in hostname:5557 (port) for the hostname, it then at least prompts me for the port, where I type 5557 again; then it fails during authentication every time, even though my ssh-keys, etc. all appear to be in place. (and they work in another window.)
06:22zotany suggestions on how to debug this?
06:22TEttingerI'm rewriting a similar program now in F# after writing it in C#, then Scala
06:22TEttingeractually then Java, most recently
06:22dysfunf# is a horrible language
06:22dysfunas is java
06:22dysfunas is scala
06:22dysfunc# is just java with slightly better designed libraries and a different runtime
06:23TEttingerI definitely agree about java and scala, I only use java because it was faster to prototype something with a particular lib
06:23dysfunand a few more 'kitchen sink' language features
06:23dysfunbut scala has the kitchen sink element down
06:24dysfunfaster than repl driven development?
06:26mearnshTEttinger: there's also fogus' lemonad https://github.com/fogus/lemonad
06:27winkdysfun: why do you think repl-driven is always fastest?
06:33dysfuncompared to the recompile cycle?
06:33dysfununless you've got something like jrebel, no chance.
06:34winkcompared to other languages where you just write code, tests, and rerun a module/class whatever like 2-3x and it's done
06:34winkI mean, I do a lot of python and I don't see myself rerunning stuff so often that I'd prefer a repl
06:34winkon clojure I'm just too bad to write it correctly the first few times, then a repl is awesome
06:35SagiCZ1wink: well compared to the traditional java cycle.. its a big difference
06:35SagiCZ1and AFAIK, python does have REPL so the comparision is moot
06:35winkit's not moot if I don't use it
06:37dysfuni will say that testing in perl is a joy because perl doesn't rely on the jvm so bootup times are tiny
06:37SagiCZ1but python is interpreted.. not compiled.. so there is smaller delay
06:37dysfunbut autotest is pretty good these days, so i get pretty quick tests
06:37SagiCZ1and its not just about speed.. its about experimenting with something you would rather not change in your source code
06:38dysfunyeah, the repl is all about playing with things so you can understand how they work
06:39SagiCZ1i use it for interactive GUI development.. for example Swing frame does take its sweet time to appear.. if i never close it and just maniuplate the contents in REPL, i can position the frame where i want on my screen and it stays there
06:39dysfuni'll often learn more that way than writing tests
06:39dysfunor reading the docs. some docs are terrible
06:39dysfuni find myself reading other peoples' clojure code a lot
07:41daniel_[
07:41daniel_]
07:41atankanowdestructuring in clojure is awesome ... that is all
07:42daniel_clojure is awesome
07:42SagiCZ1+1
07:42CmdrDats(inc atankanow)
07:42lazybot⇒ 1
07:43atankanowthanks!
07:49daniel_(inc atankanow)
07:49lazybot⇒ 2
08:07virmunidHello. I was wondering if a function can be referenced in edn? I'm trying to get dependency injection in my ring app.
08:13magnarsvirmunid: you can use require and find-var to look up a function by symbol. See https://github.com/weavejester/ring-server/blob/master/src/ring/server/leiningen.clj#L5-L8
08:15virmunidmagnars: so I would have the edn configured with strings of the functions like "some.ns/an-impl" then use require and find-vars on that string?
08:15magnarsaye
08:16magnarsor a quoted symbol, 'some.ns/an-impl
08:18virmunidCool. thanks.
08:18virmunidI'll play around with it. It
08:18virmunidIt's been this very issue that's prevented me from moving forward on my project for 6 months.
08:19magnarsvirmunid: another way to do DI is by defining a protocol
08:20slipsetvirmunid: have you looked at stuart sierras components?
08:20virmunidmagnars: I was going to do that. But I'm looking for a Spring-esque approach to configuring the server. I planned on using Environ to get the values, but needed get a component framework around it.
08:20slipsethttps://github.com/stuartsierra/component
08:20daniel_dnolen_: your post on javascript modularity made me think we need similar dead code eliminiation on the frontend
08:21daniel_s/frontend/css/
08:21virmunidslipset: I have. Stuart seems to have wandered away from it. I'm just learning Clojure. The few project I've made available are incredibly simple. Like https://github.com/deusdat/arango-session or https://github.com/deusdat/travesedo
08:21daniel_rather than selecting bootstrap modules for example, it would be great to have similar dead code elimination there
08:22tbaldridgevirmunid: I can tell you that stuart has not abandoned component. I work with him on a daily basis, and we maintain a very large codebase that uses component extensively.
08:23tbaldridgefor libraries of a certain level of simplicity, updates aren't needed on a regular basis.
08:23virmunidtbaldridge: is there a ring example for it? The idea of the lifecycle was appealing. Since I'm new, writing the ring adapter was scary.
08:23slipsetvirmunid: puredanger has this http://tech.puredanger.com/2014/01/03/clojure-dependency-injection/
08:24slipsetmore with what magnars says wrt using protocols
08:25slipsetI've been thinking about using some ideas that tbaldridge shows in https://www.youtube.com/watch?v=R3PZMIwXN_g
08:25sveriHi, I am building an uberjar with lein uberjar, but at one step the compilation process seems to hang forever without an error message or something similar. Is there a way I can debug this issue? running the same thing in "dev" mode everything is working as expected
08:25daniel_i started working on a responsive css framework in clojure/garden
08:26slipsetwhere he instead of using functions that require a ctx param, he retuns functions which need a ctx param
08:26daniel_perhaps you have a suggestion for extracting selectors from om components, i use standard om dom functions rather than fancy templating
08:26slipsetso instead of (defn foo [ctx bar] ..)
08:26slipsetyou do (defn foo [bar] (fn [ctx] ...))
08:27slipsetbut I'm not sure how this plays out in the real world outside my head.
08:28magnarsslipset: sounds a bit like manual partial application :)
08:28slipsetmagnars: yes I guess
08:29slipsetbut since tbaldridge does it that way, I guess it has some merrit :)
08:29tbaldridgeit's pretty much the state monad
08:29tbaldridgeI'd say it's "one" way to do it, perhaps not the best, or worst
08:30slipsetmagnars: I guess that in a more involved example the returning function will close over some values from the called functions.
08:31magnarsyeah, it's an interesting thought
08:36dnolen_daniel_: ah right, perhaps Webpack will eventually get there
08:40clgvWhoever suggested "Javadoc Search Frame" for Firefox (via Greasemonkey), thank you very much! It has been really useful so far.
08:46slipsetmagnars: I think that was how we built a lisp-parser in lisp in http://folk.uio.no/in211/Gamle/H95/www_docs/
08:47slipsetimagine, I was using a state monad in the 90's without even knowing about it
08:51hellofunki can't believe you guys are talking about gonads
08:51hellofunki mean really?
08:51hellofunkoh sorry i misread
08:52slipsetthat's right, we're talking about burritos
08:52daniel_dnolen_: is there a way to get an html string from an om component definition?
08:52dnolen_daniel_: pretty sure it does CSS minification
08:52dnolen_daniel_: use a React ref + get innerHTML property
08:54daniel_ok, thanks
08:56espinho.
09:56sdegutisWould it be inappropriate to post an announcement in the Clojure mailing list about my new OOP library (https://github.com/sdegutis/oops) ?
09:57hellofunksdegutis: i don't see why not.
09:57hellofunksdegutis: i realize you've gotten some resistance to your ideas but personally i think there is nothing wrong with experimentation. i prefer FP over OOP for a wide range of reasons but that doesn't mean it's not fun to play around with ideas.
09:59sdegutisPlus I don't think they're mutually exclusive.
10:00hellofunksdegutis: maybe not for some cases. in general though the benefits of FP to me win out significantly over OOP and i have not yet found a reason to *need* OOP instead of FP for a given problem (interop with OOP libraries excluded)
10:01sdegutishellofunk: I get the feeling different people mean very different things by OOP
10:02sdegutisPersonally by OOP I mean "a way to make some arguments implicit on a set of related functions."
10:02hellofunksdegutis: perhaps. i don't even like using custom records via defrecord, that's my bias. organizing logic only around raw, generic data structures is a real time saver in my opinion.
10:06hellofunksdegutis: i spent years doing Objective C and C++, both languages i actually quite enjoyed. but i can tackle problems so much faster and get to the heart of a challenge when all that OOP infrastructure is thrown away
10:06daniel_sdegutis: isn't that what higher level functions are for?
10:06daniel_higher order*
10:06sdegutisdaniel_: yeah it's basically a convenience layer around HOF
10:06sdegutisdaniel_: it wraps them for you with partial, while making the partial'd values easy to access, and all the while being very efficient
10:10hellofunksdegutis: i'd enjoy looking at your code. i applaud all creative ideas that lisping offers. that's kinda the beauty of this language, you can really try all sorts of things
10:10sdegutishellofunk: fwiw the implementation is 15 lines long, and basically a thin wrapper around clojure.core/def{interface,type} ... https://github.com/sdegutis/oops/blob/master/src/oops/core.clj
10:12sdegutisI am strongly considering renaming it to not have OOP in the name since that's a very loaded term with a lot of negative connotations in people's minds.
10:20sdegutisI've (set! *warn-on-reflection* true) at the top of my test file, and `lein test` does not output any warnings when it almost definitely should.
10:20sdegutisIs that not supposed to work when running tests?
10:21Bronsasdegutis: can you nopaste the namespace file?
10:21sdegutishttps://gist.github.com/sdegutis/12fac289e5cfd682ce09
10:22sdegutisThose are macros which compile down to definterface/deftype things.
10:22Bronsasdegutis: where should it output a warning in your opinion?
10:22sdegutis"defmethod kind" is not type-annotated.
10:22Bronsasdegutis: so?
10:23sdegutisIt returns a string but I never told the compiler that -- is it inferring it?
10:23Bronsasdegutis: no it's returning an Object
10:23Bronsasdegutis: you never use an interop form on the return type of kind that assumes a String
10:23Bronsaif you did, you'd get a reflection warning
10:24Bronsasdegutis: e.g. try replacing (.kind spot) with (.substring (.kind spot) 0)
10:24sdegutisOh.
10:25sdegutisThanks :)
10:36clgvshort maven question: what is the maven equivalent of "lein uberjar"?
10:37gfredericksmight need a plugin for that
10:37clgvoh. :/
10:39stuartsierraclgv: http://maven.apache.org/plugins/maven-assembly-plugin/
10:39dnolen_Thinking about cutting Om 0.8.0, anything anyone absolutely needs before I do? Speak now or forever hold your peace
10:39clgvstuartsierra: thank you.
10:40stuartsierraSpecifically, the `jar-with-dependencies` descriptor. I'm sure the web has copy-and-paste examples.
10:40clgvstuartsierra: it's on a page linked from yours http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
10:43sdegutisHow do you add a type hint where your deftype is expected?
10:43sdegutisFirst it says no class java/lang/MyType expected. Then I try saying ^foo.foo-test/MyType and it gives a similar error.
10:44atankanowclgv: you could also use the maven shade plugin: https://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html ... i've used that in some cases in place of the assembly plugin
10:45Bronsasdegutis: a deftype Foo in ns foo.foo-test has type foo.foo_test.Foo
10:45sdegutisThanks.
10:47virmunidstuartsierra: would you make a tutorial showing how to use component with ring for noobs like me?
10:47weavejes_virmunid: There are a few different ways people have come up with for integrating the two.
10:48stuartsierravirmunid: Others have already made examples.
10:49virmunidstuartsierra: can you name the project something else then, 'cause I'm having the hardest time googling for those. "clojure component ring example" brings up a bunch of nonsense.
10:49clgvOn "mvn package" I get the error that "-source 1.3" is set. does maven set that somewhere?
10:51csd_have any of you attempted the problems at cryptopals.com with clojure?
10:53weavejes_virmunid: Two approaches I know of are modular and duct.
10:54weavejestervirmunid: I prefer Duct, because I wrote it ;)
10:54virmunidweavejester: that makes me more confident, :)
10:54stuartsierraFirst Google result I get has many examples https://groups.google.com/d/topic/clojure/12-j2DeSLEI/discussion
10:56virmunidstaurtsierra: for my own edification, what was your query?
10:57stuartsierravirmunid: https://www.google.com/search?q=clojure%20component%20ring%20example
10:58virmunidwell don't I feel sheepist
10:59stuartsierraAlso examples at http://www.uswitch.com/tech/more-open-source-clojure-systems-please/
11:00stuartsierra(not found on google, but it should be)
11:01EvanR-workis there a way to
11:01EvanR-workget an exception backtrace as a string
11:01gfrederickswhat do you want it to look like?
11:02gfredericks,(->> (Exception.) .getStackTrace seq pr-str)
11:02clojurebot"(#<StackTraceElement sandbox$eval49.invoke(NO_SOURCE_FILE:0)> #<StackTraceElement clojure.lang.Compiler.eval(Compiler.java:6768)> #<StackTraceElement clojure.lang.Compiler.eval(Compiler.java:6731)> #<StackTraceElement clojure.core$eval.invoke(core.clj:3076)> #<StackTraceElement clojure.core$eval27$fn__28$fn__38.invoke(NO_SOURCE_FILE:0)> ...)"
11:02hellofunki'm doing a 4clojure problem and am curious how you can test if somethign is a set without using set? predicate
11:02gfredericks,(supers (class #{}))
11:02stuartsierra(with-out-str (.printStackTrace *e *out*))
11:02clojurebot#{java.util.Collection clojure.lang.Counted clojure.lang.IPersistentCollection clojure.lang.IMeta clojure.lang.Seqable ...}
11:02hellofunkgfredericks: set? and class are not allowed in the problem
11:03gfrederickswhat about instance?
11:03virmunidstuartsierra: thanks
11:03gfrederickssounds like a weird problem
11:03hellofunkinstance? and Class are not allowed either
11:03hellofunknor is getClass
11:03gfredericksokay then this sounds like a weird puzzle
11:03hellofunkgfredericks: agreed, but i'm curious.
11:03gfredericksthat doesn't have very much to do with normal clojure usage
11:04gfredericksperhaps (= #{} (empty the-set))
11:04EvanR-workis there a way to dump all the exceptions information as a string
11:04hellofunkgfredericks: i like that
11:04gfredericksEvanR-work: well an arbitrary exception could have information stored in arbitrarily strange ways
11:05EvanR-workhmm.
11:05clgvstuartsierra: got it building. thank you again!
11:05EvanR-workim definitely throwing an ex-info in case something doesnt validate
11:05EvanR-workbut results of bugs or I/O errors would be nice to see
11:05EvanR-workin my debug log
11:11EvanR-workin (with-out-str (.printStackTrace *e *out*)) what is *e
11:12pyrtsa,(doc *e)
11:12clojurebot"; bound in a repl thread to the most recent exception caught by the repl"
11:12hellofunkwhy does (reverse '(1 2 3)) work, but (reversible? '(1 2 3)) report false ?
11:12EvanR-worknice
11:12arohnerhellofunk: you could look at the behavior of conj?
11:12arohner(-> x (conj :a) (get :a) (= :a)
11:12EvanR-work,(doc reversible?)
11:13clojurebot"([coll]); Returns true if coll implements Reversible"
11:13hellofunkEvanR-work: i see, so you can reverse something even if it is not from Reversible.
11:13EvanR-workit begs the question what Reversible is
11:13pyrtsaReversible means (almost-)constant-time reversible.
11:13EvanR-worki usually have to look at the source for this
11:14EvanR-workso FastReversible
11:15arohnerEvanR-work: http://begthequestion.info/
11:15arohner:-p
11:16andyf_arohner: Nice web page.
11:16arohnerandyf_: I didn't write it, but I use it far too often
11:16arohnermaybe I should write a BegsTheQuestion twitter bot
11:17andyf_I will pass it on. Fight the good fight, man.
11:17csd_Why does this code return the error message "Illegal base64 character a"? https://www.refheap.com/95918
11:17arohnerandyf_: there's also this, if you're into that sort of thing: http://www.qwantz.com/index.php?comic=693
11:17hellofunkarohner: the abuse of the phrase "begs the question" has proliferated in the last 8 years or so. i once argued to a screenwriter that he was using it incorrectly, and that it doesn't mean what people think it means. he said, "it does now"
11:21gfredericksquestion-begging: http://languagelog.ldc.upenn.edu/nll/?p=2290
11:27EvanR-workarohner: haha... seems fine to me!
11:28arohner:-)
11:28EvanR-worknot even wrong
11:30EvanR-workjava.lang.IllegalArgumentException: No matching method found: printStackTrace for class clojure.lang.Var$Unbound
11:30EvanR-workthis is when i tried to use (.printStackTrace *e *out*)
11:30EvanR-workinside an exception handler
11:30justin_smithgfredericks: excellent post, I love those guys
11:30justin_smith(inc gfredericks)
11:31justin_smith$ping lazybot
11:31justin_smith:(
11:31gfredericksjustin_smith: yeah me too
11:31llasram(doc *e)
11:31clojurebot"; bound in a repl thread to the most recent exception caught by the repl"
11:31EvanR-workoh
11:32EvanR-workback to the drawing board
11:32EvanR-work</incorrect-usage>
11:33hellofunkwhoever made this site has a nice sense of humor: http://clojurescriptkoans.com/#conditionals/8
11:39llasramEvanR-work: What are you trying to do?
11:39EvanR-workjustin_smith: i cant help but expect the conclusion of that blog to be the conclusion for a great many "misused" phrases...
11:39EvanR-workllasram: well, just debug log an exception, without crashing
11:39llasramIn an exception handler you should have the exception itself, bound to the identifier provided as an argument to the (catch) form
11:41llasramEvanR-work: And tools.logging functions all have forms which take an exception and will log the associated stack trace
11:41EvanR-workyeah i have (catch Exception e (log/debug (str e "\n" (pr-str (seq (.getStackTrace e))))))
11:42EvanR-workwhich is ok
11:42justin_smithEvanR-work: but the level of detail it uses in letting us know how it got to be so misused is awesome
11:42clgvEvanR-work: how about clojure.stacktrace/print-stack-trace?
11:44EvanR-workclgv: well, you mean with-out-str ?
11:47clgvEvanR-work: (log/error (with-out-str (print-stack-trace e)))
11:47clgv,(doc with-out-str)
11:47clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
11:47clgv,(with-out-str (println "abc"))
11:47clojurebot"abc\n"
11:47clgv,(count (with-out-str (println "abc")))
11:47clojurebot4
11:48EvanR-worki know about this, but i want the text of the exception too
11:48clgvEvanR-work: that is what `clojure.stacktrace/print-stack-trace` does
11:49clgvtry the full logging example above ;)
11:49EvanR-workalright
11:50sdegutisAw, type hints of a class can't be used in the definition (deftype) of that selfsame class?
11:50sdegutisBlast!
11:50clgvusually I use print-cause-trace to have more information
11:51clgvsdegutis: this would only help with reflection warnings in inline protocol/interface implementations. nothing more
11:51EvanR-workvery nice
11:51clgvsdegutis: you can't "type" deftype fields other than the supported primitive types
11:51EvanR-workhijacking the standard output stream seems like a very php way to do it but it works
11:52Bronsasdegutis: they can be used
11:52Bronsa,(defprotocol p (f [_ _]))
11:52clojurebotp
11:52clgvEvanR-work: it is thread-local hijacking afaik, so it is ok for that task
11:53Bronsa,(deftype x [a] p (f [_ ^x o] (.a o)))
11:53clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't find matching method: f, leave off hints for auto match., compiling:(NO_SOURCE_PATH:0:0)>
11:53Bronsa,(deftype x [a] p (f [_ _ ^x o] (.a o)))
11:53clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: f, compiling:(NO_SOURCE_PATH:0:0)>
11:53Bronsauh.
11:53clgvEvanR-work: but an outputstream or writer to pass to clojure.stacktrace functions would be a better way, sure
11:54Bronsawell sdegutis, apparently not in the argvec but you can use them elsewhere
11:54EvanR-workyeah i didnt think it was unsafe
11:54Bronsa,(deftype x [a] p (f [_ o] (.a ^x o)))
11:54clojurebotsandbox.x
11:54Bronsa^ there you go
11:54clgvBronsa: he meant the field declarations.
11:55Bronsaclgv: uhm, that's not how I read it but you might be right
11:56clgvBronsa: I used the info that it works in all implementation parts except in the field definition vector, so that is what remains, though he didnt say so clearly
11:56timvisherso who wants to straighten me out RE macros? :) https://gist.github.com/timvisher/f580f8ee19bdfcf7232a
11:56timvisheram i going down a rabbit hole? is this not possible?
11:57timvisheri could do this fairly well with a function if i was willing to wrap everything in a [] and "" each line, but i thought i should be able to do it with macros and it would make maintaining the levels _slightly_ nicer.
11:57clgvtimvisher: the dots are problematic
11:58clgvtimvisher: and ^ probably as well
11:58BronsaTimMc: and as the exception tells you, 1a is not a valid clojure literal
11:59Bronsatimvisher*
11:59timvisherBronsa: why does it need to be? i was expecting to able to process it into a string but instead it fails before i can get to it, it seems
11:59clgvtimvisher: you can try via (defmacro deflevel [& args]), if that fails you have characters that er not accepted by the clojure reader
11:59Bronsatimvisher: what you pass to a macro must still be a valid clojure form
11:59timvisherok
11:59timvisherthat makes more sense
12:00clgv,(defmacro deflevel [& args])
12:00clojurebot#'sandbox/deflevel
12:00Bronsatimvisher: macros consume clojure forms, it's not a string preprocessor like in C
12:00timvisherso in other words, i'm buying almost nothing by using a macro here, as usual. :\
12:00clgv,(deflevel .)
12:00clojurebotnil
12:00clgv,(deflevel |....|)
12:00clojurebotnil
12:00clgvdamn. that'll work ;)
12:00timvisherlol. i'm still committed to one day find a use for these things :)
12:00Bronsa,(deflevel ^)
12:00clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
12:01clgvok so not the dots but ^
12:01Bronsatimvisher: well if you have written more than a hello world in clojure you have definitely used macros before
12:01clgvI remember it failing for relative filenames "../bla.txt" probably because thats not a valid symbol
12:02Bronsa,'../bla.txt
12:02clojurebot../bla.txt
12:02clgv,(deflevel ../bla.txt)
12:02clojurebotnil
12:02timvisherBronsa: i mean a macro that i've written.
12:02timvisher:)
12:02Bronsaclgv: the gotcha with symbols starting with . is that they get macroexpanded into the . special form when used in "invoke" position
12:02Bronsaclgv: except if they're macros, like `..` :/
12:04arohneris there a good way to stop an a/pipeline, other than stopping the JVM?
12:04llasramtimvisher: Clojure strings can contain newlines -- any reason you don't want to just make them strings?
12:04arohneroh, I guess I can a/close! the input
12:04tbaldridgeclose the input channel
12:05arohnertbaldridge: yeah. it'd be nice if there was a blocking version so C-c from the repl worked
12:06timvisherllasram: if you make them strings you loose their rectangular nature
12:07timvishereither by forcing you to avoid auto-indent and place the contents of the string all the way on the left of the file, or by embedding \n, unless i'm missing something
12:09hiredman /win 15
12:10andyf__timvisher: you might like clojure.string/join "\n" [ "line1" "line2" ...] except with each line string on separate line
12:12timvisherandyf__: yep. turns out i don't even need to go that far. these things used to be txt files on disk, so would need to read them, split them for \n, and parse them out that way. there's a very natural representation (which allows use of regular fns) which just wraps all the lines in "" which then avoids the split and disk read steps
12:14[blake|There's a more concise way to put this, and I keep forgetting what it is:
12:14[blake|,(if (empty? a-str) "default" a-str)
12:14clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a-str in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:14[blake|&(if (empty? a-str) "default" a-str)
12:14kryftI see that Prismatic's schema is still in alpha; how mature is it in practice? I need to validate some data, and I'm trying to decide on a library
12:14[blake|&(let [str ""] (if (empty? a-str) "default" a-str))
12:16[blake|&(+ 1 1)
12:16[blake|Uh oh...did I break clojurebot?
12:18timvishermeh. not terrible… https://gist.github.com/timvisher/f580f8ee19bdfcf7232a
12:18timvisherthanks all :)
12:18andyf__And now you have to pay for it :)
12:18[blake|I broke it, I bought it.
12:26gfrederickskryft: I think prismatic is a good choice
12:26seangrovednolen_: Let me know if you'd like some help. I don't know much about the Closure module system, but if you want to create some issues and assign them to me, I'd be happy to do a deep dive on them
12:27kryftgfredericks: I'm just wondering how mature it is in practice
12:27dnolen_seangrove: there's already a module ticket open, I might take a look at it shortly
12:28kryftgfredericks: (Given that they state that it's alpha)
12:28gfrederickskryft: probably as mature as anything else
12:28kryftOk, thanks
12:28justin_smithkryft: prismatic makes solid stuff
12:29gfredericksI love how par-compile with prismatic graph can give you exceptions that are buried in a stack of j.u.c.ExecutionException
12:30gfredericksI just got this: #<java.util.concurrent.ExecutionException java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.net.NoRouteToHostException: No route to host>
12:31gfredericks(iterate #(.getCause %) e)
12:31hiredman(doc clojure.stacktrace/root-cause)
12:31clojurebotCool story bro.
12:31hiredmanclojurebot: idiot
12:31clojurebotNo entiendo
12:32gfrederickswell I might not want the *root* cause, just the one underneath the j.u.c.EEs :)
12:43justin_smithgfredericks: the drawback of having a custom dispatch / coordination of executing tasks, core.async sees the same problem, and I would be surprised if manifold didn't have these issues too
12:45gfrederickswouldn't be hard for graph to mitigate though
12:45justin_smithoh?
12:45gfredericksI could submit a PR myself but instead I am chaflortling on IRC about it
12:46gfredericksjustin_smith: yeah depending on exactly what behavior you want; naively you could just unwrap every exception you get on dereffing
12:46gfredericksI'm saying the library can fix it for the user
12:46dnolen_seangrove: I've marked the issues that I think are important
12:46dnolen_seangrove: reflecting through the compiler to emit the underlying arities would be a good noe
12:46dnolen_s/noe/one
12:54zB0hshow can i evaluate part of a form but have the rest of the form not evaluate
12:54zB0hs'[fun1 fun2 fun3] but only evaluate fun3
12:55mgaarezB0hs: with a macro
12:56justin_smithzB0hs: evaluate or invoke? ##((nth [+ - * /] 2) 3 4)
12:57[blake|I have some code inside a let statement inside a function that's being executed when I load the file into the REPL.
12:57[blake|That =has= to mean that function's being called somewhere immediately, doesn't it?
12:57justin_smith[blake|: yeah, add a stack trace print to see what called it
12:58justin_smith,((nth [+ - * /] 2) 3 4)
12:58clojurebot12
12:58[blake|justin_smith: I thought so but can I do a stack trace without an exception? Just "what's the stack right now"?
12:59espinhocan anyone point me a good tutorial/resource for website development please? Im new to programming and im having a hard time finding it. thanks
13:00[blake|justin_smith: I guess I just throw the exception right there?
13:00justin_smith[blake|: you could do an (assert false), sure
13:01justin_smithbut you can also get the current stack trace, one moment, looking up how to do it again
13:02justin_smith(map str (.getStackTrace (Thread/currentThread)))
13:02justin_smiththat will just give you the trace as a lazy-seq of strings
13:02[blake|Thanks.
13:02[blake|(inc justin_smith)
13:03justin_smithno bots!
13:03[blake|No peace!
13:03justin_smithoh wait clojurebot is actually working
13:03hellofunk(inc clojurebot)
13:03justin_smithhaha
13:04[blake|So, my routes are being called somewhere via Compojure when loading it into the file. I guess...I shouldn't worry?
13:07[blake|Er, loading it into the REPL.
13:09[blake|espinho: There are a lot of them. I haven't found any of them very useful.
13:09[blake|espinho: https://github.com/weavejester/compojure/wiki can get you started.
13:13justin_smithespinho: for learning programming with clojure, aphyr's "clojure from the ground up" is pretty well thought out
13:14justin_smithhttps://aphyr.com/tags/Clojure-from-the-ground-up
13:14espinhoblake: Thank you. I have a lot of trouble learning from just writing pieces of code. I need to build something while learning to see results (if that makes any sense), like when i was learning html/css
13:14abaranoskyif I wanted to get humanized timestamps in CLJS what's a good way to do that? Like "3 days ago" for example)
13:15espinhojustin_smith> thank you
13:16[blake|espinho: I'm the same way, but I haven't found any such instruction. I'm hoping to write something along those lines this year.
13:16hellofunkespinho: the 4clojure site is also a great, though challenging and patience-requiring method for becoming sophisticated at clojure, especially if you opt-in to the "code golf" and looks at others' solutions
13:16abaranoskyin other words, is the best way to do this to use externs and MomentJS? https://github.com/moment/moment
13:17[blake|Yeah...although with 4Clojure and most of the books and sites, I've found I need to use them a little, go do stuff, come back and review... Dabble in them all.
13:17hellofunk4clojure is like practicing scales for a musician
13:18nullptrimo 4clojure is better for brain conditioning than learning clojure in a practical way
13:18hellofunk4clojure is particularly good for learning all the tricks you can use to mangle collections
13:18nullptryou could complete 4clojure and still have no idea how to add a lib in lein for example
13:19hellofunknullptr: correct. 4clojure is stricly about learning the language philosophy and syntax
13:19espinhoTried 4clojure, but it was a pain to me since I really dont know clojure and this is my first programming language
13:19hellofunk*strictly
13:19hellofunkespinho: yes some basics are required before you jump into its exercises, though the "elementary" questions should go well with an introductory book on the subject
13:19nullptri'm hesitant to send new people to 4clojure, it's too easy to get stuck
13:20nullptrrequires pre-commitment to clojure
13:20espinhoand since my background is building sites, I was hoping to find a web development resource that could teach me the language while building something
13:21hellofunkespinho: there is also that free online book Clojure for the Brave and True or something like that. it's a decent introduction to most of the language
13:22hellofunkespinho: cemerick has a youtube video that shows a basic web app built from scratch that is worth of a beginner
13:22espinhohellofunk:thank you.
13:22hellofunk*worthy
13:23espinhohellofunk: cemerick? Excuse my ignorance but i don't know what it is.
13:23hellofunkespinho: it's a dude. a cool dude. a smart dude.
13:24hellofunkespinho: a dude who has done a bunch for all of us.
13:24espinhohellofunk: oh ok :)
13:24hellofunkespinho: among other things, also one of the authors of the best clojure book out there right now by O'Reilly. but many of us are using his libs in our production web apps
13:26espinhohellofunk: I see. found the tube video, but is from 2012.
13:27hellofunkespinho: that's ok.
13:28espinhohellofunk: will check it later on then. thank you :)
13:28hellofunkespinho: also, while less on specifics and more on general language concepts, the ClojureTV youtube channel is a great way to be exposed to the people and tools that make this community great. and you will get the "big picture" on how it all works
13:33espinhohellofunk: Never thought that the clojure irc peeps would be so helpful. It's a great contrast to some other language channels.
13:34hellofunkespinho: i totally agree
13:34hellofunkespinho: if i were to get all philosophical, i would say that it is because the deeper inner beauty of the language has brought out the best in all of us
13:35espinhohellofunk: :)
13:36justin_smithI once thought it had to do with Clojure's relative underdog status, but people on some other niche language channels are jerks, so it isn't that
13:37hellofunkjustin_smith: i might be making this up, but in most communities, a lot "trickles down" from some source somewhere. and i feel that the attitude of the core language's engineers, and their perspective and tone, has shaped the phenomenon for everyone
13:38justin_smithhellofunk: that's a very good guess
13:39exapticyeah definitely part of why i switched from a different FP language community. their irc channel was pretty toxic
13:40espinhoI've "tried" other languages before i discover clojure and it's weird syntax, but in every channels of those languages there always more than one person bashing me dow for being a noob by asking my noob questions.
13:41EvanR-workcan you get keyword args that are required like in ruby
13:41exapticmaybe they're mad because their language is too hard to explain =)
13:42EvanR-workwhich doesnt explain why no body is noob bashing in here
13:43hellofunkEvanR-work: you mean fn args that must be a keyword only?
13:43justin_smithEvanR-work: you can do it manually via a :pre condition, and one could make a macro for it fairly easily
13:43EvanR-workhellofunk: i mean getting the effect of "WRONG NUMBER OF ARGS!!!!" but for keyword args "KEYWORD ARG FOO NOT PROVIDED!!!"
13:43EvanR-workok
13:43j201espinho: well, the irritation with noobs is often because they don't rtfm or ask bad questions (unclear, posting hundreds of line of irrelevant code, etc.)
13:44gfrederickswe are nice because matz is nice
13:44sdegutisIs it standard procedure to upload your Leiningen web app's entire source code to production and just run it via `lein` on the production server?
13:44EvanR-workim on a tight schedule so ill just let nils slip through
13:44justin_smithsomething like: (fn [& {:keys [a b c]}] {:pre [a b c]} ...)
13:44tbaldridgesdegutis: no, infact there are some problems doing it that way
13:44tbaldridgeI normally recommend lein uberjar and upload the jar
13:45sdegutisOkay, that's what I do, but I got the impression it's not the typical way.
13:45sdegutis(i.e. I upload uberjars)
13:45justin_smith,((fn [& {:keys [a b c]}] {:pre [a b c]} (+ a b c)) :a 0 :b 1 :c 2)
13:45clojurebot3
13:45justin_smith,((fn [& {:keys [a b c]}] {:pre [a b c]} (+ a b c)) :a 0 :b 1)
13:45clojurebot#<AssertionError java.lang.AssertionError: Assert failed: c>
13:46ssiderisEvanR-work: :pre conditions are the quickest way to achieve this, but they throw AssertionErrors when they fail, not Exceptions, so you don't get a stacktrace in some cases, which can make things hard to track down
13:46justin_smithit works, but the message could use work
13:46justin_smithssideris: yeah, that too
13:46gfredericksthere's no good way to add functionality to [de]fn & friends without a proliferation of one-off wrapper macros
13:47gfrederickslike other kinds of preconditions
13:47gfredericksI'm not sure how it could be any better though
13:47ssiderisEvanR-work: I generally use prismatic's schema, but it may be overkill for you
13:47gfredericksother than some weird kind of macro middleware
13:47EvanR-workyes that would work
13:47justin_smithEvanR-work: also, required keys are straightforward to express using prismatic/schema
13:47EvanR-workbut its a lot more typing than this just being the default
13:47EvanR-workbut i think keyword args are just syntax for passing in a map of options
13:48justin_smithEvanR-work: indeed they are
13:48gfrederickswhat do those prismatic fnks do if a key is missing
13:48[blake|espinho: No exaggeration: Best language channel I've been in.
13:48ssiderisEvanR-work: don't forget about the :or part of the destructuring in case you have/want defaults
13:48EvanR-workyes im using that for one arg
13:48[blake|espinho: Which is good because Clojure is...demanding.
13:48gfredericksooh they throw an exception
13:48EvanR-workthe others, which dont have defaults, nil isnt the default
13:49gfredericksokay I recommend plumbing & fnk for this :)
13:49EvanR-workin ruby theres a difference between arg provided nil and not provided
13:49gfredericksEvanR-work ^
13:49EvanR-workgood to know
13:49gfredericksprobably not a good fit for everything but pretty nice when it fits
13:49gfredericksespecially when using graph
13:50justin_smithEvanR-work: (fn [& {:keys [a b c] :as provided}] (contains? provided a))
13:52espinhoblake: demanding is the right word. Writing code from inside out, makes my little brain hurt.
13:52EvanR-workis the & necessary
13:53justin_smithEvanR-work: without the & you just get a map as an arg
13:53ssiderisEvanR-work: & is for varargs
13:53justin_smithwhich is actually something I prefer
13:53gfredericksespinho: you'll like -> & friends then
13:53justin_smithbut if you want ruby/python style keyword args you want &
13:53ssiderisjustin_smith: yeah, varargs make apply messy
13:53EvanR-workwhat syntax is that
13:53justin_smithssideris: indeed, and I never used & {:keys ...} myself
13:54justin_smithEvanR-work: destructuring
13:54[blake|espinho: Yep. And it never goes away. You learn one way of thinking, and there's always new challenge around the corner. A new simplification, if you will.
13:54EvanR-workjustin_smith: ... what is the no-& call syntax?
13:54ssiderisEvanR-work: with varargs: (my-fun 6 :flag true :x 4) without (my-fun 6 {:flag true :x 4})
13:55EvanR-workweird
13:55EvanR-workusing no &
13:55ssideriswithout & you just pass a map
13:55ssideristhat's all
14:03justin_smithEvanR-work: the point is that it is just a destructuring of the arg, same as you could use in a let block or a loop binding
14:03EvanR-workyes i see that now
14:04EvanR-workand i used a precondition that just repeated all my keys
14:04EvanR-workbetter than listing a bunch of assertions
14:26justin_smithanother option would be {:pre [(every? some? [a b c])]} if you might want a false value for some keys
14:29Torkabledo you guys have a "start here" for noobs
14:30pbalduinohi there. happy new year everybody.
14:30seangroveTorkable: This might be interesting https://github.com/swannodette/lt-cljs-tutorial
14:30seangroveIt's ClojureScript, but same general concepts
14:31justin_smithTorkable: noob to clojure, or clojure+programming?
14:31Torkablenoob to clojure
14:31justin_smiththere is the free book online, clojure for the brave and true
14:32mearnshTorkable: what's your background?
14:32mearnshhi pbalduino
14:32justin_smithTorkable: and you should probably be using lein to manage libs and build code and run repls
14:32TorkableI've been looking at ports of transducers and channels to javascript lately and its got me interested in learning clojure itself
14:32justin_smithTorkable: oh, in that case a cljs-centric approach would actually be helpful then
14:32Torkablemearnsh, javascript programmer day job, tinker with haskell and other FP langs for fun
14:33Torkablejustin_smith, ay, I ran into the brave and true book earlier today and bookmarked it
14:34mearnshi guess seangrove's suggestion is pretty good then
14:35Torkableis light table recommended?
14:35Torkableits hard for me to break away from vim
14:35lodinTorkable: If you already know FP then perhaps you can just learn the very basics and then scan the cheatsheet several times every day. By the very basics I mean def, defn, and function application.
14:35mearnshjoy of clojure is good if you want a book that goes deep fast
14:35Torkablealso I believe I saw that light table has been abandoned
14:36the_freyI found lighttable buggy
14:36the_freyemacs has worked well
14:36sdegutisLT was an enthusiastically embraced experiment. I think he moved on to a new experiment.
14:36TorkableI asked because the tut linked is specifically for LT
14:36stuartsierraUse the editor you're most comfortable with.
14:36Torkablek
14:36sdegutisibdknox: is LT still active?
14:37hellofunkTorkable: very basic intro exercises you can do right online to learn clojurescript basics: http://clojurescriptkoans.com/
14:37sdegutishttp://www.chris-granger.com/2014/10/01/beyond-light-table/
14:38Torkablecool, thanks for the tips guys :)
14:38sdegutis"Eve" is the next step in the evolution of Light Table.
14:38mearnshTorkable: check out fireplace.vim
14:39sdegutisThey're both projects to make programming simple and accessible for the computer illiterate.
14:39mearnshTorkable: also https://github.com/magomimmo/modern-cljs
14:39sdegutisI personally want something like Eve but for fire-fighting.
14:39sdegutisI'd love to do a little fire-fighting without having to go through training and have a commitment and sch.
14:39sdegutis*such
14:39lodinWhat happened to Aurora?
14:40stuartsierraI think Aurora was renamed to Eve.
14:41Torkablemearnsh, fireplace looks great :)
14:41abaranosky2has anyone seen Safari hanging using CLJS? I commented out all the code that executes in the initial "main" function yet when I go to our page in Safari it hangs.
14:41llasramsdegutis: The problem is that the programming equivalent of what you are describing already does exist, is widely deployed, and is named "Excel"
14:41pbalduinowhen I use :gen-class without parameters inside ns nothing happens. Is it the expected behaviour? (ns foo.bar (:gen-class))
14:42llasramsdegutis: Providing better tools would be a huge improvement
14:42abaranosky2pbalduino: that looks fine to me
14:42timvisherabaranosky2: have you inspected what's happening?
14:44abaranosky2timvisher: in the console nothing is printed!
14:44pbalduinoabaranosky2: I was expecting some AOT and a .class file generated, but really nothing happened.
14:44timvisheri'd put some (.log js/console "got here") in the source code then
14:44timvisheri'm assuming the network requests are succeeding?
14:44abaranosky2timvisher: let me see for sure
14:45sdegutisllasram: meh
14:45lodinllasram: There seems to be some kind of dataflow trend.
14:46swedishfishI am trying clojure.test and have setup test-selectors in my project.clj. :all, :integration, :default. And :default complement :integration. Trouble is that when I run lein test, fixtures from integration namespace is actually executed during the :default test suite. Is there a way around this?
14:46sdegutisllasram: I'm hesitant to believe world-changing ideas are both executable and world-changing.
14:46pbalduinocemerick: \o/
14:47abaranosky2timvisher: I load up "http://localhost:8001/&quot; and the whole dang developer console becomes unresponsive!
14:47abaranosky2lol
14:47timvisherabaranosky2: are you guys using core.async?
14:48justin_smithswedishfish: fixtures should be defined per-namespace, I don't think selector-specific fixtures will work without some mucky stuff
14:48timvisheryou might have to do a quick binary search of the offending bit
14:48cemerickpbalduino: \m/
14:48abaranosky2timvisher: yes, but the code where we use it is commented out :)
14:49timvisherabaranosky2: something is probably still firing a go-loop waiting for input from a channel or something
14:49abaranosky2I have one main fn that fires off everything. In that fn I commented everything out.
14:49abaranosky2timvisher: ^^^
14:49timvisherabaranosky2: so all your required nses are entirely pure?
14:51timvisheri would imagine that some of them are side-effecting somewhere and thus causing the hangup
14:51mikerodI wish Clojure's use-fixtures did not overwrite existing fixtures in the same namespace
14:51mikerod(use-fixtures :once blah) -- then -- (use-fixtures :once foo) -- then only foo fixture works
14:52mikerodit just uses an assoc with the :clojure.test/once key on the namespace metadata
14:52mikerodan update with conj or something would be a bit nicer to me
14:52mikerodI had a case where we have a macro that adds a :once fixture
14:52mikerodthat macro needs to be written *after* any usages of the clojure.test/use-fixtures, so that it doesn't clobber or :once fixture
14:56abaranosky2timvisher: I will comment out my requires and see what happens, but I don't as a rule execute code in the loading of a file
14:56abaranosky2meaning I hide things behind defns whenever possible
14:58abaranosky2timvisher: hmmm, commenting out requires is now NOT crashing :)
14:58abaranosky2timvisher: I'll try commenting that back in one by one
14:59timvisherabaranosky2: i'm with you. sometimes something slips in.
15:02abaranosky2timvisher: this require is causing the crash: (:require-macros [cljs.core.async.macros :as am])
15:02abaranosky2which ironically was not being used in man.cljs :)
15:03timvisherlol. that's interesting.
15:09swedishfishjustin_smith: okay, I think I'll take the approach of partitioning test types into directories, build out a small test runner namespace with functions for running integration, unit, etc. which will just load the namespaces based on a files in respective directories.
15:18justin_smithswedishfish: remember that is called inside functions works
15:18justin_smithso you could define tests that call the same functions, but with different fixtures
15:19justin_smithswedishfish: that is, if you call a function inside deftest that has clojure.test/is calls inside it, that does the right thing
15:20andyfpuredanger: after seeing your latest blog posts on changes to Clojure, I am simultaneously mightily impressed with your diligence, and scared of ever again submitting a perf related patch :)
15:23andyfFor anyone else who wants to read it, http://insideclojure.org/2015/01/07/vec-perf/
15:23jackhillandyf: thanks! I was just getting ready to ask
15:32justin_smithpuredanger: excellent article, small typo "After a lot of experimentation, I would up with the following cases"
15:32justin_smiththink you wanted "wound" there?
15:33puredangerthx, fixed
15:33justin_smithand big wow on those performance improvements! good work
15:33tcrayford____(inc puredanger)
15:33puredangerand Rich just ok'ed that one a few minutes ago for the next alpha (which should be coming soon)....
15:33tcrayford____puredanger: excellent work :)
15:34tcrayford____now too s/into []/vec/g all over github
15:36puredangerwell, check those perf #s closely - use case matters
15:36puredangerI think any place where you are normalizing input and may *sometimes* receive a vector, then vec is definitely the right choice
15:36puredangerif you know you are calling it with either small inputs or non-frequently, then shouldn't really matter
15:37puredangerif frequent or big inputs of known particular type (like seq, etc) then … depends
15:38puredangerinto has the big benefit of taking a transducer which you should leverage if it makes sense
15:39tcrayford____(if you can use 1.7 ;) )
15:39puredangerwell if you're relying on these perf changes then 1.6 won't help you either :)
15:41sdegutisWhat are some solutions for providing "mixin-like" functionality with Clojure deftypes?
15:42hyPiRionpuredanger: Speaking of performance patches, is there some way you recommend people to document performance patches/submissions?
15:43llasramsdegutis: protocol partial implementation maps?
15:43sdegutisWhat?
15:43clojurebotWhat is meta
15:43amalloyclojurebot: meta is meta
15:43clojurebotA nod, you know, is as good as a wink to a blind horse.
15:44llasramsdegutis: You can use `extend` to provide a protocol implementation as a map of keyword protocol-function-names to functions
15:44llasramThese maps are just maps, so you can build them elsewhere, merge them, etc
15:44sdegutisAh.
15:44puredangerhyPiRion: they generally need to demonstrate an improvement across a meaningful set of examples (which often is wider than just the thing you start with). and the tests need to be done with something like criterium usually, although sometimes cruder tests with time can be sufficient
15:45sdegutisllasram: This is the solution I have now, for better or worse: https://github.com/sdegutis/oops/blob/master/src/oops/core.clj#L4
15:45puredangerhyPiRion: not sure if that answered your question
15:48hyPiRionpuredanger: Yeah, thanks
15:48mikerod,(inc puredanger)
15:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: puredanger in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:48mikerod(inc puredanger)
15:49mikerodfor these good blog post
15:49mikerodposts*
15:51arrdemso what "Intro to Clojure" tutorial do people like to point beginners towards? A friend is getting started and I'm realizing that while I can offer a lot of criticism & help I don't have good intro material to point too.
15:52tcrayford____https://aphyr.com/media/context.html
15:52tcrayford____oops, wrong link
15:52tcrayford____I like a fear's: https://aphyr.com/tags/Clojure-from-the-ground-up
15:54arrdemtcrayford____: thanks I forgot about aphyr's intro posts
15:54tcrayford____iirc it's gonna be a book eventually
15:55arrdemgigasquid also has a book on the way I think...
15:55arrdemmaybe same book
15:55gigasquidyes "Living Clojure" should be out for early release in the next couple of weeks
15:56arrdemyaaaas
15:56amalloyyou think gigasquid and aphyr are the same person, arrdem? has anyone ever seen them together?
15:56gigasquidha ha
15:56arrdemhaha
15:58gigasquidClojure of the Brave and True is really good too
15:58gigasquidhttp://www.braveclojure.com/
16:01tcrayford____clojurebot: aphyr is gigasquid
16:01clojurebotOk.
16:01gfredericks~gigasquid
16:01clojurebotCool story bro.
16:02tcrayford____clojurebot: gigasquid is aphyr
16:02clojurebotIn Ordnung
16:03hipsterslapfightgigasquid: any place to see "living clojure" now or do we have to wait for early release?
16:03hipsterslapfight(already made my way through aphyrs posts and most of CftBaT and loved them both)
16:03gigasquidnot yet ....
16:03gigasquidshouldn't be too long
16:04hipsterslapfightokay i shall follow you on twitter and expect you to announce it there :v
16:04gigasquid:)
16:04arrdem:+1:
16:25stuartsierramodularity.org is down http://www.downforeveryoneorjustme.com/modularity.org
16:25bridgethillyergigasquid: YAY
16:25gfredericksdoes this have something to do with some javascript community twitterfight that I hear echos of on twitter?
16:33hipsterslapfighthaha, module shaming
16:34TimMc~twitterfight
16:34clojurebotPardon?
16:35amalloywhat is modularity.org when it's not down?
16:36gfrederickstwitter is a place where I see lots of echos of what seem like big dramatic fights/crises
16:36tcrayford____modularitee
16:36gfredericksbut almost never the events themselves
16:36gfredericksit takes digging
16:37SagiCZ1has anyone experienced unlearning both java and OOP by using clojure for too long? i am freaking out, i cant design anything anymore :X
16:38justin_smithSagiCZ1: sounds similar to the "code switching" problem that new learners of natural languages run into
16:39SagiCZ1yeah.. i need to switch my brain
16:40justin_smithSagiCZ1: there i a stage before full fluency where the categories "leak" and you have a hard time speaking in either language properly
16:40justin_smithor that is my recollection of it at least
16:40SagiCZ1that would be my case since i dont know either java nor clojure at an expert level
16:43tomjackif I try to write some java and to be happy about the result, I inevitably wind up at clojure.java.api
16:43SagiCZ1haha.. tomjack but i need to write real java.. sadly
16:44tomjackme too :(
17:19[blake|So what's the routine for pointing one project toward a JAR that you're building in another project? Just point the dependent project.clj toward that other directory?
17:20[blake|(I did this, like, six months ago and I've totally forgotten. Dude.)
17:37[blake|lein install!
17:37[blake|Can't believe I forgot that.
17:57hellofunkhow can i check if a def'd symbol was given a value? like (def a), learning that it wasn't (def a whateve)
18:03thheller(instance? clojure.lang.Var$Unbound a)
18:03hellofunkthanks
18:17ambrosebsIIRC .hasRoot on a Var is more reliable
18:38cperkins,(clojure.string/split "/foo" #"/")
18:38clojurebot["" "foo"]
18:38cperkins,(clojure.string/split "/" #"/")
18:38clojurebot[]
18:39cperkinsWhy is (clojure.string/split "/" #"/") not [""]?
18:40amalloycperkins: read the docs for java.lang.String/split, which clojure just delegates to
18:40amalloybasically, the default behavior is to strip trailing empty matches
18:41cperkinsamalloy: thanks, that makes sense, I guess
18:44andyfcperkins: Give split a last arg of -1 and the results might start to look more consistent across your examples
18:46cperkinsandyf: cool, that helps, thanks
19:07[blake|Is "decorate" used any more?
19:07[blake|I guess that should go to weavejester...
19:08cperkinsblake: I think it's sleepytime where weavejester lives
19:09[blake|cperkins: Code never sleeps...
19:09weavejesterAlmost :)
19:09[blake|Heh
19:10weavejesterI wrote a decorate library way back when, when I didn't really understand Clojure.
19:11amalloyweavejester: i think i've tried to dissuade [blake| from using decorate before
19:11weavejesterI wouldn't recommend using it.
19:11[blake|amalloy: Noooo. You've dissuaded me from using flatten.
19:12[blake|But I look at decorate and think "Is that really necessary?" There's a Hooke thing like that, too.
19:13[blake|I'm actually just trying to figure out my responsibilities vis a vis compojure's session handling. And the doc I found is real old. And it uses decorate.
19:14weavejester[blake|: Are the official docs insufficient? https://github.com/ring-clojure/ring/wiki/Sessions
19:15[blake|weavejester: Well, I'm having problems. =)
19:16[blake|weavejester: What I guess I'm not getting is this: When I call wrap-session, is it true, that from that point forward, the session data should be preserved?
19:17weavejesterI'm not really sure what you mean by that.
19:17[blake|weavejester: Disallowing things like storing to cookies. Just "OK, here's some session info."
19:17weavejesterWhen you return a :session key in the response, that triggers a write in the session store.
19:18[blake|weavejester: Right. So I have "(assoc (resp/redirect "/") :session (get-privileges user pass))", for example.
19:19[blake|weavejester: But most of the time, I'm not doing anything with the response. Not directly.
19:19weavejesterYes, that should overwrite the session, if you return the response.
19:19[blake|weavejester: And that seems to work. But every now and again, the session info seems to empty out.
19:20weavejesterWhich session store are you using?
19:20weavejesterIf it's an in-memory store, reloading a namespace will clear it.
19:21weavejesterAnother possible issue is if you have two session middleware overlapping.
19:21[blake|weavejester: Oh! OK, yeah. Although I don't think I'm doing that, that's the kind of thing I'm looking for.
19:21[blake|weavejester: For a while I had wrap-session and handler/site.
19:22[blake|weavejester: Now it's just handler/site.
19:22hellofunkis it possible to reload a namespace from the REPL for that namespace? essentially recompiling it, without interacting directly with the source file
19:22weavejesterhellofunk: You can use (:require 'blah.core :reload)
19:22amalloyhellofunk: require :reload
19:22[blake|hellofunk: ooh...well, I do THAT a lot, but I'd think they'd be running in different spaces. I don't believe I'm running an nREPL into my running app.
19:22hellofunkah, cool, i shall try
19:23[blake|oh, you weren't talking about my problems...what a blow =P
19:24[blake|weavejester: OK, so it really is "just wrap-session and the data persists" (barring a few situations)?
19:24[blake|(Sometimes things are just too simple.)
19:25weavejester[blake|: Yep.
19:26[blake|weavejester: OK, then.
19:26weavejesterIf you're using a memory-store and reload the namespace, that might clear it. Or if you accidentally overwrite the session from another route.
19:26weavejesterBut the underlying mechanism is pretty simple.
19:26weavejesterWhatever's in the :session key on the response becomes the new session.
19:26[blake|weavejester: I am doing nothing deliberate with the store. So it's whatever the default is.
19:27[blake|Makes sense. Could an ajax call be a problem?
19:27weavejesterThe default is an in-memory session. If you reload your app namespace, that'll likely cause it to be wiped.
19:27weavejesterAn ajax call is no different from a normal HTTP call.
19:27[blake|(= in-memory memory-store)?
19:28amalloyweavejester: isn't ring's default session a temporary per-request session, rather than one for the ilfetime of the server?
19:28[blake|weavejester: OK, so if I have a link to "/input/whatever" and someone with a session clicks on that link...
19:28weavejesteramalloy: No, it stores the data in an atom that's created when the middleware is applied.
19:29[blake|What's weird also is that the session info comes and goes.
19:30[blake|After a login, I have a drop down that pulls up one of several data entry forms. The user's name is there. The user selects the form, and it looks like he's logged out. He pulls up a list of saved reports, he's logged in again.
19:31weavejester[blake|: That sounds like the session path might be mis-set
19:31[blake|weavejester: Session path?
19:31weavejesterThe path the session cookie applies to
19:32weavejesterThough by default it's "/", so that shouldn't be the issue.
19:32weavejesterWithout seeing your code, I can't really tell you where you might have gone wrong
19:33[blake|weavejester: Right, which is why I was trying to do the most basic example.
19:33[blake|I'll see if I can work it up from the docs using the count.
19:34[blake|It's a responsibility issue, though. If I had to pass the session around everywhere explicitly, I could understand.
19:37[blake|shhheee...what if I'm just destructuring session data wrong...
19:38[blake|Nah, that's write. The session is actually coming IN as {} when it fails.
19:39[blake|er, that's right...
20:26justin_smith$ping lazybot
20:26justin_smith:(
20:29amalloy&'hello
20:29lazybot⇒ hello
20:31justin_smithcool
22:25gfredericksI'm about to write a function called semisort does it exist already?
22:51justin_smithwhat would semisort do?
23:30rhg135for any X in 'is ther a function which does X' it's almost always yes