#clojure log - Nov 07 2015

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

0:00 bluezone: Oh yeah

0:00 justin_smith: ,((fn arities ([x] (arities x 1)) ([x y] {:x x :y y})) 2)

0:00 clojurebot: {:x 2, :y 1}

0:01 justin_smith: bluezone: it just requires extra parens around the arg list

0:01 TEttinger: thomsey, woah, it looks like this was fixed -- just it was fixed less than a month ago

0:01 https://github.com/daveray/seesaw/commit/7e55abf18446837c1c2239f8afb0ef4b419dfa45

0:01 justin_smith: bluezone: well, arg list and body together - like my example above

0:02 bluezone: hmm

0:03 thomsey: Haha. The open source machine churns. Many thanks, TEttinger

0:03 TEttinger: thomsey hm wait

0:03 that might not be the whole story

0:03 justin_smith: bluezone: it's the difference between (fn [x] x) and (fn ([x] x) ([x y] y))

0:03 TEttinger: the delay of 0 should mean it fires immediately

0:03 (and then keeps firing rapidly)

0:05 I'm guessing it could be that print isn't either flushing for some reason (no idea what could cause it if it is that), or your console isn't getting data from swing

0:05 if you start with javaw.exe on windows, it doesn't have a console

0:05 so print does nothing

0:05 that's what double-clicking a jar will run

0:05 thomsey: TEttinger this is starting to feel like a CIDER problem...

0:06 i'm using cider btw

0:06 TEttinger: try doing something other than printing maybe?

0:06 write a line to a file?

0:06 justin_smith: bluezone: try moving ([x] (arities x 1)) so it is directly above ([x y] ...)

0:06 TEttinger: spit is good for writing throwaway data

0:06 (doc spit)

0:06 clojurebot: "([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."

0:07 justin_smith: bluezone: so now each line describes a different arity

0:07 thomsey: Yes! (fn [e] (pack! ...)) works as expected

0:07 TEttinger: ha! woo!

0:07 so it is a print not printing thing?

0:08 thomsey: Yep. Print-not-printing all day.

0:08 Many thanks!

0:08 TEttinger: this is the one time I'm glad I've encountered that kind of bug

0:08 glad to help!

0:08 skeuomorf: Is there a way to automagically update dependencies when using leiningen? For example, I had `tools.nrepl` as a dependency in my `project.clj` file to make CIDER better. Inside emacs, in the CIDER REPL, I saw a warning that CIDER requires a newer version of `tools.nrepl`, had CIDER never told me that, I wouldn't have known that there's a newer version of `tools.nrepl` and I wouldn't have manually changed the

0:08 version in my `project.clj` file. Is there a way to automagically handle such stuff?

0:09 bluezone: justin_smith: I think this may be beyond my level of understanding atm, I'll come back to it later

0:09 justin_smith: skeuomorf: lein ancient can help with this

0:09 bluezone: it's just defining two bodies for one function

0:09 * skeuomorf checks it out

0:09 skeuomorf: justin_smith: Thanks! :)

0:09 justin_smith: bluezone: each function body on its own line in your editor

0:09 bluezone: one calls the other

0:10 skeuomorf: justin_smith: Very cool, exactly what I wanted!

0:11 bluezone: justin_smith: but where is the argument list for arities

0:11 justin_smith: bluezone: so your version would start with (defn odd-num-seq ([sequ] (odd-num-seq sequ [])) ([sequ appender] ...))

0:11 bluezone: the argument vector *

0:11 justin_smith: bluezone: it has two argument lists

0:11 it has two argument vectors

0:13 * bluezone doesn't see it, it's ok He take break ^_^

0:14 justin_smith: bluezone: it's just a different syntax for fn / defn

0:15 TEttinger: ,(defn make-blue ([] (make-blue "zone")) ([name] (str "blue" name)))

0:15 clojurebot: #'sandbox/make-blue

0:15 TEttinger: ,(make-blue)

0:15 clojurebot: "bluezone"

0:15 TEttinger: ,(make-blue "TEttinger")

