#clojure log - Jan 09 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

4:54 Biofobico: .

4:55 clgv: ;

4:55 ,;

4:56 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:03 TEttinger: ,#_;

5:03 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:04 rhg135: Is ; not a form?

5:05 Anyway I'm out of here, 4am comes too soon

5:08 TEttinger: rhg135, it is not a form, it's ignored, like #_()

5:11 CookedGryphon: does 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.

5:12 is there any way I can determine what code is doing the bad put?

5:21 H4ns: what 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?

5:22 slipset: yes, there is, and it's used in transducers (I think)

5:23 https://clojuredocs.org/clojure.core/transient

5:24 H4ns: ah, nice! thanks!

5:25 CookedGryphon: Are 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?

5:35 TEttinger: H4ns, yeah transients are awesome for performance, but be aware that they do not support the full group of seq/collection fns

5:36 (really just the bare minimum)

5:36 H4ns: TEttinger: i have actual performance issues that i need to deal ith, so they should be fine.

5:37 Biofobico: I 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")

5:37 TEttinger: Biofobico, that's correct. more typically you'd define that fn outside though

5:37 H4ns: i 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.

5:37 Biofobico: Is the any tips for a noob to try to understand better this inside out type of writing?

5:38 TEttinger: ,(defn hello [who] (str "Hello, " who "!"))

5:38 clojurebot: #'sandbox/hello

5:38 TEttinger: ,(hello "Neo")

5:38 clojurebot: "Hello, Neo!"

5:38 Biofobico: Makes sense now :)

5:39 TEttinger: typically 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

5:40 Biofobico: I am following a tutorial and probably that type of syntax will be later on on the tutorial

5:42 TEttinger: ,(let [hello (fn [who] (str "Hello, " who "!"))] (hello "Neo"))

5:42 clojurebot: "Hello, Neo!"

5:43 TEttinger: let 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 )

5:47 Biofobico: so that code is saying that hello = "Hello, " and [who] = "Neo" ?

5:51 TEttinger: Biofobico, yeah, although [who] isn't quite right, who is "Neo" and the [] just shows that the arguments vector is what's inside it

5:52 actually not quite right

5:52 hello is not right away "Hello, !"

5:53 hello 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

5:53 the tutorial will get to defining fns soon I hope

5:54 but it's the most important early concept in almost any programming language, being able to make abstractions

5:56 Biofobico: thank you for the clarification :)

5:56 TEttinger: another 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)

5:57 clojure has a lot of really well-named functions in its standard library :)

5:57 stuff like frequencies

5:57 ,(frequencies [:a :a :a :b])

5:57 clojurebot: {:a 3, :b 1}

5:58 Biofobico: on 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

5:58 the_frey: tbh 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

5:58 TEttinger: brave clojure I have heard good stuff about, not sure about first language stuff

5:58 the_frey: the O'Reilly Clojure textbook assumes you already know like Ruby or something, a lot of the examples refer to ruby/java

5:59 TEttinger: brave clojure I found pretty useful coming across to clj from ruby/python

5:59 TEttinger: don't be afraid to ask questions over IRC though, there's almost always someone online who is able to help

5:59 the_frey: particularly the stuff on bootstrapping an emacs cfg

5:59 +1

5:59 clojure irc is one of the best behaved and helpful channels I know of

6:00 Biofobico: I only know html and css. i tried ruby, php and python. found ruby and python somewhat similar and php plain alien stuff

6:01 TEttinger: I'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

6:01 Biofobico: then i stumbled on clojure by chance

6:02 and while the syntax is very dif from those languages, it made more sense to me

6:03 the_frey: Biofobico I think the simplicity of how a lot of clojure reduces down to fundamentals probs makes it a good first lang

6:03 but it's not 'C-like' as a lot of langs are (e.g. python/ruby)

6:05 Biofobico: my goal is web dev. Since I already know html and css, i decided to learn a prog. language and also javascript

6:06 the_frey: Biofobico for web dev I'd learn ruby or python tbh

6:06 there are more jobs

6:06 TEttinger: Biofobico, 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

6:06 Biofobico: after i decided to learn clojure, i read that there is clojurescript

6:06 the_frey: also javascript is a programming language :P you can use js for the server side stuff with node.js

6:07 TEttinger: it's really worth it to learn lots of languages, especially at the mid-point of your learning experience

6:08 Biofobico: i know js is a programming language :)

6:09 the_frey: TEttinger I dunno, think it depends on your level of experience, pays to focus aggressively on one first no?

6:09 TEttinger: I 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"

6:09 the_frey: but yeah learning clojure is useful as it's so different, it'll make you a way better programmer

6:09 TEttinger: exactly

6:09 Biofobico: but if i understand it correctly, clojurescript is clojure with some modifications

6:10 the_frey: yep couldn't agree more with what you said there TEttinger

6:10 TEttinger: yeah, clojurescript also uses clojure (the kind you are learning now) during certain kinds of code

6:11 so it helps to know clojure first if you want to write macros in clojurescript, but the two are other than that almost identical

6:11 the standard lib is almost the same

6:13 I'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

6:14 the_frey: +1 JS is a batshit language, but it does teach you how to use functions as data in very practical ways

6:16 TEttinger: but 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

6:16 dysfun: can you get the edn reader to annotate line numbers?

6:17 TEttinger: so you could pretty easily bring in code you wrote for clojure into your pure JS programs

6:19 Biofobico: my 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

6:20 TEttinger: ah cool

6:21 Biofobico: then try to write in js what i wrote in clojurescript

6:21 zot: i'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

6:21 Biofobico: if that makes any sense as a learning experience

6:21 TEttinger: Biofobico, yeah it does

6:22 zot: if 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.)

6:22 any suggestions on how to debug this?

6:22 TEttinger: I'm rewriting a similar program now in F# after writing it in C#, then Scala

6:22 actually then Java, most recently

6:22 dysfun: f# is a horrible language

6:22 as is java

6:22 as is scala

6:22 c# is just java with slightly better designed libraries and a different runtime

6:23 TEttinger: I definitely agree about java and scala, I only use java because it was faster to prototype something with a particular lib

6:23 dysfun: and a few more 'kitchen sink' language features

6:23 but scala has the kitchen sink element down

6:24 faster than repl driven development?

6:26 mearnsh: TEttinger: there's also fogus' lemonad https://github.com/fogus/lemonad

6:27 wink: dysfun: why do you think repl-driven is always fastest?

6:33 dysfun: compared to the recompile cycle?

6:33 unless you've got something like jrebel, no chance.

6:34 wink: compared to other languages where you just write code, tests, and rerun a module/class whatever like 2-3x and it's done

