Fork me on GitHub

Is there going to be a livestream of clojure west?


(like on twitch or something)


Very unlikely. But videos of the sessions will get posted to ClojureTV on YouTube pretty quickly.


@mobileink: I've added boot-fails to the community tasks. (I like it a lot).


are there any plans to support protocols with varargs fns? (i.e. declined in 2013:

Alex Miller (Clojure team)04:04:11

@kingmob: for this case, you'll need to require those files prior to when you expect them to be used (to force them to be loaded)

Alex Miller (Clojure team)04:04:32

@escherize: no, but videos will be available usually within 24 h on the ClojureTV channel

Alex Miller (Clojure team)04:04:07

@tolitius: I don't know of any reason it wouldn't be considered again


@alexmiller: thx. that would be a great thing to have to keep protocol fns as expressive as regular fns


Would be considered, or wouldn't be considered?


I read it as "no reason why not", maybe it's just the way I wanted to read it simple_smile


@alexmiller: btw, in your phillyete talk you did not get to the Java streams example, was it on par with transducers, or was it still creating intermediate sequences? (we did talk about cases when to not use transducers, but I forgot to ask you about the Java example)

Alex Miller (Clojure team)04:04:42

yeah, I ran out of time for that and realized afterwards

Alex Miller (Clojure team)04:04:58

I'll post a gist for you, hang on


intentionally ugly? simple_smile

Alex Miller (Clojure team)04:04:15

two specific problems I had were 1) sorting by a comparator on a function of the values and 2) zipmap

Alex Miller (Clojure team)04:04:33

there are multiple solutions to both but I had hard a time finding something actually nice for either

Alex Miller (Clojure team)04:04:05

there are some custom spliterator versions of #2 and some 3rd party libs that provide better versions

Alex Miller (Clojure team)04:04:33

#1 is well supported if you want to sort by either keys or values, but a function of the values was just ugly


thx. sure, definitely can be cleaned up, but still a cool comparison to 4 clj lines (the streams/transducer part)


I find Java streams quite nice, hope they'll get only better/cleaner/more composable with inferred generics. thanks for the example