0:15 clojurebot: "blueTEttinger"

0:15 TEttinger: different number of args given to each, one calls the other

0:16 ([] (make-blue "zone")) is the zero-arg body

0:16 it calls ([name] (str "blue" name)) , which is the one-arg body

0:17 in Java, this would be... public String makeBlue() {return makeBlue("zone")} public String makeBlue(String name) {return "blue" + name;}

0:18 java splits the different arguments for the same name across multiple blocks or whatever

0:19 clojure keeps them closer together, but still in separate bodies

0:20 rufoa: quick question: is there a way to use [Ljava.lang.Object; in a call to `instance?` ? Or do I have use e.g. (class (to-array [])) as a workaround

0:21 justin_smith: ,(instance? "[Ljava.lang.Object;" (into-array [(Object.)]))

0:21 clojurebot: #error {\n :cause "java.lang.String cannot be cast to java.lang.Class"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.String cannot be cast to java.lang.Class"\n :at [clojure.core$instance_QMARK___4118 invokeStatic "core.clj" 144]}]\n :trace\n [[clojure.core$instance_QMARK___4118 invokeStatic "core.clj" 144]\n [clojure.core$instance_QMARK___4118 invoke "core.clj" -1]\n [...

0:21 justin_smith: :(

0:21 rufoa: yeah :(

0:23 (i'm wanting to test whether an argument i'm receiving through java interop is a single param or the result of calling a variadic method)

0:24 cos you can only match on number of args not type...

0:24 justin_smith: rufoa: multimethod?

0:24 rufoa: hrm

0:24 i'm not convinced it would work in this instance

0:26 hang on, can a method you export using gen-class actually be a multimethod? allowing me to do proper mm dispatch

0:26 rhg135: ,(Class/forName "[Ljava.lang.Object;")

0:26 clojurebot: [Ljava.lang.Object;

0:26 rufoa: aha!

0:26 thanks

0:26 rhg135: Np

0:31 TEttinger: ,(instance? (Class/forName "[Ljava.lang.Object;") (into-array [(Object.)]))

0:31 clojurebot: true

0:31 TEttinger: ,(instance? (Class/forName "[Ljava.lang.Object;") (long-array [0]))

0:31 clojurebot: false

0:31 rufoa: hrm

0:32 TEttinger: rufoa: the variadic methods are the same as calling with one array

0:32 I think you knew that

0:33 Frozenlock: Is there a way to set the value of a field in a java object? I'd like to set the value of 'broadcastAddress', which is declared like so in the java source: 'private Address broadcastAddress;'

0:33 TEttinger: ,(Class/isArray (long-array [0]))

0:33 clojurebot: #error {\n :cause "No matching method: isArray"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: No matching method: isArray, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "No matching method: isArray"\n :at [clojure.lang.Compiler$...

0:33 TEttinger: ,(.isArray (class (long-array [0])))

0:33 clojurebot: true

0:34 rufoa: yeah TEttinger the method is overloaded to take either String or Object..., so I have both in :methods in my gen-class, then I need to use instance? to check which it actually is inside my fn

0:34 TEttinger: ,(.isArray (class [0]))

0:34 clojurebot: false

0:34 rufoa: if i'm understanding correctly

0:34 TEttinger: rufoa: do you mean String... in the java, or Object... ?

0:34 rufoa: 1 String on its own, or Object...

0:34 TEttinger: gotcha

0:35 well the Object... can't actually be given a primitive array, so you're good

0:35 it will get any primitives you pass it and box them

0:35 rufoa: yeah

0:35 TEttinger: I'd just use .isArray on the class though

0:35 rufoa: i'll give it a go

0:37 TEttinger: ,(.isArray (class "hey guys!"))

0:37 clojurebot: false

0:37 TEttinger: the question I suppose is which it prefers

0:37 I'd guess the more specific type, so String, when it's passed a vararg of one String

0:37 rufoa: the string from what I can tell

0:37 yes

0:38 as it happens they essentially do the same thing anyway

0:38 TEttinger: but you could pass a String[] if you wanted to force the Object[] behavior I think

0:38 cool

0:38 is it a formatting type thing?

0:38 rufoa: guessed it in one

0:39 one of those classes that has overloads for "one, two, and many"

0:50 got it working great using .isArray TEttinger, thanks for the tip

1:20 Frozenlock: bluezone: what have you done? I was listening to that music!

1:52 bluezone: Frozenlock: bahahaha, sorry. You'll just have follow and tune in tomorrow <3

1:52 Need to sleep

4:16 douglarek: clojure 1.7 javadoc refers java 7

4:17 TEttinger: douglarek: hm?

4:17 douglarek: and http://java.sun.com/javase/7/docs/api/....; should it be http://docs.oracle.com/javase/7/docs/ ?

4:24 ok, I just saw the codes, (def ^:dynamic *core-java-api*)

4:24 (case (System/getProperty "java.specification.version"))

4:24 "1.6" "http://java.sun.com/javase/6/docs/api/&quot;

4:25 TEttinger: clojure is supposed to be compatible as far down as 1.6 I believe

4:25 (still the best version available for some uses on Mac OS X)

4:25 douglarek: https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/javadoc.clj#L21, and my java is 1.8, so it matches default(it's 1.7)

4:27 TEttinger: i use homebrew cask to install java 8

4:27 TEttinger: hm, IntelliJ needs to use 6 for some reason, it bundles it

4:27 (ask cfleming)

4:32 douglarek: TEttinger: just modify Info.plist <string>1.6*</string> to <string>1.8*</string>

4:41 TEttinger: woah. http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/

6:15 drorbemet: How can I fuzzy search all loaded namespaces and public symbols in the repl? (apropos "public-symbol") (find-ns 'symbol) don't seem to do this. Something like linux locate just for clojure?

6:17 e.g. I get completion on Math/... - but I don't find it using apropos find-ns or find-doc ...?

6:20 opqdonut: well Math is a java class and not a clojure namespace

6:21 so I guess you'd need javadoc integration for find-doc

6:38 drorbemet: opqdonut: ok, and that doesn't exist yet?

6:51 digiorgi: Hi, how is called the #'??

6:51 i want to search it in google (:

6:52 opqdonut: digiorgi: it seems it's called "var-quote", see http://clojure.org/reader

6:54 digiorgi: opqdonut: thanks!

7:33 noncom|3: if i have a java + clojure project, then, according to maven, what my source dirs structure should be?

7:33 src/main/java and src/main/clojure ?

7:44 arry: hi! anyone knows how to open two repl buffers in emacs connected to a single nrepl server (or at least to different nrepls but same project)?

7:44 cider-connect invoked for the second time just overwrites the current repl buffer

7:46 i need this because i want to run clojurescript repl in one buffer and clojure in another, and because of my setup (using Duct) i cannot invoke piggieback automatically as described in "ClojureScript Usage" in cider's readme

7:47 justin_smith: arry: maybe M-x cider-replicate-connection

7:54 arry: justin_smith: i don't have this function. Cider version 0.9.1 - should i get newer?

7:54 OscarZ: anyone using the windows version of emacs? you think i can get all the tooling work with that? i've been trying to fight but i think i have to succumb to emacs finally :)

7:54 justin_smith: arry: not sure, I am just going by this https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L853

7:57 arry: justin_smith: cool, I'll take a look

10:16 drorbemet: justin_smith: concerning our search yesterday, sending clojure code to the cider repl, this works: (cider-nrepl-request:pprint-eval "(+ 3 4)" (cider-repl-switch-ns-handler (cider-current-connection)) nil)

10:16 justin_smith: cool

10:23 douglarek: I am reading Clojure Programming Book, page 47 has an repl example, https://github.com/clojurebook/ClojureProgramming/blob/master/ch01-welcome-repl-interactions.clj#L759; I am a little confused

10:24 justin_smith: douglarek: any specific question?

10:24 douglarek: I enter 9, it show me 9,

10:25 but if i enter "(", and enter '\n', it shows nothing, and then continue entering ")", it shows "()"

10:26 justin_smith: douglarek: that's because ( is not a form, but () is

10:26 ,(= () ( ))

10:26 clojurebot: true

10:27 douglarek: justin_smith: ok, you means : `eval ` will ignore anything between ( and ) ?

10:27 justin_smith: douglarek: more specifically, read doesn't return until it gets a full form, and forms are not ended with newlines, they end with a full balanced expression

10:27 douglarek: () and ( ) are the same thing

10:27 whitespace doesn'

10:28 t change its meaning

10:28 douglarek: justin_smith: thanks a lot,

10:29 justin_smith: np

10:29 douglarek: justin_smith: you say: read doesn't return until it gets

10:29 a full form, maybe it is the key

10:30 justin_smith: that's certainly part of it

10:30 douglarek: justin_smith: maybe i should read the `read` source

10:31 justin_smith: if you are just learning, it might be over your head - in fact I think it calls code defined in the java part of the clojure compiler

10:31 we can experiment with it here using read-string though

10:32 ,(read-string "() the rest is ignored")

10:32 clojurebot: ()

10:32 douglarek: justin_smith: it's cool

10:32 justin_smith: ,(read-string "(error because there is no matching paren")

10:32 clojurebot: #error {\n :cause "EOF while reading"\n :via\n [{:type java.lang.RuntimeException\n :message "EOF while reading"\n :at [clojure.lang.Util runtimeException "Util.java" 221]}]\n :trace\n [[clojure.lang.Util runtimeException "Util.java" 221]\n [clojure.lang.LispReader readDelimitedList "LispReader.java" 1204]\n [clojure.lang.LispReader$ListReader invoke "LispReader.java" 1049]\n [clojure.lang....

10:33 justin_smith: read is designed for reading "units" of clojure code - the compilation unit clojure uses when compiling

10:34 douglarek: justin_smith: thanks, i use Python more often, and `read` is very different from Python's input

10:34 justin_smith: maybe "read-line" is more similar

10:34 douglarek: maybe i mixed them

12:14 kwladyka: I want personalize text like: Hello {{Mr/Ms/}} {{name}} please {{option1/option2/option3}} bla {{site}} bla bla. It doesn't make sense in english, but in other languages it does. On input it will be: gender: male/female/unknown (it determine first word or second or third) and name,site.

12:15 What library can i use?

12:15 or i have to write it on my own?

12:27 rhg135: I think clostache or comb will work

12:45 kwladyka: rhg135, thx i will check

12:45 rhg135: Np

13:46 kwladyka: Do you have some experience about read CSV file from microsoft excel by clojure.data.csv?

13:47 I have 2 problems... first it doesn't recognise new column. Second bad encoding.

13:50 ok i found how to separate columns

13:50 but still problem with encoding

13:52 hmm i guess it is in ANSI

13:55 anyway all tried with (io/reader file :encoding "Windows-1252") failed

15:58 amtc: Hi, I have a noob question about a 4clojure exercize, about problem 150, the palindromic numbers. I finally got everything to work fast, and then check #5 fails. Anyone in the mood to help me understand?

15:59 Here is the problem: https://www.4clojure.com/problem/150

16:00 I don't understand why it this true: (= (set (take 199 (__ 0))) (set (map #(first (__ %)) (range 0 10000))))

16:01 justin_smith: amtc: what that is saying is that there are 199 palindromes between 0 and 10000

16:01 err, not exactly that - 199 unique results when you ask for the next palindrome higher then the input between 0 and 9999 more precisely

16:02 ,(set [1 1 2 1 2 3 1 2 3 4 1 2 3 4 5])

16:02 amtc: Thanks justin. But why is 10001 not counted?

16:02 clojurebot: #{1 4 3 2 5}

16:02 justin_smith: amtc: it is, that's why I corrected myself

16:03 amtc: Well, I get 199 for (take 199 (pal 0))

16:03 kenrestivo: auugh, i added a dep that broke cljs somewhere.

16:03 Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/reader/impl/ExceptionInfo__init.class or clojure/tools/reader/impl/ExceptionInfo.clj on classpath.

16:04 amtc: and I get 200 for (map #(first (pal %)) (range 0 10000)

16:04 the only difference is 10001

16:04 kenrestivo: [org.clojure/tools.reader "0.10.0-alpha3"]

16:04 amtc: that comes from (pal 9999) i suppose

16:05 justin_smith: and that should be incorrect as an output, because 9999 is a palindrome right?

16:05 amtc: ooooooohhh

16:05 right

16:05 Thanks, that has been bugging me!

16:49 hibou: hi

16:49 is there anything like setdefault in python map ?

16:50 {1: []}.setdefault(3, []).append(1)

16:50 gfredericks: what does that do?

16:51 justin_smith: ,({} :b :not-found) ; hibou not the same, because the input is unaltered

16:51 clojurebot: :not-found

16:51 justin_smith: ,({:b 1} :b :not-found)

16:51 clojurebot: 1

16:51 hibou: sorry

16:52 I have a map of integer => list of integer

16:52 {1: (1 2) 3: (4 5)}

16:53 gfredericks: ,(def the-map '{1 (1 2) 3 (4 5)})

16:53 clojurebot: #'sandbox/the-map

16:54 hibou: I have a tuple (2, 3) I want to verify if the key "2" exists, if yes I will add 3 to the key 2 of the map, if not I will add 2 -> [3] to the map,

16:54 so for example for (3, 2) I will have {1: (1 2) 3: (4 5 2)}

16:54 kenrestivo: problem found: this breaks clojurscript [com.fzakaria/slf4j-timbre "0.2.1"]

16:55 hibou: in python this operation is very simple with map.setdefault(2, []).add(3)

16:55 * kenrestivo goes back to lein tree :deps ing

16:55 gfredericks: ,(update the-map 1 conj :new-thing)

16:55 clojurebot: {1 (:new-thing 1 2), 3 (4 5)}

16:55 gfredericks: ,(update the-map 2 conj :new-thing)

16:55 clojurebot: {1 (1 2), 3 (4 5), 2 (:new-thing)}

16:56 gfredericks: hibou: ^ if you're really using lists, you don't even have to do anything special

16:56 for vectors or sets you can use (fnil conj []) or (fnil conj #{})

16:56 oddcully: ,(merge-with (fnil into []) {:a [1]} {:a [42]} {:b [1]} {:b [666]})

16:56 clojurebot: {:a [1 42], :b [1 666]}

16:58 hibou: thanks gfredericks

16:58 gfredericks: np

17:06 hibou: If i have two similar operations like this, how can I write it differently ? updated-map-vals (update map-vals xi conj yi)

17:06 updated-map-vals2 (update map-vals yi conj xi)

17:06 kenrestivo: dealing with dependencies is like playing house of cards. never know which one will cause the whole thing to come crashing down

17:07 justin_smith: kenrestivo: in my experience loggers are where this really blows up

17:08 kenrestivo: yep!

17:08 timbre-slj4j makes my project explode in a million peices

17:09 why it breaks the reader, i have no idea

17:09 * justin_smith resets the time machine from "go back and kill hitler" to "go back and implement proper java logging in the stdlib"

17:09 kenrestivo: is there still a factoid bot?

17:09 ~logging

17:09 clojurebot: Titim gan éirí ort.

17:09 kenrestivo: ~java logging

17:09 clojurebot: java logging is clown shoes

17:09 justin_smith: haha

17:10 kenrestivo: it actually seems like it breaks the classloader

17:11 oddcully: haha

17:11 kenrestivo: if i'm understanding the error correctly, that is.

17:12 Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/reader/impl/ExceptionInfo__init.class or clojure/tools/reader/impl/ExceptionInfo.clj on classpath.

17:12 it's definitely on the classpath. but the cljs compiler can't find it, if timbre-slf4j is in the deps

17:12 justin_smith: kenrestivo: is it pulling in a bad tools.reader version?

17:12 kenrestivo: versions all look kosher

17:13 and if i override, same problem.

17:14 justin_smith: what if something else pulls in a version of tools.reader that it doesn't like? ExceptionInfo was implemented in clojure.core, so I would expect only an out of date tools.reader version would have its own

17:14 just a hunch

17:14 kenrestivo: here's the tree diff https://www.refheap.com/111467

17:14 justin_smith: maybe you need that older tools.reader

17:15 Bronsa`: old tools.reader versions had an ExceptionInfo impl for older version of clojure to fallback to

17:15 kenrestivo: hmm, thanks

17:15 justin_smith: Bronsa`: yeah, that's what I was thinking

17:15 kenrestivo: https://www.refheap.com/111468 is the diff, same version of reader

17:15 Bronsa`: it doesn't anymore since support for 1.3 has been dropped a while ago

17:16 kenrestivo: where does exceptioninfo live nowadays?

17:16 Bronsa`: it's in clojure proper since 1.4

17:17 kenrestivo: hmm... thanks. i'll look through the source for those deps and see where they're trying to pull it in from

17:17 could be an easy fix... i hope...

17:17 justin_smith: kenrestivo: you know about 'lein deps :tree' right?

17:17 kenrestivo: ooh yeah. that's that diff i posted https://www.refheap.com/111468

17:17 representing the difference between the two lein deps tree between broken and not broken

17:18 justin_smith: ahh, got it

17:18 kenrestivo: i really should get some kind of ci going. every time i add a dep.

17:19 thanks bronsa and justin_smith , i feel like i have a better handle on this. will work on it later today.

17:22 Bronsa`: fwfw 0.9.x are the last releases rolling ExceptionInfo and supporting 1.3

17:46 hibou: why does (conj nil 1) return a list but nothing else ?

17:46 conj is a generic function, how does it chose list by default ?

17:54 justin_smith: hibou: it happens here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L650

17:55 pretty readable for java :)

17:55 the actual method on IPersistentCollection instances, as you see there, is cons

18:01 hibou: thanks justin_smith !

18:02 justin_smith, so I can not tell that the type if a set instead of list ? (update the-map 1 conj :new-thing)

18:02 TEttinger: ,(conj #{} 1)

18:03 clojurebot: #{1}

18:03 TEttinger: update is a more interesting question though...

18:04 Ven: Hi! I'm trying to update the dependencies in my luminus project, but I'm hitting a lot of issues doing so. several dependencies started erroring out: "Could not locate markdown/transformers__init.class or markdown/transformers.clj on classpath: ,". I'm not sure what I'm misconfiguring, and why I'm getting an empty classpath

18:05 I found some answers on internet like http://stackoverflow.com/questions/19110294/could-not-locate-ring-util-request-init-class-or-ring-util-request-clj-on-class, but I don't understand what's going on / why do I need exclusions / how do I know what to exclude from lein deps :tree

18:05 hibou: TEttinger, you mean I need to write (update the-map 1 conj #{} :new-thing) ?

18:06 Ven: TEttinger? that name reminds me of something *g*

18:07 TEttinger: heh

18:09 ,(doc conj) ;; does it have any optional args...

18:09 clojurebot: "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."

18:10 TEttinger: ,(doc update)

18:10 clojurebot: "([m k f] [m k f x] [m k f x y] [m k f x y ...] [m k f x y ...]); 'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value."

18:11 justin_smith: ,((fnil conj #{}) nil 1)

18:11 clojurebot: #{1}

18:11 justin_smith: ,((fnil conj #{}) #{2 3} 1)

18:11 clojurebot: #{1 3 2}

18:11 TEttinger: ,(let [the-map {:a "alpha" :b "beta"}] (update the-map 1 #(if (seq %) (conj % :new-thing) #{:new-thing})))

18:11 clojurebot: {:a "alpha", :b "beta", 1 #{:new-thing}}

18:11 justin_smith: hibou: ^ see examples

18:11 TEttinger: (doc fnil)

18:11 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

18:11 vendethiel: (if anyone knows about the question I asked as Ven, I'm still interested ;-).)

18:11 TEttinger: ahh

18:12 justin_smith: ,(def set-conj (fnil conj #{})) ; better yet

18:12 clojurebot: #'sandbox/set-conj

18:12 TEttinger: I know there are people who use luminus here... uh...

18:12 justin_smith: ,(set-conj nil :a 42)

18:12 clojurebot: #{42 :a}

18:13 hibou: (doc fnil)

18:13 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

18:14 hibou: the clojurebot is awsome

18:14 TEttinger: yep

18:14 justin_smith: well yeah, but also "doc" is built in (clojure.repl)

18:14 TEttinger: this was linked in #perl6 oddly enough, but I wonder if this is a known used lib in any clojure projects http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/

18:15 apache commons collections

18:15 Ven: TEttinger: I'm getting such errors on a few components, though, even seemingly-unrelated ones like ragtime: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

18:15 TEttinger: that's interesting

18:16 Ven: well.. I just wanted to write a bit of clojure code :[

18:16 TEttinger: no really, that looks vaguely familiar

18:16 justin_smith: Ven: that means someone gave it a path to a config file or input file that does not exist, usually

18:17 Ven: justin_smith: ye mean, for ragtime?

18:17 TEttinger: justin_smith closes in on the sportball

18:17 justin_smith: Ven: if ragtime is giving the error, that means someone is telling ragtime to open a file or resource that does not exist

18:18 ,(slurp (clojure.java.io/resource "donald trump's dignity"))

18:18 clojurebot: #error {\n :cause "No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil"\n :at [clojure.core$_cache_protocol_fn invokeStatic "core_deftype.clj" 558]}]\n :trace\n [[clojure.core...

18:18 Ven: justin_smith: it errors out in "compiling:(/private/var/folders/_3/s9r3mrh17sd0g80dgvflmjtr0000gn/T/form-init1915945053886098775.clj:1:124)",so... no idea if it's ragtime. if I upgrade ragtime, I get a different error though

18:18 justin_smith: the error is basically a weird way of saying "file not found", and if you can get the stack trace you will see who did it

18:19 Ven: justin_smith: everything in the stacktrace is from clojure.main or clojure.lang: at clojure.lang.Compiler.load(Compiler.java:7142)...at clojure.lang.Compiler.loadFile(Compiler.java:7086)...at clojure.main$load_script.invoke(main.clj:274)

18:20 justin_smith: Ven: can you share the trace? typically there will be like exactly one frame that gives away what was really happening and the rest is noise

18:22 Ven: justin_smith: erm, I was looking at the wrong stacktrace, whoops. at ragtime.sql.files$run_sql_fn$fn__366$fn__367$fn__368.invoke(files.clj:85)

18:22 justin_smith: Ven: so it looks like it wants to run an sql file that doesn't exist?

18:22 Ven: justin_smith: that very well might be it, yes

18:23 justin_smith: sounds like config that wants resources provided by a dep that is no longer there

18:26 kenrestivo: huh. still this makes no sense. nobody seems to be trying to import ExceptionInfo. plenty of places call (ex-info) tho. and the stacktrace doesn't speak to me: https://www.refheap.com/111469

18:32 Ven: justin_smith: okay, thanks. it stopped erroring out after I finally found it was a half-done upgrade

18:32 now it just does nothing instead :P

18:32 justin_smith: kenrestivo: looks like a transitive dep that imports clojure.tools.reader.impl.ExceptionInfo - I'm thinking transitive dep because you have require higher up on the call stack

18:44 kenrestivo: it might be something that does the bad thing of importing the class in some namespace, but not requiring the dep that would provide it

19:21 kenrestivo: i hacked around it by just removing slf4j-timbre and not bothering to log the stuff coming from the library that used it

19:21 so... problem solved, change committed.

19:21 on to the next problem :)

19:40 hahaha, which is: lein-migratus doesn't work without slf4j <facepalm>

19:42 so i can have either clojurescript, or migratus, but not both. *sigh* oh well..

19:53 :profiles to the rescue :)

20:48 skeuomorf: How do people do error handling in clojure?

20:49 And are the list of exceptions documented somewhere?

21:19 devth: how to dynamically determine which symbol to bind at runtime in a `binding` clause?

21:20 justin_smith: you'd need eval for that

21:20 devth: oh. right

21:20 so do i have to quote the contents of eval?

21:21 justin_smith: eval takes lists of symbols as its input if that's what you mean

21:21 devth: (let [*s* (determine-symbol ..)] (eval (binding [*s* ...] ...)))

21:21 so: (let [*s* (determine-symbol ..)] (eval '(binding [*s* ...] ...)))

21:21 justin_smith: right, but you would need to quote binding and unquote *s*

21:22 * skeuomorf will use core.typed to alleviate some concerns

21:22 justin_smith: so you likely need ` instead of '

21:22 devth: oh yeah. been awhile since i've messed with this stuff; forgot most of it :(

21:22 justin_smith: best is to find a solution that doesn't require binding an unknown symbol at runtime

21:23 devth: have been able to do without until now, but adding an api component forced me in this direction

21:24 unless i do a significant rewrite

21:24 anyhow thanks. i'll think about it

21:36 vsync: what's the quickest way to have a local version of some library, via leiningen, so I can hack non-vendory things into a local branch?

21:36 twist: cygwin

21:37 justin_smith: vsync: lein install

21:38 vsync: justin_smith: that says it saves the jar locally?

21:38 justin_smith: it puts it in your local cache, so it is available to other local projects

21:38 vsync: ohhh, install from hacked codebase

21:38 justin_smith: right, check out code, fix it up, run lein install, now use that version from another project

21:39 for sanity, I recommend changing the version string

21:39 (in the project.clj)

21:39 vsync: now, say clojars has version numbers listed for the project, but the project has no tags (at least so saith github)... any way of getting the exact source that was called that version, or just guess?

21:41 justin_smith: vsync: that really depends on the project - if you get lucky, they created a git tag, but worst case pretty much every clojure library includes the full source, and you could just take the version of the jar you use and replace the sources in the repo with the ones in that jar

21:41 vsync: oh, that's quite civilized of them

21:41 justin_smith: a jar file is pretty much a zip file, so getting the source out is easy

21:41 vsync: yepper

21:42 so where does leiningen cache things (that I don't "install")? i checked ~/.lein and ~/.m2 and in the project dir but couldn't find much

21:42 gfredericks: ~/.me is where the maven deps get cached

21:42 clojurebot: Ok.

21:42 gfredericks: ~/.m2 I mean

21:42 clojurebot: Cool story bro.

21:42 gfredericks: clojurebot: ~/.me?

21:42 clojurebot: Titim gan éirí ort.

21:42 gfredericks: ~what

21:42 clojurebot: what is bbloom bitching about OOP

21:43 TEttinger: ~m2

21:43 clojurebot: excusez-moi

21:43 TEttinger: ~me

21:43 clojurebot: me is greek to it

21:43 TEttinger: ha

21:43 gfredericks: ~/.me

21:43 clojurebot: /.me is where the maven deps get cached

21:45 justin_smith: vsync: if you ever pull in a new dep, you'll see leiningen tell you where it is putting the files. But yeah, $HOME/.m2/ is the default (but could be overridden by custom settings)

22:11 jeaye: Is there a built-in function to recursively update each nested sequence containing a key?

22:13 Example: http://dpaste.com/151GGCN

22:15 Frozenlock: jeaye: could you rephrase that? You want to modify vectors, not map?

22:17 jeaye: Frozenlock: Yeah, I see the poor phrasing. I'm looking to update all nested vectors starting with :type.

22:19 I think a library like specter can do this, but I was looking for a built-in function first.

22:20 Frozenlock: jeaye: There's nothing built-in for this (to my knowledge). Tho clojure.walk would probably be a good place to start if you don't mind building it yourself.

22:21 jeaye: I'd rather bring in specter than bother writing it myself. Thanks, Frozenlock.

Logging service provided by n01se.net