6:34 I mean, I do a lot of python and I don't see myself rerunning stuff so often that I'd prefer a repl

6:34 on clojure I'm just too bad to write it correctly the first few times, then a repl is awesome

6:35 SagiCZ1: wink: well compared to the traditional java cycle.. its a big difference

6:35 and AFAIK, python does have REPL so the comparision is moot

6:35 wink: it's not moot if I don't use it

6:37 dysfun: i will say that testing in perl is a joy because perl doesn't rely on the jvm so bootup times are tiny

6:37 SagiCZ1: but python is interpreted.. not compiled.. so there is smaller delay

6:37 dysfun: but autotest is pretty good these days, so i get pretty quick tests

6:37 SagiCZ1: and its not just about speed.. its about experimenting with something you would rather not change in your source code

6:38 dysfun: yeah, the repl is all about playing with things so you can understand how they work

6:39 SagiCZ1: i 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

6:39 dysfun: i'll often learn more that way than writing tests

6:39 or reading the docs. some docs are terrible

6:39 i find myself reading other peoples' clojure code a lot

7:41 daniel_: [

7:41 ]

7:41 atankanow: destructuring in clojure is awesome ... that is all

7:42 daniel_: clojure is awesome

7:42 SagiCZ1: +1

7:42 CmdrDats: (inc atankanow)

7:42 lazybot: ⇒ 1

7:43 atankanow: thanks!

7:49 daniel_: (inc atankanow)

7:49 lazybot: ⇒ 2

8:07 virmunid: Hello. I was wondering if a function can be referenced in edn? I'm trying to get dependency injection in my ring app.

8:13 magnars: virmunid: 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

8:15 virmunid: magnars: 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?

8:15 magnars: aye

8:16 or a quoted symbol, 'some.ns/an-impl

8:18 virmunid: Cool. thanks.

8:18 I'll play around with it. It

8:18 It's been this very issue that's prevented me from moving forward on my project for 6 months.

8:19 magnars: virmunid: another way to do DI is by defining a protocol

8:20 slipset: virmunid: have you looked at stuart sierras components?

8:20 virmunid: magnars: 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.

8:20 slipset: https://github.com/stuartsierra/component

8:20 daniel_: dnolen_: your post on javascript modularity made me think we need similar dead code eliminiation on the frontend

8:21 s/frontend/css/

8:21 virmunid: slipset: 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

8:21 daniel_: rather than selecting bootstrap modules for example, it would be great to have similar dead code elimination there

8:22 tbaldridge: virmunid: 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.

8:23 for libraries of a certain level of simplicity, updates aren't needed on a regular basis.

8:23 virmunid: tbaldridge: is there a ring example for it? The idea of the lifecycle was appealing. Since I'm new, writing the ring adapter was scary.

8:23 slipset: virmunid: puredanger has this http://tech.puredanger.com/2014/01/03/clojure-dependency-injection/

8:24 more with what magnars says wrt using protocols

8:25 I've been thinking about using some ideas that tbaldridge shows in https://www.youtube.com/watch?v=R3PZMIwXN_g

8:25 sveri: Hi, 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

8:25 daniel_: i started working on a responsive css framework in clojure/garden

8:26 slipset: where he instead of using functions that require a ctx param, he retuns functions which need a ctx param

8:26 daniel_: perhaps you have a suggestion for extracting selectors from om components, i use standard om dom functions rather than fancy templating

8:26 slipset: so instead of (defn foo [ctx bar] ..)

8:26 you do (defn foo [bar] (fn [ctx] ...))

8:27 but I'm not sure how this plays out in the real world outside my head.

8:28 magnars: slipset: sounds a bit like manual partial application :)

8:28 slipset: magnars: yes I guess

8:29 but since tbaldridge does it that way, I guess it has some merrit :)

8:29 tbaldridge: it's pretty much the state monad

8:29 I'd say it's "one" way to do it, perhaps not the best, or worst

8:30 slipset: magnars: I guess that in a more involved example the returning function will close over some values from the called functions.

8:31 magnars: yeah, it's an interesting thought

8:36 dnolen_: daniel_: ah right, perhaps Webpack will eventually get there

8:40 clgv: Whoever suggested "Javadoc Search Frame" for Firefox (via Greasemonkey), thank you very much! It has been really useful so far.

8:46 slipset: magnars: I think that was how we built a lisp-parser in lisp in http://folk.uio.no/in211/Gamle/H95/www_docs/

8:47 imagine, I was using a state monad in the 90's without even knowing about it

8:51 hellofunk: i can't believe you guys are talking about gonads

8:51 i mean really?

8:51 oh sorry i misread

8:52 slipset: that's right, we're talking about burritos

8:52 daniel_: dnolen_: is there a way to get an html string from an om component definition?

8:52 dnolen_: daniel_: pretty sure it does CSS minification

8:52 daniel_: use a React ref + get innerHTML property

8:54 daniel_: ok, thanks

8:56 espinho: .

9:56 sdegutis: Would it be inappropriate to post an announcement in the Clojure mailing list about my new OOP library (https://github.com/sdegutis/oops) ?

9:57 hellofunk: sdegutis: i don't see why not.

9:57 sdegutis: 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.

9:59 sdegutis: Plus I don't think they're mutually exclusive.

10:00 hellofunk: sdegutis: 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:01 sdegutis: hellofunk: I get the feeling different people mean very different things by OOP

10:02 Personally by OOP I mean "a way to make some arguments implicit on a set of related functions."

10:02 hellofunk: sdegutis: 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:06 sdegutis: 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:06 daniel_: sdegutis: isn't that what higher level functions are for?

10:06 higher order*

10:06 sdegutis: daniel_: yeah it's basically a convenience layer around HOF

10:06 daniel_: it wraps them for you with partial, while making the partial'd values easy to access, and all the while being very efficient

10:10 hellofunk: sdegutis: 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:10 sdegutis: hellofunk: 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:12 I 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:20 I'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:20 Is that not supposed to work when running tests?

10:21 Bronsa: sdegutis: can you nopaste the namespace file?

10:21 sdegutis: https://gist.github.com/sdegutis/12fac289e5cfd682ce09

10:22 Those are macros which compile down to definterface/deftype things.

10:22 Bronsa: sdegutis: where should it output a warning in your opinion?

10:22 sdegutis: "defmethod kind" is not type-annotated.

10:22 Bronsa: sdegutis: so?

10:23 sdegutis: It returns a string but I never told the compiler that -- is it inferring it?

10:23 Bronsa: sdegutis: no it's returning an Object

10:23 sdegutis: you never use an interop form on the return type of kind that assumes a String

10:23 if you did, you'd get a reflection warning

10:24 sdegutis: e.g. try replacing (.kind spot) with (.substring (.kind spot) 0)

10:24 sdegutis: Oh.

10:25 Thanks :)