i need to manipulate a Clojure list that includes tagged literals, like (something #js [1 2 3]), but I can't quote that so what can be done ?


@octo221: what can’t you quote?


quoting lists containing tagged literals seems to work for me:

boot.user=> (java.util.UUID/randomUUID)
#uuid "3ceeb855-2014-4006-89ee-9ded67180130"
boot.user=> (list *1)
(#uuid "3ceeb855-2014-4006-89ee-9ded67180130")
boot.user=> '(#uuid "3ceeb855-2014-4006-89ee-9ded67180130")
(#uuid "3ceeb855-2014-4006-89ee-9ded67180130")
boot.user=> (count '(#uuid "3ceeb855-2014-4006-89ee-9ded67180130"))


@loganmhb: see my message - that's what I can't quote!


'(something #js [1 2 3]) RuntimeException No reader function for tag js clojure.lang.LispReader$CtorReader.readTagged ( RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (


I'm guessing it's because I'm evaluating it in Clojure REPL on the JVM


Are trying to quote a clojurescript list in clojure?


well, read my question, yes!


(something #js [1 2 3])


I thought a reader macro was like ^{:my-meta-thing 7}

Alex Miller (Clojure team)12:04:20

#js is a tagged literal, but not one that has a reader defined in Clojure


Is it possible to avoid the #js tag and use something like (clj->js [1 2 3])?

Alex Miller (Clojure team)12:04:33

you can define a data reader for it or you can use reader conditionals to read but ignore it (not really sure what your actual use case is)


@alexmiller: out of interest, is there any way I can turn such an expression into a Clojure list so I can manipulate it ?


I'm trying to write a macro to convert Om code into Hiccup


oh I guess it will work if I evaluate it in the browser right ?


ah but no, because those #js bits won't be read into Clojure data structures


they'll be Javascript objects

Alex Miller (Clojure team)13:04:26

it is possible to supply a default data reader that produces tagged literal objects

Alex Miller (Clojure team)13:04:54

to do so, you can bind default-data-reader-fn to a function

Alex Miller (Clojure team)13:04:07

sorry, that has around it

Alex Miller (Clojure team)13:04:16


Alex Miller (Clojure team)13:04:22

that's a fn of tag and value that returns an instance

Alex Miller (Clojure team)13:04:38

I think if you just bind that to the existing clojure.core/tagged-literal fn that will preserve it

Alex Miller (Clojure team)13:04:36

(binding [*default-data-reader-fn* clojure.core/tagged-literal]
  (read-string "'(something #js[1 2 3])"))

Alex Miller (Clojure team)13:04:07

I guess you don't need the quote in this case because you are invoking the reader directly

Alex Miller (Clojure team)13:04:24

(binding [*default-data-reader-fn* clojure.core/tagged-literal]
  (read-string "(something #js[1 2 3])"))

Alex Miller (Clojure team)13:04:57

that should return you a list containing a symbol and a "TaggedLiteral" object (that implements the map interface and has keyword attributes :tag and :form)


(clojure.lang.Symbol clojure.lang.TaggedLiteral)

Alex Miller (Clojure team)13:04:46

(let [[x y] (binding [*default-data-reader-fn* clojure.core/tagged-literal]
              (read-string "(something #js[1 2 3])"))]
  [(:tag y) (:form y)])


((comp :form last last) (binding [default-data-reader-fn clojure.core/tagged-literal] (read-string "'(something #js [1 2 3])"))) => [1 2 3]

Alex Miller (Clojure team)13:04:27

now if you're doing this in clojurescript, I don't recall how compatible this is, it might not be - not sure cljs has *default-data-reader-fn* or tagged-literal


i think I'll just slurp the files, read-string them as you described and convert them to hiccup from there


it's converting Om (div #js {}) style code to hiccup [:div {}] style code


what protocols/methods do i need to implement to override cons on a custom type (deftype)? i tried clojure.lang.IPersistentCollection and cons but it blows up in seqFrom

Alex Miller (Clojure team)13:04:07

I think you'd need just ISeq, not IPersistentCollection


I'm trying to implement a B tree, need to override cons. Been looking at datascript for inspiration, I don't see it implementing ISeq:

Alex Miller (Clojure team)13:04:49

ISeq extends IPersistentCollection (weirdly, both define cons())

Alex Miller (Clojure team)13:04:57

what's the error you're getting?

Alex Miller (Clojure team)13:04:35

and what types do you currently implement?


I might have a big gap in my understanding, i've tried narrowing it down to the simplest thing


I'm expecting that to be 1, but I get 'Don't know how to create ISeq from: java.lang.Long


presumably because the default cons expects a seq in second place

Alex Miller (Clojure team)14:04:26

actually you've got the arg order switched when you invoke cons don't you?

Alex Miller (Clojure team)14:04:08

the cons function order is opposite the Java method order


i thought so but i wasn't sure how it should match the signature i implemented on the type


switching the order, I get Unhandled java.lang.AbstractMethodError

Alex Miller (Clojure team)14:04:10

it should be (cons 1 (MyType.))

Alex Miller (Clojure team)14:04:28

but MyType is then expected to be an ISeq or something seqable

Alex Miller (Clojure team)14:04:42

IPC extends Seqable, but you haven't implemented seq()

Alex Miller (Clojure team)14:04:52

which yields the AbstractMethodError


Anyone know the best library to read emails and email attachments?


it leads to more errors but i think i can follow the trail


looking for some more real world manifold usage — someone any pointers? simple_smile


actually, all i need it seq() as you said (and make sure it returns an ISeq


is there some reference or documentation good for understanding how all the protocols fit together or you just have to look through the source?


IPC cons maps to conj, not cons


cons will just invoke new c.l.Cons(x, my-coll)


ah @bronsa, that explains why im still not seeing anything other than default behaviour of cons


as to why both IPC and ISeq implement cons -- they have covariant return types


Hey I am trying to read a buffered input stream from an email attachment that is an excel file. I’ve tried slurp and a bunch of java methods. Anyone know how to read these?


what is the exact use of task i.e. (deftask foo )


@payal: deftask is a boot thing, you might want to ask in #C053K90BR


I’m new to clojure, and struggling with my editor experience (vim, with paredit).


for example, if I have the following: (defn notched-slider [] *) * is where my cursor is. And I want to paste two lines right there.


If I hit P I get this: [question-label "How stressed are you feeling?"] [next-button] (defn notched-slider [] )


If it hit p I get this: (defn notched-slider [] ) [question-label "How stressed are you feeling?"] [next-button]


What am I missing here?


Oh… it’s because my code would be unbalanced?

Chris O’Donnell17:04:44

@seanhess: What did you do to copy the two lines?


Vjy to visually select two lines then yank

Chris O’Donnell17:04:36

If you select full lines, vim will paste them below (or above) your cursor.


Oh dear, you’re right… Thanks!


if you don’t mind if I ask you another question: I’m writing a function and want it to look nice when I’m done. So I start with (defn notched-slider [] ) and I want to type a function body. My cursor is before ). If I hit return, and type a body, it comes out looking like this: (defn notched-slider [] [text {} "hello"] )


It’s my understanding that it is considered better to have it look like this: (defn notched-slider [] [text {} "hello"])


normally to fix that, I would go the last line, type I to get my cursor before the ), and hit backspace until it looks good. But when I hit I over the ), paredit removes the line of whitespace after my function (?) and moves my cursor to the beginning of the function

Chris O’Donnell17:04:05

You can use J to join lines


If I hit I while over one of the leading spaces on the last line, it deletes my function?


That works way better, thanks!


Do you have any idea what I is donig?

Chris O’Donnell17:04:11

I'm not 100% sure and actually need to step away right now.

Chris O’Donnell17:04:18

Best of luck, though.


Ok, thank you!


Yes. I chose these without any real knowledge, but here’s what I have: " Clojure Plug 'guns/vim-clojure-static' Plug 'tpope/vim-fireplace' Plug 'kien/rainbow_parentheses.vim' Plug 'guns/vim-clojure-highlight' Plug 'tpope/vim-unimpaired' Plug 'venantius/vim-cljfmt' Plug 'paredit.vim'


Also the w movement has a huge amount of lag


Just the first one. If I hit it again, it moves one word, then about 1s after I stop hitting it, it does the first w movement very late


Am I using the wrong plugin?


I don't know, it's been a while since I used vim, but I though that plugin would handle indentation and formatting for you


@seanhess: try removing stuff until you find what makes w to lag. I have the following and w works fine, and I does what you usually expect:


any http clients that are capable of consuming server-sent events?


you can also use = on a visual selection to indent according to whatever rules you have loaded


(which should be clojure-specific rules if you have vim-clojure-static installed)


I've written a bit of ztellman/manifold code today interfacing with SQS and while it works I'm not sure if "I'm doing it right": particularly I'm wondering about the use of manifold.time/every to fetch messages from SQS and the deferred usage when handling these messages. Does this seem right to you?


hard to tell, because there aren't a lot of docs for amazonicas sqs api, put it sort of looks like it expects you to cal lthe receive-message function, and then consume from the lazy seq, not call receive-message every time you want a message


@hiredman: what makes you think it returns a lazy seq?


just because the few examples of use I see have people calling first on it, which uh, I guess it could be returning a single message wrapped in a collection, but why would thye do that


but if you have used the api and it isn't, then it isn't


@hiredman: the return value of receive-message looks like this {:messages [...]} so I guess it's not lazy. You can specify a number of messages you'd like to receive so it'll always be a sequence, maybe that's why people call first on it.


As I'm guessing the book "Clojure Applied" was written for an earlier Clojure version. I'm wondering if anyone can tell me why this snippet return an error(or a possible workaround): java.lang.IllegalArgumentException: Can't define method not in interfaces: compareTo

(declare validate-same-currency)
(defrecord Currency [divisor sym desc])
(defrecord Money [amount ^Currency currency]
  (compareTo [m1] [m2]
             (validate-same-currency m1 m2)
             (compare (:amount m1) (:amount m2))))


the argument list is wrong


that is a method that takes 1 paramter (including this) creates a vector (which would be kicked out by the compiler if the defrecord macro wasn't failing) because the contents of the vector are a symbol that isn't bound (m2) then does some other stuff


ahh shit, I only have a lamp here, oops, [m1 m2] should that have been.


I will turn on the light before asking a obvious question simple_smile


@nberger: thanks for your help!


It was definitely paredit.vim that was causing trouble. Disabling it got rid of the strange behavior. Disabling every other plugin but that one I still had it. The only thing that fixed was switching to this mirror:


So I'm reading "Clojure Applied" and there is this code snippet:


... that wouldn't actually work, right?


Because of the missing arguments to recur?


Thank you, just wanted to make sure I wasn't going crazy