Fork me on GitHub
#clojure
<
2016-07-28
>
lvh02:07:16

Is there a way to get are to show the values that made the test fail?

lvh02:07:53

oops, misread the error, my bad 🙂

theeternalpulse04:07:37

has anyone done a boot setup where their clj files shared the directory with the test files?

seancorfield04:07:16

@theeternalpulse: Curious why you would do that? All the project templates (and all the docs / examples) have tests in a separate folder tree -- and that's what the build tools tend to expect.

theeternalpulse04:07:24

right @seancorfield I was curious because I dislike that from a folder structure and navigation aspect

theeternalpulse05:07:15

granted tooling helps, but I was wondering if boot allowed for excluding/including patterns so I can do it manually

theeternalpulse05:07:16

to have file.clj and file.test.clj isolated from one another during build, and I can have a task that builds the test paths seperately

seancorfield05:07:17

@theeternalpulse: I've no idea how you'd support that layout (in Boot or Leiningen) to be honest. There are very practical reasons for separating source and test code, for example building deployable artifacts (where you only want source -- or compiled versions of source -- in the JAR).

daveliepmann09:07:36

Quick clojure.data.xml question: the [readme](https://github.com/clojure/data.xml) mentions a qname function, but no such function seems to exist in clojure.core or clojure.data.xml. Where should I be looking for this fn? Is it deprecated?

hans09:07:38

@daveliepmann: maybe only in the beta release?

mpenet09:07:09

@weavejester: is there a way to run a command (ex load specs) prior to codox running (via the lein plugin)? I'd like to have the specs included in docstrings before codox generates the files

daveliepmann09:07:32

@hans: Ah yes, the README commit history indicates the namespace feature is for the new version.

hans09:07:12

@daveliepmann: makes sense to use that, namespaces can't really be ignored anyway.

andmed10:07:36

hi. I am new to functional programming. I was implementing comp function on 4clojure and wrote the following code

(defn COMP [f & rest]
  (if (nil? rest)
    f
    (f (COMP rest))))
Looks nice and neat. Of course, it does not work (meh). Why? to me, it looks quite logical: composition is applying some fn to the result of the previous fn call and that is what I am doing here. btw, with apply my version does not work, either. original comp looks much more complicated, can not understand why do I need that complexity

darwin11:07:50

a quick note: (nil? rest) makes no sense, rest will be always a sequence of remaining args, possibly empty one

andmed11:07:06

@darwin: hmm I get this

(defn temp [f & rest] (nil? rest))
=> #'user/temp
(temp :a)
=> true
but OK, that is not the main point

darwin11:07:06

ok, you are right, I’m sorry for confusion

andmed11:07:38

no problem. but this fn composition is really perplexing for me...

darwin11:07:14

I would do (COMP rest) -> (apply COMP rest)

andmed11:07:41

as I said, no help, just does not work

andmed11:07:21

it seems to do something completely different from what I want, but I can not understand what, exactly...

andmed11:07:03

the test is smth like

(is (= ((COMP list +) 2 2) (list (+ 2 2))))

andmed11:07:35

many thanks @darwin I can see the point now)

darwin11:07:06

have to go now

andmed11:07:09

just wondering: what was wrong with my code? my line of thinking was that at some point I will arrive to calling f and then repeatedly call fns in stack

jumar11:07:21

compare this

jumar11:07:23

user=> ((COMP str +) 1 2 3) java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn user=> ((comp str +) 1 2 3) "6"

jumar11:07:46

I guess, in your case the final result returned from COMP would be sth. like (str (+))

jumar11:07:23

and if you try to apply it:

jumar11:07:26

user=> ((str (+)) 1 2 3) java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

andmed11:07:41

aha, that is why comp is returning a fn, my idea (sequential fns calling) could have been possible with a macro only... or not.. anyway, the definition I googled: compose(f, g) (x) = f(g(x)) was what confused me. fn composition is not calling fns sequentially, it is more like compose(f,g) (x) = h(x)

andmed12:07:53

i though that, by definition, it is macros's job to return fns, comp does that, too

Alex Miller (Clojure team)12:07:51

Macros return code, which is evaluated into a function

dominicm13:07:55

Functions can return functions, same way they can a number or a string.

fabrao18:07:48

hello all, is there any way to solve the nested map? Like (map #(conj %) (map #(conj %) ["1" "2"])) ?

hans18:07:01

fabrao: not sure what you mean by "solve", but maybe clojure.walk is for you? https://clojure.github.io/clojure/clojure.walk-api.html

fabrao18:07:03

well, using % twice?

fabrao18:07:28

I think walk may be a solution

exupero18:07:07

You’re only using % once per anonymous function.

exupero18:07:28

You’re using a single-argument version of conj that I don’t believe exists.

exupero18:07:36

One must resort to fn instead of nesting #() forms.

fabrao18:07:16

OK, I´ll try it, best regards

m1dnight18:07:38

Can’t you use %1 and %2?

nidu19:07:14

Hello, have anyone tried to use com.taoensso/tower with clojure 1.9? I get some errors like java.lang.AssertionError: Condition failed in taoensso.encore:?` [pred-form, val]: [([:or nil? pos-int?] ttl-ms), 60000]` and compilation halts. Does anyone know if there's an easy workaround for this?

frank21:07:18

Is there a naming convention for schema checkers, given that schemas themselves are camel cased?

frank21:07:36

would it be appropriate to call a checker for the FooBar schema FooBar-checker?

richiardiandrea21:07:59

just a confirmation, in core.async, I see that I cannot really do: (async/timeout 0) right? I see the timeout channel never closes..

richiardiandrea22:07:43

mmm no I am wrong, probably the issue is somewhere else

dg23:07:08

When I test that, the timeout channel closes immediately

richiardiandrea23:07:21

yeah thanks for confirming @dg