10:36 clgv: short maven question: what is the maven equivalent of "lein uberjar"?

10:37 gfredericks: might need a plugin for that

10:37 clgv: oh. :/

10:39 stuartsierra: clgv: http://maven.apache.org/plugins/maven-assembly-plugin/

10:39 dnolen_: Thinking about cutting Om 0.8.0, anything anyone absolutely needs before I do? Speak now or forever hold your peace

10:39 clgv: stuartsierra: thank you.

10:40 stuartsierra: Specifically, the `jar-with-dependencies` descriptor. I'm sure the web has copy-and-paste examples.

10:40 clgv: stuartsierra: it's on a page linked from yours http://maven.apache.org/plugins/maven-assembly-plugin/usage.html

10:43 sdegutis: How do you add a type hint where your deftype is expected?

10:43 First it says no class java/lang/MyType expected. Then I try saying ^foo.foo-test/MyType and it gives a similar error.

10:44 atankanow: clgv: 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:45 Bronsa: sdegutis: a deftype Foo in ns foo.foo-test has type foo.foo_test.Foo

10:45 sdegutis: Thanks.

10:47 virmunid: stuartsierra: would you make a tutorial showing how to use component with ring for noobs like me?

10:47 weavejes_: virmunid: There are a few different ways people have come up with for integrating the two.

10:48 stuartsierra: virmunid: Others have already made examples.

10:49 virmunid: stuartsierra: 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:49 clgv: On "mvn package" I get the error that "-source 1.3" is set. does maven set that somewhere?

10:51 csd_: have any of you attempted the problems at cryptopals.com with clojure?

10:53 weavejes_: virmunid: Two approaches I know of are modular and duct.

10:54 weavejester: virmunid: I prefer Duct, because I wrote it ;)

10:54 virmunid: weavejester: that makes me more confident, :)

10:54 stuartsierra: First Google result I get has many examples https://groups.google.com/d/topic/clojure/12-j2DeSLEI/discussion

10:56 virmunid: staurtsierra: for my own edification, what was your query?

10:57 stuartsierra: virmunid: https://www.google.com/search?q=clojure%20component%20ring%20example

10:58 virmunid: well don't I feel sheepist

10:59 stuartsierra: Also examples at http://www.uswitch.com/tech/more-open-source-clojure-systems-please/

11:00 (not found on google, but it should be)

11:01 EvanR-work: is there a way to

11:01 get an exception backtrace as a string

11:01 gfredericks: what do you want it to look like?

11:02 ,(->> (Exception.) .getStackTrace seq pr-str)

11:02 clojurebot: "(#<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:02 hellofunk: i'm doing a 4clojure problem and am curious how you can test if somethign is a set without using set? predicate

11:02 gfredericks: ,(supers (class #{}))

11:02 stuartsierra: (with-out-str (.printStackTrace *e *out*))

11:02 clojurebot: #{java.util.Collection clojure.lang.Counted clojure.lang.IPersistentCollection clojure.lang.IMeta clojure.lang.Seqable ...}

11:02 hellofunk: gfredericks: set? and class are not allowed in the problem

11:03 gfredericks: what about instance?

11:03 virmunid: stuartsierra: thanks

11:03 gfredericks: sounds like a weird problem

11:03 hellofunk: instance? and Class are not allowed either

11:03 nor is getClass

11:03 gfredericks: okay then this sounds like a weird puzzle

11:03 hellofunk: gfredericks: agreed, but i'm curious.

11:03 gfredericks: that doesn't have very much to do with normal clojure usage

11:04 perhaps (= #{} (empty the-set))

11:04 EvanR-work: is there a way to dump all the exceptions information as a string

11:04 hellofunk: gfredericks: i like that

11:04 gfredericks: EvanR-work: well an arbitrary exception could have information stored in arbitrarily strange ways

11:05 EvanR-work: hmm.

11:05 clgv: stuartsierra: got it building. thank you again!

11:05 EvanR-work: im definitely throwing an ex-info in case something doesnt validate

11:05 but results of bugs or I/O errors would be nice to see

11:05 in my debug log

11:11 in (with-out-str (.printStackTrace *e *out*)) what is *e

11:12 pyrtsa: ,(doc *e)

11:12 clojurebot: "; bound in a repl thread to the most recent exception caught by the repl"

11:12 hellofunk: why does (reverse '(1 2 3)) work, but (reversible? '(1 2 3)) report false ?

11:12 EvanR-work: nice

11:12 arohner: hellofunk: you could look at the behavior of conj?

11:12 (-> x (conj :a) (get :a) (= :a)

11:12 EvanR-work: ,(doc reversible?)

11:13 clojurebot: "([coll]); Returns true if coll implements Reversible"

11:13 hellofunk: EvanR-work: i see, so you can reverse something even if it is not from Reversible.

11:13 EvanR-work: it begs the question what Reversible is

11:13 pyrtsa: Reversible means (almost-)constant-time reversible.

11:13 EvanR-work: i usually have to look at the source for this

11:14 so FastReversible

11:15 arohner: EvanR-work: http://begthequestion.info/

11:15 :-p

11:16 andyf_: arohner: Nice web page.

11:16 arohner: andyf_: I didn't write it, but I use it far too often

11:16 maybe I should write a BegsTheQuestion twitter bot

11:17 andyf_: I will pass it on. Fight the good fight, man.

11:17 csd_: Why does this code return the error message "Illegal base64 character a"? https://www.refheap.com/95918

11:17 arohner: andyf_: there's also this, if you're into that sort of thing: http://www.qwantz.com/index.php?comic=693

11:17 hellofunk: arohner: 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:21 gfredericks: question-begging: http://languagelog.ldc.upenn.edu/nll/?p=2290

11:27 EvanR-work: arohner: haha... seems fine to me!

11:28 arohner: :-)

11:28 EvanR-work: not even wrong

11:29 * EvanR-work waits for a link to a page for that one

11:30 EvanR-work: java.lang.IllegalArgumentException: No matching method found: printStackTrace for class clojure.lang.Var$Unbound

11:30 this is when i tried to use (.printStackTrace *e *out*)

11:30 inside an exception handler

11:30 justin_smith: gfredericks: excellent post, I love those guys

11:30 (inc gfredericks)

11:31 $ping lazybot

11:31 :(

11:31 gfredericks: justin_smith: yeah me too

11:31 llasram: (doc *e)

11:31 clojurebot: "; bound in a repl thread to the most recent exception caught by the repl"

11:31 EvanR-work: oh

11:32 back to the drawing board

11:32 </incorrect-usage>

11:33 hellofunk: whoever made this site has a nice sense of humor: http://clojurescriptkoans.com/#conditionals/8

11:39 llasram: EvanR-work: What are you trying to do?

11:39 EvanR-work: justin_smith: i cant help but expect the conclusion of that blog to be the conclusion for a great many "misused" phrases...

11:39 llasram: well, just debug log an exception, without crashing

11:39 llasram: In an exception handler you should have the exception itself, bound to the identifier provided as an argument to the (catch) form

11:41 EvanR-work: And tools.logging functions all have forms which take an exception and will log the associated stack trace

11:41 EvanR-work: yeah i have (catch Exception e (log/debug (str e "\n" (pr-str (seq (.getStackTrace e))))))

11:42 which is ok

11:42 justin_smith: EvanR-work: but the level of detail it uses in letting us know how it got to be so misused is awesome

11:42 clgv: EvanR-work: how about clojure.stacktrace/print-stack-trace?

11:44 EvanR-work: clgv: well, you mean with-out-str ?

11:47 clgv: EvanR-work: (log/error (with-out-str (print-stack-trace e)))

11:47 ,(doc with-out-str)

11:47 clojurebot: "([& 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:47 clgv: ,(with-out-str (println "abc"))

11:47 clojurebot: "abc\n"

11:47 clgv: ,(count (with-out-str (println "abc")))

11:47 clojurebot: 4

11:48 EvanR-work: i know about this, but i want the text of the exception too

11:48 clgv: EvanR-work: that is what `clojure.stacktrace/print-stack-trace` does

11:49 try the full logging example above ;)

11:49 EvanR-work: alright

11:50 sdegutis: Aw, type hints of a class can't be used in the definition (deftype) of that selfsame class?

11:50 Blast!

11:50 clgv: usually I use print-cause-trace to have more information

11:51 sdegutis: this would only help with reflection warnings in inline protocol/interface implementations. nothing more

11:51 EvanR-work: very nice

11:51 clgv: sdegutis: you can't "type" deftype fields other than the supported primitive types

11:51 EvanR-work: hijacking the standard output stream seems like a very php way to do it but it works

11:52 Bronsa: sdegutis: they can be used

11:52 ,(defprotocol p (f [_ _]))

11:52 clojurebot: p

11:52 clgv: EvanR-work: it is thread-local hijacking afaik, so it is ok for that task

11:53 Bronsa: ,(deftype x [a] p (f [_ ^x o] (.a o)))

11:53 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't find matching method: f, leave off hints for auto match., compiling:(NO_SOURCE_PATH:0:0)>

11:53 Bronsa: ,(deftype x [a] p (f [_ _ ^x o] (.a o)))

11:53 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: f, compiling:(NO_SOURCE_PATH:0:0)>

11:53 Bronsa: uh.

11:53 clgv: EvanR-work: but an outputstream or writer to pass to clojure.stacktrace functions would be a better way, sure

11:54 Bronsa: well sdegutis, apparently not in the argvec but you can use them elsewhere

11:54 EvanR-work: yeah i didnt think it was unsafe

11:54 Bronsa: ,(deftype x [a] p (f [_ o] (.a ^x o)))

11:54 clojurebot: sandbox.x

11:54 Bronsa: ^ there you go

11:54 clgv: Bronsa: he meant the field declarations.

11:55 Bronsa: clgv: uhm, that's not how I read it but you might be right

11:56 clgv: Bronsa: 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:56 timvisher: so who wants to straighten me out RE macros? :) https://gist.github.com/timvisher/f580f8ee19bdfcf7232a

11:56 am i going down a rabbit hole? is this not possible?

11:57 i 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:57 clgv: timvisher: the dots are problematic

11:58 timvisher: and ^ probably as well

11:58 Bronsa: TimMc: and as the exception tells you, 1a is not a valid clojure literal

11:59 timvisher*

11:59 timvisher: Bronsa: 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:59 clgv: timvisher: you can try via (defmacro deflevel [& args]), if that fails you have characters that er not accepted by the clojure reader

11:59 Bronsa: timvisher: what you pass to a macro must still be a valid clojure form

11:59 timvisher: ok

11:59 that makes more sense

12:00 clgv: ,(defmacro deflevel [& args])

12:00 clojurebot: #'sandbox/deflevel

12:00 Bronsa: timvisher: macros consume clojure forms, it's not a string preprocessor like in C

12:00 timvisher: so in other words, i'm buying almost nothing by using a macro here, as usual. :\

12:00 clgv: ,(deflevel .)

12:00 clojurebot: nil

12:00 clgv: ,(deflevel |....|)

12:00 clojurebot: nil

12:00 clgv: damn. that'll work ;)

12:00 timvisher: lol. i'm still committed to one day find a use for these things :)

12:00 Bronsa: ,(deflevel ^)

12:00 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

12:01 clgv: ok so not the dots but ^

12:01 Bronsa: timvisher: well if you have written more than a hello world in clojure you have definitely used macros before

12:01 clgv: I remember it failing for relative filenames "../bla.txt" probably because thats not a valid symbol

12:02 Bronsa: ,'../bla.txt

12:02 clojurebot: ../bla.txt

12:02 clgv: ,(deflevel ../bla.txt)

12:02 clojurebot: nil

12:02 timvisher: Bronsa: i mean a macro that i've written.

12:02 :)

12:02 Bronsa: clgv: the gotcha with symbols starting with . is that they get macroexpanded into the . special form when used in "invoke" position

12:02 clgv: except if they're macros, like `..` :/

12:04 arohner: is there a good way to stop an a/pipeline, other than stopping the JVM?

12:04 llasram: timvisher: Clojure strings can contain newlines -- any reason you don't want to just make them strings?

12:04 arohner: oh, I guess I can a/close! the input

12:04 tbaldridge: close the input channel

12:05 arohner: tbaldridge: yeah. it'd be nice if there was a blocking version so C-c from the repl worked

12:06 timvisher: llasram: if you make them strings you loose their rectangular nature

12:07 either 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:09 hiredman: /win 15

12:10 andyf__: timvisher: you might like clojure.string/join "\n" [ "line1" "line2" ...] except with each line string on separate line

12:12 timvisher: andyf__: 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 ,(if (empty? a-str) "default" a-str)

12:14 clojurebot: #<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:14 kryft: I 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 &(+ 1 1)

12:16 Uh oh...did I break clojurebot?

12:18 timvisher: meh. not terrible… https://gist.github.com/timvisher/f580f8ee19bdfcf7232a

12:18 thanks all :)

12:18 andyf__: And now you have to pay for it :)

12:18 [blake|: I broke it, I bought it.

12:26 gfredericks: kryft: I think prismatic is a good choice

12:26 seangrove: dnolen_: 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:27 kryft: gfredericks: I'm just wondering how mature it is in practice

12:27 dnolen_: seangrove: there's already a module ticket open, I might take a look at it shortly

12:28 kryft: gfredericks: (Given that they state that it's alpha)

12:28 gfredericks: kryft: probably as mature as anything else

12:28 kryft: Ok, thanks

12:28 justin_smith: kryft: prismatic makes solid stuff

12:29 gfredericks: I love how par-compile with prismatic graph can give you exceptions that are buried in a stack of j.u.c.ExecutionException

12:30 I 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:31 (iterate #(.getCause %) e)

12:31 hiredman: (doc clojure.stacktrace/root-cause)

12:31 clojurebot: Cool story bro.

12:31 hiredman: clojurebot: idiot

12:31 clojurebot: No entiendo

12:32 gfredericks: well I might not want the *root* cause, just the one underneath the j.u.c.EEs :)

12:43 justin_smith: gfredericks: 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:45 gfredericks: wouldn't be hard for graph to mitigate though

12:45 justin_smith: oh?

12:45 gfredericks: I could submit a PR myself but instead I am chaflortling on IRC about it

12:46 justin_smith: yeah depending on exactly what behavior you want; naively you could just unwrap every exception you get on dereffing

12:46 I'm saying the library can fix it for the user

12:46 dnolen_: seangrove: I've marked the issues that I think are important

12:46 seangrove: reflecting through the compiler to emit the underlying arities would be a good noe

12:46 s/noe/one

12:54 zB0hs: how can i evaluate part of a form but have the rest of the form not evaluate

12:54 '[fun1 fun2 fun3] but only evaluate fun3

12:55 mgaare: zB0hs: with a macro

12:56 justin_smith: zB0hs: 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 That =has= to mean that function's being called somewhere immediately, doesn't it?

12:57 justin_smith: [blake|: yeah, add a stack trace print to see what called it

12:58 ,((nth [+ - * /] 2) 3 4)

12:58 clojurebot: 12

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:59 espinho: can 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:00 justin_smith: [blake|: you could do an (assert false), sure

13:01 but you can also get the current stack trace, one moment, looking up how to do it again

13:02 (map str (.getStackTrace (Thread/currentThread)))

13:02 that will just give you the trace as a lazy-seq of strings

13:02 [blake|: Thanks.

13:02 (inc justin_smith)

13:03 justin_smith: no bots!

13:03 [blake|: No peace!

13:03 justin_smith: oh wait clojurebot is actually working

13:03 hellofunk: (inc clojurebot)

13:03 justin_smith: haha

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 Er, loading it into the REPL.

13:09 espinho: There are a lot of them. I haven't found any of them very useful.

13:09 espinho: https://github.com/weavejester/compojure/wiki can get you started.

13:13 justin_smith: espinho: for learning programming with clojure, aphyr's "clojure from the ground up" is pretty well thought out

13:14 https://aphyr.com/tags/Clojure-from-the-ground-up

13:14 espinho: blake: 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:14 abaranosky: if I wanted to get humanized timestamps in CLJS what's a good way to do that? Like "3 days ago" for example)

13:15 espinho: justin_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:16 hellofunk: espinho: 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:16 abaranosky: in 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:17 hellofunk: 4clojure is like practicing scales for a musician

13:18 nullptr: imo 4clojure is better for brain conditioning than learning clojure in a practical way

13:18 hellofunk: 4clojure is particularly good for learning all the tricks you can use to mangle collections

13:18 nullptr: you could complete 4clojure and still have no idea how to add a lib in lein for example

13:19 hellofunk: nullptr: correct. 4clojure is stricly about learning the language philosophy and syntax

13:19 espinho: Tried 4clojure, but it was a pain to me since I really dont know clojure and this is my first programming language

13:19 hellofunk: *strictly

13:19 espinho: 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:19 nullptr: i'm hesitant to send new people to 4clojure, it's too easy to get stuck

13:20 requires pre-commitment to clojure

13:20 espinho: and 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:21 hellofunk: espinho: 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:22 espinho: cemerick has a youtube video that shows a basic web app built from scratch that is worth of a beginner

13:22 espinho: hellofunk:thank you.

13:22 hellofunk: *worthy

13:23 espinho: hellofunk: cemerick? Excuse my ignorance but i don't know what it is.

13:23 hellofunk: espinho: it's a dude. a cool dude. a smart dude.

13:24 espinho: a dude who has done a bunch for all of us.

13:24 espinho: hellofunk: oh ok :)

13:24 hellofunk: espinho: 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:26 espinho: hellofunk: I see. found the tube video, but is from 2012.

13:27 hellofunk: espinho: that's ok.

13:28 espinho: hellofunk: will check it later on then. thank you :)

13:28 hellofunk: espinho: 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:33 espinho: hellofunk: Never thought that the clojure irc peeps would be so helpful. It's a great contrast to some other language channels.

13:34 hellofunk: espinho: i totally agree

13:34 espinho: 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:35 espinho: hellofunk: :)

13:36 justin_smith: I 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:37 hellofunk: justin_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:38 justin_smith: hellofunk: that's a very good guess

13:39 exaptic: yeah definitely part of why i switched from a different FP language community. their irc channel was pretty toxic

13:40 espinho: I'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:41 EvanR-work: can you get keyword args that are required like in ruby

13:41 exaptic: maybe they're mad because their language is too hard to explain =)

13:42 EvanR-work: which doesnt explain why no body is noob bashing in here

13:43 hellofunk: EvanR-work: you mean fn args that must be a keyword only?

13:43 justin_smith: EvanR-work: you can do it manually via a :pre condition, and one could make a macro for it fairly easily

13:43 EvanR-work: hellofunk: i mean getting the effect of "WRONG NUMBER OF ARGS!!!!" but for keyword args "KEYWORD ARG FOO NOT PROVIDED!!!"

13:43 ok

13:43 j201: espinho: 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:44 gfredericks: we are nice because matz is nice

13:44 sdegutis: Is 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:44 EvanR-work: im on a tight schedule so ill just let nils slip through

13:44 justin_smith: something like: (fn [& {:keys [a b c]}] {:pre [a b c]} ...)

13:44 tbaldridge: sdegutis: no, infact there are some problems doing it that way

13:44 I normally recommend lein uberjar and upload the jar

13:45 sdegutis: Okay, that's what I do, but I got the impression it's not the typical way.

13:45 * gfredericks uses uberjars

13:45 sdegutis: (i.e. I upload uberjars)

13:45 justin_smith: ,((fn [& {:keys [a b c]}] {:pre [a b c]} (+ a b c)) :a 0 :b 1 :c 2)

13:45 clojurebot: 3

13:45 justin_smith: ,((fn [& {:keys [a b c]}] {:pre [a b c]} (+ a b c)) :a 0 :b 1)

13:45 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: c>

13:46 ssideris: EvanR-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:46 justin_smith: it works, but the message could use work

13:46 ssideris: yeah, that too

13:46 gfredericks: there's no good way to add functionality to [de]fn & friends without a proliferation of one-off wrapper macros

13:47 like other kinds of preconditions

13:47 I'm not sure how it could be any better though

13:47 ssideris: EvanR-work: I generally use prismatic's schema, but it may be overkill for you

13:47 gfredericks: other than some weird kind of macro middleware

13:47 EvanR-work: yes that would work

13:47 justin_smith: EvanR-work: also, required keys are straightforward to express using prismatic/schema

13:47 EvanR-work: but its a lot more typing than this just being the default

13:47 but i think keyword args are just syntax for passing in a map of options

13:48 justin_smith: EvanR-work: indeed they are

13:48 gfredericks: what do those prismatic fnks do if a key is missing

13:48 [blake|: espinho: No exaggeration: Best language channel I've been in.

13:48 ssideris: EvanR-work: don't forget about the :or part of the destructuring in case you have/want defaults

13:48 EvanR-work: yes im using that for one arg

13:48 [blake|: espinho: Which is good because Clojure is...demanding.

13:48 gfredericks: ooh they throw an exception

13:48 EvanR-work: the others, which dont have defaults, nil isnt the default

13:49 gfredericks: okay I recommend plumbing & fnk for this :)

13:49 EvanR-work: in ruby theres a difference between arg provided nil and not provided

13:49 gfredericks: EvanR-work ^

13:49 EvanR-work: good to know

13:49 gfredericks: probably not a good fit for everything but pretty nice when it fits

13:49 especially when using graph

13:50 justin_smith: EvanR-work: (fn [& {:keys [a b c] :as provided}] (contains? provided a))

13:52 espinho: blake: demanding is the right word. Writing code from inside out, makes my little brain hurt.

13:52 EvanR-work: is the & necessary

13:53 justin_smith: EvanR-work: without the & you just get a map as an arg

13:53 ssideris: EvanR-work: & is for varargs

13:53 justin_smith: which is actually something I prefer

13:53 gfredericks: espinho: you'll like -> & friends then

13:53 justin_smith: but if you want ruby/python style keyword args you want &

13:53 ssideris: justin_smith: yeah, varargs make apply messy

13:53 EvanR-work: what syntax is that

13:53 justin_smith: ssideris: indeed, and I never used & {:keys ...} myself

13:54 EvanR-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:54 EvanR-work: justin_smith: ... what is the no-& call syntax?

13:54 ssideris: EvanR-work: with varargs: (my-fun 6 :flag true :x 4) without (my-fun 6 {:flag true :x 4})

13:55 EvanR-work: weird

13:55 using no &

13:55 ssideris: without & you just pass a map

13:55 that's all

14:03 justin_smith: EvanR-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:03 EvanR-work: yes i see that now

14:04 and i used a precondition that just repeated all my keys

14:04 better than listing a bunch of assertions

14:26 justin_smith: another option would be {:pre [(every? some? [a b c])]} if you might want a false value for some keys

14:29 Torkable: do you guys have a "start here" for noobs

14:30 pbalduino: hi there. happy new year everybody.

14:30 seangrove: Torkable: This might be interesting https://github.com/swannodette/lt-cljs-tutorial

14:30 It's ClojureScript, but same general concepts

14:31 justin_smith: Torkable: noob to clojure, or clojure+programming?

14:31 Torkable: noob to clojure

14:31 justin_smith: there is the free book online, clojure for the brave and true

14:32 mearnsh: Torkable: what's your background?

14:32 hi pbalduino

14:32 justin_smith: Torkable: and you should probably be using lein to manage libs and build code and run repls

14:32 Torkable: I've been looking at ports of transducers and channels to javascript lately and its got me interested in learning clojure itself

14:32 justin_smith: Torkable: oh, in that case a cljs-centric approach would actually be helpful then

14:32 Torkable: mearnsh, javascript programmer day job, tinker with haskell and other FP langs for fun

14:33 justin_smith, ay, I ran into the brave and true book earlier today and bookmarked it

14:34 mearnsh: i guess seangrove's suggestion is pretty good then

14:35 Torkable: is light table recommended?

14:35 its hard for me to break away from vim

14:35 lodin: Torkable: 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:35 mearnsh: joy of clojure is good if you want a book that goes deep fast

14:35 Torkable: also I believe I saw that light table has been abandoned

14:36 the_frey: I found lighttable buggy

14:36 emacs has worked well

14:36 sdegutis: LT was an enthusiastically embraced experiment. I think he moved on to a new experiment.

14:36 Torkable: I asked because the tut linked is specifically for LT

14:36 stuartsierra: Use the editor you're most comfortable with.

14:36 Torkable: k

14:36 sdegutis: ibdknox: is LT still active?

14:37 hellofunk: Torkable: very basic intro exercises you can do right online to learn clojurescript basics: http://clojurescriptkoans.com/

14:37 sdegutis: http://www.chris-granger.com/2014/10/01/beyond-light-table/

14:38 Torkable: cool, thanks for the tips guys :)

14:38 sdegutis: "Eve" is the next step in the evolution of Light Table.

14:38 mearnsh: Torkable: check out fireplace.vim

14:39 sdegutis: They're both projects to make programming simple and accessible for the computer illiterate.

14:39 mearnsh: Torkable: also https://github.com/magomimmo/modern-cljs

14:39 sdegutis: I personally want something like Eve but for fire-fighting.

14:39 I'd love to do a little fire-fighting without having to go through training and have a commitment and sch.

14:39 *such

14:39 lodin: What happened to Aurora?

14:40 stuartsierra: I think Aurora was renamed to Eve.

14:41 Torkable: mearnsh, fireplace looks great :)

14:41 abaranosky2: has 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:41 llasram: sdegutis: The problem is that the programming equivalent of what you are describing already does exist, is widely deployed, and is named "Excel"

14:41 pbalduino: when I use :gen-class without parameters inside ns nothing happens. Is it the expected behaviour? (ns foo.bar (:gen-class))

14:42 llasram: sdegutis: Providing better tools would be a huge improvement

14:42 abaranosky2: pbalduino: that looks fine to me

14:42 timvisher: abaranosky2: have you inspected what's happening?

14:44 abaranosky2: timvisher: in the console nothing is printed!

14:44 pbalduino: abaranosky2: I was expecting some AOT and a .class file generated, but really nothing happened.

14:44 timvisher: i'd put some (.log js/console "got here") in the source code then

14:44 i'm assuming the network requests are succeeding?

14:44 abaranosky2: timvisher: let me see for sure

14:45 sdegutis: llasram: meh

14:45 lodin: llasram: There seems to be some kind of dataflow trend.

14:46 swedishfish: I 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:46 sdegutis: llasram: I'm hesitant to believe world-changing ideas are both executable and world-changing.

14:46 pbalduino: cemerick: \o/

14:47 abaranosky2: timvisher: I load up "http://localhost:8001/&quot; and the whole dang developer console becomes unresponsive!

14:47 lol

14:47 timvisher: abaranosky2: are you guys using core.async?

14:48 justin_smith: swedishfish: fixtures should be defined per-namespace, I don't think selector-specific fixtures will work without some mucky stuff

14:48 timvisher: you might have to do a quick binary search of the offending bit

14:48 cemerick: pbalduino: \m/

14:48 abaranosky2: timvisher: yes, but the code where we use it is commented out :)

14:49 timvisher: abaranosky2: something is probably still firing a go-loop waiting for input from a channel or something

14:49 abaranosky2: I have one main fn that fires off everything. In that fn I commented everything out.

14:49 timvisher: ^^^

14:49 timvisher: abaranosky2: so all your required nses are entirely pure?

14:51 i would imagine that some of them are side-effecting somewhere and thus causing the hangup

14:51 mikerod: I wish Clojure's use-fixtures did not overwrite existing fixtures in the same namespace

14:51 (use-fixtures :once blah) -- then -- (use-fixtures :once foo) -- then only foo fixture works

14:52 it just uses an assoc with the :clojure.test/once key on the namespace metadata

14:52 an update with conj or something would be a bit nicer to me

14:52 I had a case where we have a macro that adds a :once fixture

14:52 that macro needs to be written *after* any usages of the clojure.test/use-fixtures, so that it doesn't clobber or :once fixture

14:56 abaranosky2: timvisher: 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:56 meaning I hide things behind defns whenever possible

14:58 timvisher: hmmm, commenting out requires is now NOT crashing :)

14:58 timvisher: I'll try commenting that back in one by one

14:59 timvisher: abaranosky2: i'm with you. sometimes something slips in.

15:02 abaranosky2: timvisher: this require is causing the crash: (:require-macros [cljs.core.async.macros :as am])

15:02 which ironically was not being used in man.cljs :)

15:03 timvisher: lol. that's interesting.

15:09 swedishfish: justin_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:18 justin_smith: swedishfish: remember that is called inside functions works

15:18 so you could define tests that call the same functions, but with different fixtures

15:19 swedishfish: that is, if you call a function inside deftest that has clojure.test/is calls inside it, that does the right thing

15:20 andyf: puredanger: 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:23 For anyone else who wants to read it, http://insideclojure.org/2015/01/07/vec-perf/

15:23 jackhill: andyf: thanks! I was just getting ready to ask

15:32 justin_smith: puredanger: excellent article, small typo "After a lot of experimentation, I would up with the following cases"

15:32 think you wanted "wound" there?

15:33 puredanger: thx, fixed

15:33 justin_smith: and big wow on those performance improvements! good work

15:33 tcrayford____: (inc puredanger)

15:33 puredanger: and Rich just ok'ed that one a few minutes ago for the next alpha (which should be coming soon)....

15:33 tcrayford____: puredanger: excellent work :)

15:34 now too s/into []/vec/g all over github

15:36 puredanger: well, check those perf #s closely - use case matters

15:36 I think any place where you are normalizing input and may *sometimes* receive a vector, then vec is definitely the right choice

15:36 if you know you are calling it with either small inputs or non-frequently, then shouldn't really matter

15:37 if frequent or big inputs of known particular type (like seq, etc) then … depends

15:38 into has the big benefit of taking a transducer which you should leverage if it makes sense

15:39 tcrayford____: (if you can use 1.7 ;) )

15:39 puredanger: well if you're relying on these perf changes then 1.6 won't help you either :)

15:41 sdegutis: What are some solutions for providing "mixin-like" functionality with Clojure deftypes?

15:42 hyPiRion: puredanger: Speaking of performance patches, is there some way you recommend people to document performance patches/submissions?

15:43 llasram: sdegutis: protocol partial implementation maps?

15:43 sdegutis: What?

15:43 clojurebot: What is meta

15:43 amalloy: clojurebot: meta is meta

15:43 clojurebot: A nod, you know, is as good as a wink to a blind horse.

15:44 llasram: sdegutis: You can use `extend` to provide a protocol implementation as a map of keyword protocol-function-names to functions

15:44 These maps are just maps, so you can build them elsewhere, merge them, etc

15:44 sdegutis: Ah.

15:44 puredanger: hyPiRion: 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:45 sdegutis: llasram: This is the solution I have now, for better or worse: https://github.com/sdegutis/oops/blob/master/src/oops/core.clj#L4

15:45 puredanger: hyPiRion: not sure if that answered your question

15:48 hyPiRion: puredanger: Yeah, thanks

15:48 mikerod: ,(inc puredanger)

15:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: puredanger in this context, compiling:(NO_SOURCE_PATH:0:0)>

15:48 mikerod: (inc puredanger)

15:49 for these good blog post

15:49 posts*

15:51 arrdem: so 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:52 tcrayford____: https://aphyr.com/media/context.html

15:52 oops, wrong link

15:52 I like a fear's: https://aphyr.com/tags/Clojure-from-the-ground-up

15:54 arrdem: tcrayford____: thanks I forgot about aphyr's intro posts

15:54 tcrayford____: iirc it's gonna be a book eventually

15:55 arrdem: gigasquid also has a book on the way I think...

15:55 maybe same book

15:55 gigasquid: yes "Living Clojure" should be out for early release in the next couple of weeks

15:56 arrdem: yaaaas

15:56 amalloy: you think gigasquid and aphyr are the same person, arrdem? has anyone ever seen them together?

15:56 gigasquid: ha ha

15:56 arrdem: haha

15:58 gigasquid: Clojure of the Brave and True is really good too

15:58 http://www.braveclojure.com/

16:01 tcrayford____: clojurebot: aphyr is gigasquid

16:01 clojurebot: Ok.

16:01 gfredericks: ~gigasquid

16:01 clojurebot: Cool story bro.

16:02 tcrayford____: clojurebot: gigasquid is aphyr

16:02 clojurebot: In Ordnung

16:03 hipsterslapfight: gigasquid: any place to see "living clojure" now or do we have to wait for early release?

16:03 (already made my way through aphyrs posts and most of CftBaT and loved them both)

16:03 gigasquid: not yet ....

16:03 shouldn't be too long

16:04 hipsterslapfight: okay i shall follow you on twitter and expect you to announce it there :v

16:04 gigasquid: :)

16:04 arrdem: :+1:

16:25 stuartsierra: modularity.org is down http://www.downforeveryoneorjustme.com/modularity.org

16:25 bridgethillyer: gigasquid: YAY

16:25 gfredericks: does this have something to do with some javascript community twitterfight that I hear echos of on twitter?

16:33 hipsterslapfight: haha, module shaming

16:34 TimMc: ~twitterfight

16:34 clojurebot: Pardon?

16:35 amalloy: what is modularity.org when it's not down?

16:36 gfredericks: twitter is a place where I see lots of echos of what seem like big dramatic fights/crises

16:36 tcrayford____: modularitee

16:36 gfredericks: but almost never the events themselves

16:36 it takes digging

16:37 SagiCZ1: has anyone experienced unlearning both java and OOP by using clojure for too long? i am freaking out, i cant design anything anymore :X

16:38 justin_smith: SagiCZ1: sounds similar to the "code switching" problem that new learners of natural languages run into

16:39 SagiCZ1: yeah.. i need to switch my brain

16:40 justin_smith: SagiCZ1: there i a stage before full fluency where the categories "leak" and you have a hard time speaking in either language properly

16:40 or that is my recollection of it at least

16:40 SagiCZ1: that would be my case since i dont know either java nor clojure at an expert level

16:43 tomjack: if I try to write some java and to be happy about the result, I inevitably wind up at clojure.java.api

16:43 SagiCZ1: haha.. tomjack but i need to write real java.. sadly

16:44 tomjack: me 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 (I did this, like, six months ago and I've totally forgotten. Dude.)

17:37 lein install!

17:37 Can't believe I forgot that.

17:57 hellofunk: how can i check if a def'd symbol was given a value? like (def a), learning that it wasn't (def a whateve)

18:03 thheller: (instance? clojure.lang.Var$Unbound a)

18:03 hellofunk: thanks

18:17 ambrosebs: IIRC .hasRoot on a Var is more reliable

18:38 cperkins: ,(clojure.string/split "/foo" #"/")

18:38 clojurebot: ["" "foo"]

18:38 cperkins: ,(clojure.string/split "/" #"/")

18:38 clojurebot: []

18:39 cperkins: Why is (clojure.string/split "/" #"/") not [""]?

18:40 amalloy: cperkins: read the docs for java.lang.String/split, which clojure just delegates to

18:40 basically, the default behavior is to strip trailing empty matches

18:41 cperkins: amalloy: thanks, that makes sense, I guess

18:44 andyf: cperkins: Give split a last arg of -1 and the results might start to look more consistent across your examples

18:46 cperkins: andyf: cool, that helps, thanks

19:07 [blake|: Is "decorate" used any more?

19:07 I guess that should go to weavejester...

19:08 cperkins: blake: I think it's sleepytime where weavejester lives

19:09 [blake|: cperkins: Code never sleeps...

19:09 weavejester: Almost :)

19:09 [blake|: Heh

19:10 weavejester: I wrote a decorate library way back when, when I didn't really understand Clojure.

19:11 amalloy: weavejester: i think i've tried to dissuade [blake| from using decorate before

19:11 weavejester: I wouldn't recommend using it.

19:11 [blake|: amalloy: Noooo. You've dissuaded me from using flatten.

19:12 But I look at decorate and think "Is that really necessary?" There's a Hooke thing like that, too.

19:13 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:14 weavejester: [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 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:17 weavejester: I'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:17 weavejester: When 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 weavejester: But most of the time, I'm not doing anything with the response. Not directly.

19:19 weavejester: Yes, 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:20 weavejester: Which session store are you using?

19:20 If it's an in-memory store, reloading a namespace will clear it.

19:21 Another 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 weavejester: For a while I had wrap-session and handler/site.

19:22 weavejester: Now it's just handler/site.

19:22 hellofunk: is it possible to reload a namespace from the REPL for that namespace? essentially recompiling it, without interacting directly with the source file

19:22 weavejester: hellofunk: You can use (:require 'blah.core :reload)

19:22 amalloy: hellofunk: 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:22 hellofunk: ah, cool, i shall try

19:23 [blake|: oh, you weren't talking about my problems...what a blow =P

19:24 weavejester: OK, so it really is "just wrap-session and the data persists" (barring a few situations)?

19:24 (Sometimes things are just too simple.)

19:25 weavejester: [blake|: Yep.

19:26 [blake|: weavejester: OK, then.

19:26 weavejester: If 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:26 But the underlying mechanism is pretty simple.

19:26 Whatever'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 Makes sense. Could an ajax call be a problem?

19:27 weavejester: The default is an in-memory session. If you reload your app namespace, that'll likely cause it to be wiped.

19:27 An ajax call is no different from a normal HTTP call.

19:27 [blake|: (= in-memory memory-store)?

19:28 amalloy: weavejester: 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:28 weavejester: amalloy: 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 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:31 weavejester: [blake|: That sounds like the session path might be mis-set

19:31 [blake|: weavejester: Session path?

19:31 weavejester: The path the session cookie applies to

19:32 Though by default it's "/", so that shouldn't be the issue.

19:32 Without 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 I'll see if I can work it up from the docs using the count.

19:34 It's a responsibility issue, though. If I had to pass the session around everywhere explicitly, I could understand.

19:37 shhheee...what if I'm just destructuring session data wrong...

19:38 Nah, that's write. The session is actually coming IN as {} when it fails.

19:39 er, that's right...

20:26 justin_smith: $ping lazybot

20:26 :(

20:29 amalloy: &'hello

20:29 lazybot: ⇒ hello

20:31 justin_smith: cool

22:25 gfredericks: I'm about to write a function called semisort does it exist already?

22:51 justin_smith: what would semisort do?

23:30 rhg135: for any X in 'is ther a function which does X' it's almost always yes

Logging service provided by n01se.net