#clojure log - Jul 23 2014

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

0:01 sm0ke: how do i type hint return expression from a macro?

0:01 Jaood: ,(let [[a [_ & b]] (split-with #(not= 3 %) [1 2 3 3 5 3 6])] (concat a b))

0:01 clojurebot: (1 2 3 5 3 ...)

0:02 Jaood: ,(let [[a b] (split-with #(not= 3 %) [1 2 3 3 45 3 6])] (concat a (rest b)))

0:02 clojurebot: (1 2 3 45 3 ...)

0:02 sm0ke: (defmacro ^Foo [& b] `(...)) doesnt work

0:03 oh ..(defmacro [&b] (vary-meta `(..) assoc :tag `Foo)) did the trick

0:04 or may be not

0:04 ambrosebs: sm0ke: you might need to wrap in an extra do sometimes (defmacro bar [& body] (with-meta (list* 'do body) {:tag 'Foo}))

0:04 justin_smith: well you would need a macro name in there

0:05 sm0ke: ambrosebs: (defmacro [&b] (vary-meta `(do ..) assoc :tag `Foo)) would work too?

0:05 justin_smith: sm0ke: I am concerned that you are doing this much work eliminating reflection when you haven't really profiled yet. You'll get better performance gains with less work if you figure out where the specific bottleneck is.

0:05 ambrosebs: sm0ke: probably

0:06 sm0ke: hurm doesnt help either

0:06 is there something about type hinting inside record methods?

0:08 oh an of course (defmacro [^String s]..) wont work either?

0:08 what a mess

0:13 ok in a record method doing (foo [this ^String s] ...) just bluntly throws error

0:21 nkozo: Jaood: not really idiomatic I think :): (filter (let [found (atom false)] #(or @found (not (reset! found (= % 3))))) [1 2 3 4 3 5])

0:24 Jaood: nkozo: yeah, not idiomatic at all :), my attempt involves using a recursive fn using first, rest, conj

0:25 nkozo: Jaood: the better way is to implement it using lazy-seq

0:25 Jaood: nkozo: you first attempt was nice but not sure to call it idiomatic

0:26 nkozo: it really needs his own function

0:27 Jaood: nkozo: https://www.refheap.com/88491

0:28 from the little schemer but wrote before looking at the answer

0:29 was looking for an idiomatic version

0:30 justin_smith: ,((fn drop1 [[x & y]] (if (= x 'a) y (lazy-seq (cons x (drop1 y))))) '[c b a a b c a b]) lazy-seq version

0:30 clojurebot: (c b a b c ...)

0:32 nkozo: another take: https://gist.github.com/anonymous/398e6732cae347d49339

0:33 sm0ke: justin_smith: i am already too deep in .. only few moreeeeeeeee fileSSAASRRFGGHH

0:34 heh btw how to type hint the `..` macro?

0:35 (.. a ^String foo bar) doesnt seem to work

0:35 justin_smith: sm0ke: .. is pretty much replacable with ->

0:35 and I think people just recommend replacing it nowadays

0:36 sm0ke: hurmm its pretty for use in builder pattern code

0:36 a.foo().bar()

0:36 justin_smith: (-> a foo bar)

0:37 sm0ke: (.. a foo bar) vs (->> a .foo .bar)

0:37 Jaood: I think I'm distracting myself to much with idiomatic versions :P

0:37 sm0ke: Jaood: yep it soon turns into idotic versions

0:38 justin_smith: ,(-> "hello" .length .toString)

0:38 clojurebot: "5"

0:38 sm0ke: ,(.. "hello" length toString)

0:38 clojurebot: "5"

0:38 justin_smith: I don't think the -> is that much worse

0:39 and my original point was that you already figured out how to hint ->

0:41 sm0ke: yep

0:41 agreed

0:42 Jaood: python has so much stuff to get things done - clojure will get there!

0:44 justin_smith: Jaood: clojure makes it possible to use multiple cores efficiently, python will likely never get there

0:46 Jaood: nkozo: you are returning a nil value inside the lazyseq on empty collections

0:47 justin_smith: yeah, the trade-offs one has to make ;)

0:52 nkozo: Jaood: fixed, https://gist.github.com/nahuel/eb7073d02c0aec6256d2 ... btw, justin_smith version never returns for empty collections

0:52 justin_smith: ,((fn drop1 [[x & y :as s]] (when (seq s) (if (= x 'a) y (lazy-seq (cons x (drop1 y)))))) '[a b a b a]) speaking of, mind handled nil wrong too

0:52 clojurebot: (b a b a)

0:52 justin_smith: nkozo: ynx

0:52 *jynx

0:55 amalloy: justin_smith: you don't really want to use & destructuring for building lazy sequences anyway

0:56 you'll consume more elements than you intend to, because you realize the first element of y even if nobody asks for it

0:56 justin_smith: oh, right

0:57 that's an abuse of when too

0:57 amalloy: which is stupid, imo, i wish that ##(let [[x & y] [1]] [x y]) returned [1 ()] instead of [1 nil], but there you have it

0:57 lazybot: ⇒ [1 nil]

1:00 amalloy: justin_smith: how is it an abuse of when?

1:01 justin_smith: referring to the "when for side effects" discussion that was once perrenial here

2:37 blur3d: Would you guys consider extending a project dependancy’s (internal) multi-method to be hackish? (ie. I am requiring a library that uses multi-methods to handle different message types, and I want to extend it to support custom ones)

2:40 engblom: blur3d: Yes, in my ears at least. It would be very difficult for someone else to notice what you actually did, in case they read the code later.

2:40 blur3d: yeah… it doesn’t sit too well with me

2:41 do you know of an alternative - even if it means forking the dependancy

2:41 some kind of register-handler that you can hook into?

2:42 nathan7: blur3d: I'd clearly state it in internal docs

2:42 blur3d: and do it anyway

2:43 blur3d: nathan7: yeah, that was the original thinking. Just make sure it was documented clearly

2:44 It would only have a max of 16 methods extending it, and they would be very project specific

2:44 so it’s unlikely that you would have conflicts

2:45 the downside is that I don’t think you can remove a multi-method once defined - but again that would be very unlikely

2:46 amalloy: blur3d: it's something i'd aim to not do, but it's not necessarily a bad thing in every case

2:46 what library/multimethod is this?

2:47 blur3d: https://github.com/peterschwarz/clj-firmata/blob/develop/src/firmata/core.clj#L181

2:48 It’s currently private, as well as a few other useful methods, but Peter is open to making it public - and I just want to make sure it’s a good idea

2:48 or at least it’s done properly

5:09 mpenet: ,(deftype x [^:volatile-mutable a b]) (def y (x. 1 2))

5:09 clojurebot: sandbox.x

5:10 mpenet: ,(.a y)

5:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: y in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:10 mpenet: anyone knows what's wrong here?

5:10 Glenjamin: ,(def a) (def b)

5:10 mpenet: without the volatile-mutable metadata it works fine

5:10 clojurebot: #'sandbox/a

5:10 Glenjamin: ,b

5:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:10 Glenjamin: you need a (do) in that first form for the irc repl

5:10 mpenet: ah

5:11 ,(do (deftype z [^:volatile-mutable a b]) (let [x (z. 1 2)] (.a x)))

5:11 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: a for class sandbox.z>

5:11 mpenet: ,(do (deftype z [a b]) (let [x (z. 1 2)] (.a x)))

5:11 clojurebot: 1

5:13 mpenet: so it makes the field private apparently, I don't think it's documented anywhere

5:15 swi: Hello again :) what good json library for clojure ? clojure/data.json is good one ?

5:15 mpenet: swi: cheshire

5:16 swi: mpenet: thanks :)

5:17 so many libs for one task :)

5:20 btw, where is default :repositories of lein is written ?

5:21 chamomile: swi: nice ref - http://www.clojure-toolbox.com/

5:22 swi: chamomile: wow, nice! thanks. I'm using http://clojuredocs.org/ right now, but seems they not complete

5:49 ddellacosta: swi lately folks have been using http://www.arrdem.com/grimoire/

5:49 swi: clojuredocs.org is out of date, as you probably noticed

6:04 fenrock: is there a way to list all namespaces/functions available to user ns directly? I've got one that's disappearing on me after invoking it once i want to try and work out why_away

6:04 s/why_away/why/

6:20 seems (ns-map 'user) does what i want

6:23 rritoch: @fenrock, the Java way is to utilize the classloader to get a list of the packages and to access their respective resources. Doing this from clojure MAY be somewhat more complex and MAY require some parsing of the source files but SHOULD still be possible.

6:25 fenrock: it's another clojure function that binds to user, but then vanishes from it after being called. trying to work out why

6:28 swi: ddellacosta: yes, i'v noticed that cljdocs old, is there similar resource for actual version ?

6:28 ddellacosta: oops, sorry, open link and find out :) thanks

6:28 ddellacosta: swi: :-)

6:29 rritoch: fenrock: Anyhow, looks like clojure provides it's own method, in addition to ns-map you should be able to use (all-ns) to get all of the namespaces. I guess someone was thinking ahead when they designed clojure.

6:29 fenrock: But if you also need the Java components you'll need to utilize the classloader

6:30 fenrock: cheers

6:30 ddellacosta: &*ns*

6:30 lazybot: ⇒ #<Namespace sandbox5671>

6:30 ddellacosta: &(map first (ns-publics *ns*))

6:30 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

6:30 ddellacosta: d'oh

6:31 fenrock: if you want to see public functions in a namespace the above can help ^

6:31 or mappings I should say

6:31 fenrock: thanks ddellacosta

6:36 swi: hm.. is clojure regex know about .* pattern ?

6:36 fenrock: ddellacosta: wow, ns-publics cut the list down to just the stuff i was interested in. magic

6:36 ddellacosta: fenrock: :-)

6:36 swi: Regex in Clojure is the same as Java; just check out the Java docs for it.

6:37 fenrock: isn't there also less excessive back-slashing?

6:37 ddellacosta: &(re-find #".*" "foo")

6:37 lazybot: ⇒ "foo"

6:38 ddellacosta: fenrock: what do you mean?

6:38 fenrock: you don't need to do "\\s", you can do "\s"

6:39 &(re-find #"\shi\sthere" " hi there")

6:39 lazybot: ⇒ " hi there"

6:39 ddellacosta: swi: This is probably a good place to refer to, other than the docs for stuff in clojure.string and re-find (in clojure.core): http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

6:39 fenrock: oh yeah, I guess so. Do you need to add extra backslashes in Java for that?

6:40 fenrock: yes inside regular strings

6:40 ddellacosta: huh, didn't realize that.

6:40 swi: ddellacosta: thanks, allready there :)

6:40 ddellacosta: swi: great. :-)

6:42 swi: yep, re-find works :)

6:42 ddellacosta: ,(println "test")

6:42 clojurebot: eval service is offline

6:43 ddellacosta: don't know why I bother to check

6:43 Glenjamin: ,:why?

6:43 clojurebot: :why?

6:43 ddellacosta_: ,:because

6:43 clojurebot: :because

6:43 ddellacosta: ,:because

6:43 clojurebot: eval service is offline

7:04 swi: i'm wounder, if i (def mypattern #"\d+") in my code, it will be em, 'compiled' once for all programm run ? I mean no extra resource to build it on every using ?

7:08 CookedGr1phon: swi that's correct, the #"" is a compile time literal, so even if you use it inline and don't def it, it will only be compiled once

7:09 fenrock: swi: according to http://clojure.org/other_functions "Regex patterns can be compiled at read-time via the #"pattern" reader macro, or at run time with re-pattern. Both forms produce java.util.regex.Pattern objects."

7:10 CookedGr1phon: but yeah, you're deffing it as well, so even if you did (def mypattern (re-pattern "\d+")), that would only have the regex compiled once

7:11 swi: CookedGr1phon: so as i understand no diff, nice clojure do it's smart work and compile it's once :) Good

7:27 SagiCZ: ,(println "quiet in here")

7:27 clojurebot: quiet in here\n

7:32 madscientist`: How do I replace the Java this keyword in Clojure? I am porting a piece of Java code to Clojure and the `network.addNetworkReqListener(this, this.authAppId);' raises the question how to replace the this (the first argmument) reference

7:37 vijaykiran: madscientist`: what is "this" in this context? is it something you are constructing ?

7:39 madscientist`: vijaykiran: I suppose it is the class context

7:40 the line is in a private method (not a constructor)

7:44 vijaykiran: madscientist`: If you are calling the method - then you can create a proxy for the interface this

7:55 madscientist`: vijaykiran: https://code.google.com/p/jdiameter/source/browse/examples/guide1/src/main/java/org/example/server/ExampleServer.java#126 thats code I am porting, but I am not sure whether a proxy is the correct solution because the method is not specified in the interface

8:06 vijaykiran: madscientist`: https://code.google.com/p/jdiameter/source/browse/core/jdiameter/api/src/main/java/org/jdiameter/api/NetworkReqListener.java

8:07 madscientist`: so you can create an instance/proxy with the processRequest method and pass it as this

8:07 madscientist`: vijaykiran: figured that out myself too, thanks for the help

8:27 CookedGr1phon: Is anyone around who was talking about monitorenter/monitorexit yesterday? hiredman amalloy_ Bronsa bbloom ? I've been having a look at the ART verifier source and it seems the condition we're tripping over is https://android.googlesource.com/platform/art/+/kitkat-release/runtime/verifier/method_verifier.cc line 2731

8:27 which states that every instruction where the monitorenter count > 0 should be within a catch all block

8:47 agarman: anyone have opinions on http://docs.paralleluniverse.co/pulsar/

8:53 hcumberdale: Hi there :)

8:54 How to return a list from a recursive function that will end up with (recur ? Has the list to be a parameter so it's possible to do the tailcall?

8:55 Glenjamin: hcumberdale: you can use an explicit accumulator in the loop

8:55 ,(loop [a 10 acc nil] (if (zero? a) acc (recur (dec a) (conj acc a)))

8:55 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

8:56 Glenjamin: )

8:56 ,(loop [a 10 acc nil] (if (zero? a) acc (recur (dec a) (conj acc a))))

8:56 clojurebot: (1 2 3 4 5 ...)

8:56 hcumberdale: that will be the same as adding the accumulator to the fn def and not using loop right?

8:57 Glenjamin: yeah, but then you either need to make it a required param, or have a multi-arity function

8:58 hcumberdale: When not working with numbers and instead with list parameters, is there a shorter form for: if-let [next-node (first nodeset)] .... (recur .... (rest nodeset))?

9:01 Glenjamin: ,(let [[head & tail] [1 2 3 4]] [head tail])

9:01 clojurebot: [1 (2 3 4)]

9:01 Glenjamin: does that help?

9:01 there's probably some gotchas around destructuring vs (rest) vs (next), but i don't recall what they are

9:02 tvanhens: does anyone have any pallet experience with aws?

9:02 hcumberdale: ahh okay! thx

9:03 hyPiRion: hcumberdale: that looks like some pattern which can be transformed to use `map`, `filter` or `reduce`

9:04 either way, I tend to do destructuring in the binding for those things

9:05 ,(loop [acc () [f & r] [1 2 3 4 5]] (if f (recur (conj acc f) r) acc))

9:06 clojurebot: (5 4 3 2 1)

9:07 chamomile: ,(str "test")

9:07 clojurebot: "test"

9:07 chamomile: nice

9:08 yogsototh: Hi! I am trying to read the body of a request with ring/compojure. I do a (POST "/" req (str "'" (slurp (:body req)) "'")) and this returns nothing.

9:09 the type of body is class org.eclipse.jetty.server.HttpInput but I don't really know how to export the string out of it.

9:10 I don't use any middleware

9:11 Can anyone could help me? I am stuck for some time now.

9:11 My google fu is weak.

9:11 drbobbeaty: yogsototh: I have had success with the following: (POST "/" [:as {body :body}] and then in the body of the function refer to it like: (let [lst (json/parse-string (slurp body))] ...)

9:12 yogsototh: Where I'm using the cheshire JSON parsing library :as json.

9:12 yogsototh: drbobbeaty: thanks, I'll try it.

9:12 jonasen: I see some similarities between Transit and https://github.com/tailrecursion/cljson. I wonder if Transit is directly inspired by cljson? Are there other formats that take advantage of the speed of JSON parsers?

9:12 drbobbeaty: yogsototh:Good luck

9:13 swi: I dont understand http://paste.debian.net/111199/ what the difference ?

9:17 augustl: swi: nothing, it seems

9:18 swi: augustl: than i dont understand macros, seems :)

9:19 augustl: swi: is there a difference?

9:20 swi: augustl: in my point of view there is no diff. so i dont understand for what macros is :(

9:22 yogsototh: drbobbeaty: I found a way somehow! Thanks! The problem was certainly that slurp was called before. Resulting in an empty string the next call.

9:22 drbobbeaty: yogsototh: Glad you got it working! :)

9:23 augustl: swi: well, the macro just returns the same code as the function

9:23 swi: so using that macro to understand macros might be a bit difficult since the macro doesn't provide any value :)

9:23 michaelr525: hey

9:23 augustl: swi: so, it's possible to create a macro that doesn't really do anything

9:27 swi: augustl: doesnt' provide value ? return value not the same ?

9:29 augustl: swi: doesn't provide value as in value to a programmer :)

9:29 it doesn't do anything useful

9:30 swi: augustl: seems like i need to read about macros again :) right from begining :)

9:31 hyPiRion: swi: The only thing it does is inlining the form, but that's compiler work anyway.

9:32 see -> or ->> instead on more valuable macros

9:32 swi: hyPiRion: thanks, i will :)

9:39 xsyn: can I map juxt over a seq?

9:39 justin_smith: ,(map (juxt inc dec) (range 10))

9:39 clojurebot: ([1 -1] [2 0] [3 1] [4 2] [5 3] ...)

9:40 xsyn: sweet

9:40 hyPiRion: you can mapcat it too

9:48 SagiCZ: any simple way to convert keyword to a symbol?

9:48 boxed: ,(symbol (name :foo))

9:48 clojurebot: foo

9:49 boxed: I think that’s right anyway :P

9:49 SagiCZ: thanks

9:49 ,(symbol (name (def red :meat)))

9:49 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>

9:51 jcromartie: is this up to date? https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments

9:52 boxed: ,(def red :meat)(symbol (name red))

9:52 clojurebot: #'sandbox/red

9:54 justin_smith: boxed: you need do

9:54 boxed: ah

9:54 justin_smith: ,(do (def red :meat) (symbol (name red)))

9:54 clojurebot: meat

9:54 justin_smith: ,(+ 1 1) (/ 1 0) all this invalid stuff is ignored (System/exit 0)

9:54 clojurebot: 2

9:55 boxed: that’s a bit awkward

9:56 hyPiRion: boxed: it's just the bot, not clojure itself

9:57 boxed: yea I get that, but it’s a bit awkward when trying to show stuff

9:57 SagiCZ: ,{:red :meat :tasty :stuff}

9:57 clojurebot: {:tasty :stuff, :red :meat}

9:57 boxed: maybe an implicit do around it would have been nice

9:58 SagiCZ: guys.. what do i need this @ for when writing macros? i dont understand what splicing is

9:58 Glenjamin: ,`(list ~@[1 2 3])

9:58 clojurebot: (clojure.core/list 1 2 3)

9:59 Glenjamin: ,`(list ~[1 2 3])

9:59 clojurebot: (clojure.core/list [1 2 3])

9:59 Glenjamin: it unpacks one level of collection

9:59 justin_smith: ,`(1 2 3 ~@(range 4 8))

9:59 clojurebot: (1 2 3 4 5 ...)

10:00 hyPiRion: SagiCZ: Assume you pass ((println 10 20) (println 40 50)) and want to evaluate it. How do you do so?

10:00 SagiCZ: using @?

10:00 i think i get it

10:01 hyPiRion: right, you can do ##(let [a '((println 10 20) (println 40 50))] `(do ~@a))

10:01 lazybot: ⇒ (do (println 10 20) (println 40 50))

10:01 SagiCZ: does it unpack map too?

10:01 ,`(list ~@{:red :meat :tasty :stuff)

10:01 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

10:01 SagiCZ: ,`(list ~@{:red :meat :tasty :stuff})

10:01 clojurebot: (clojure.core/list [:tasty :stuff] [:red :meat])

10:02 SagiCZ: O.o

10:02 boxed: I guess the answer is “yes, but…” :P

10:02 hyPiRion: SagiCZ: @ calls seq on its input

10:02 ,(seq {:red :meat :tasty :stuff})

10:02 clojurebot: ([:tasty :stuff] [:red :meat])

10:02 SagiCZ: alright. i see

10:04 lets say i pass a map to a macro, and i want to use one of its values..

10:04 i would do... `(~passed-in-map :desired-keyword) .. right? it puts there the whole map for some reason

10:04 hyPiRion: right, that's correct

10:04 swi: hmmm... do i need to place function from top to bottom in .clj file to bottom ones can use top one ?

10:05 justin_smith: swi: you can also use declare

10:05 (doc declare)

10:05 clojurebot: "([& names]); defs the supplied var names with no bindings, useful for making forward declarations."

10:05 swi: justin_smith: thanks

10:06 justin_smith: (declare foo) (defn bar [] (use foo somehow ...)) (defn foo ...)

10:06 something like that

10:06 swi: like a func declaration on .h in C :)

10:06 justin_smith: very similar

10:06 swi: got it :)

10:11 jcromartie: so is the REPL broken in the latest ClojureScript or something?

10:11 I can't get this to work

10:11 I can connect

10:11 but nothing evaluates and comes back

10:11 my ClojureScript compiles successfully

10:12 and when I run "lein trampoline cljsbuild repl-listen" and open my app in the browser, it seems to connect

10:12 but there is no communication beyond that

10:13 hm

10:13 maybe I'm wrong… the ClojureScript REPL shows a prompt before it's connected

10:13 so that's kind of misleading

10:15 boxed: jcromartie: no warnings during compile?

10:15 jcromartie: no

10:16 boxed: just making sure because mostly “warnings” in cljs are really super critical errors :P

10:16 jcromartie: hm, seems my repl namespace is not compiled, d'oh… the file wasn't saved because I never M-x make-directory'ed

10:17 SagiCZ: ,(for [[vec] [[1 2 3] [4 5 6]]] vec)

10:17 clojurebot: (1 4)

10:17 SagiCZ: what happened here

10:18 jcromartie: SagiCZ: you destructured the first element of each vector in the parent vector

10:18 justin_smith: SagiCZ: you destructured to get the first element of each vector

10:18 llasram: SagiCZ: Your binding from is `[vec]`, which uses destructuring to get just the first element of each

10:18 heh

10:18 SagiCZ: i wanted to destructure it but it get just the first element of each?

10:19 justin_smith: oh man, I wonder what the record is for "simuiltanious same answer" on this channel

10:19 SagiCZ: I don't know if you wanted to, but that is what you did

10:19 llasram: SagiCZ: If I understand you correctly, you want `vec` instead of `[vec]`

10:19 SagiCZ: i really just wanted to see if destructuring works in for

10:19 john2x: how do I re-use the value returned by the previous expression in the repl?

10:19 jcromartie: john2x: *1

10:19 justin_smith: john2x: 81

10:19 llasram: Aside -- I'd suggest not using a common core function name like `vec` as a local

10:20 justin_smith: err, mis-shift, it's *1 of course

10:20 SagiCZ: 2llasram: thanks, good idea

10:20 teslanick: SagiCZ: Of course it does. Anything that has a binding form supports destructuring.

10:20 jcromartie: ,(for [v [[1 2 3] [4 5 6]]] v)

10:20 clojurebot: ([1 2 3] [4 5 6])

10:20 SagiCZ: 2teslanick: ok :)

10:20 jcromartie: ok

10:20 llasram: SagiCZ: What's with the `2`s?

10:20 justin_smith: ,(for [[a b c] [[1 2 3] [4 5 6]]] b)

10:20 clojurebot: (2 5)

10:20 john2x: thanks!

10:20 justin_smith: llasram: he hates client nick highlighting, and wants to prevent it, is my best guess

10:21 SagiCZ: llasram: i am really new to IRC and i thought that the "2" would say "TO someone" ... i actually type that by hand i dont know how to easily respond in my client :(

10:21 so thanks for having difficult nicks!

10:22 Glenjamin: sag[tab]

10:22 generally clients will expand nicks when you hit tab

10:22 SagiCZ: Glenjamin: ................................ ok that works

10:22 justin_smith: SagiCZ: if you use name followed by : our clients will highlight, and often even notify us if we are in a different window and our nicks come up, the 2 prefix prevents that (at least for some of us)

10:22 _alejandro: What do most people use as their irc clients? Emacs?

10:22 SagiCZ: justin_smith: i see..

10:22 i use Pidgin

10:23 llasram: SagiCZ: You can private message someone with /msg, but generally to just publicly/inforamlly direct a message to someone, you just use their name, as everyone else is suggesting

10:23 SagiCZ: Glenjamin: thanks really, you are a life saver

10:23 * swi use irssi

10:23 llasram: informally even

10:23 SagiCZ: llasram: so are people bothered by multiple dialogs going at once? is it better to take that private?

10:23 * llasram M-x erc-spelling-mode

10:24 nullptr: ERC here ... if you type the first few letters of a name "Sag" and hit TAB, it completes to "SagiCZ: " which is the common way of addressing someone

10:24 llasram: SagiCZ: Nope

10:24 The cross-conversation noise is part of the fun

10:24 SagiCZ: nullptr: yep it works! yay

10:25 boxed: SagiCZ: it’s also a good idea to read what other people are talking about, it spreads knowledge and broadens input

10:25 SagiCZ: boxed: yeah i am trying to keep up

10:26 boxed: SagiCZ: this actually goes for things like skype chats at work too.. I find that a lot of people are always trying to talk privately to “not bother” others, but it just ends up everyone has to repeat shit over and over

10:27 SagiCZ: boxed: yeah but chat is a little less annoying than friends trying to yell over each other

10:27 i have this simple problem, i have a map, and i want to get a list (but not really list, just the elements of it) of pairs, where each pair consist of VALUE KEYWORD .. (in this order)

10:28 justin_smith: ,(apply concat (seq {:a 0 :b 1 :c 2}))

10:28 clojurebot: (:c 2 :b 1 :a ...)

10:28 justin_smith: oh, value first

10:28 joegallo: ,(apply concat (map reverse {:a 1 :b 2}))

10:28 clojurebot: (2 :b 1 :a)

10:28 justin_smith: ,(mapcat reverse (seq {:a 0 :b 1 :c 2}))

10:28 clojurebot: (2 :c 1 :b 0 ...)

10:28 _alejandro: ,(map reverse (seq {:a 0 :b 1 :c 2}))

10:28 clojurebot: ((2 :c) (1 :b) (0 :a))

10:29 hyPiRion: all these reverse things, hrm.

10:29 joegallo: ,(mapcat reverse {:a 0 :b 1 :c 2}) ; no need for the seq, right?

10:29 clojurebot: (2 :c 1 :b 0 ...)

10:29 SagiCZ: thats what i want

10:29 what solution is best? :D

10:29 justin_smith: joegallo: right, I needed it for concat, and I had just up-arrowed and edited

10:29 boxed: ,(for [[k v] (seq {:a 1, :b 2})] [v k])

10:29 clojurebot: ([2 :b] [1 :a])

10:29 hyPiRion: (interleave (keys coll) (vals coll))

10:29 joegallo: justin_smith: ah, yeah, i see that now

10:29 boxed: I find that more readable as a python coder :P

10:30 swi: damn.. cheshire spit exception on crappy json :( i hate people that give craped json format :( Things like that is for try/except ?

10:30 justin_smith: joegallo: oh wait, I didn't need it there either :)

10:30 jcromartie: heh ClojureScript is a whole new beast huh

10:30 joegallo: huh, how about that

10:30 SagiCZ: ,(do (def m {:a 0 :b 1}) (interleave (keys m) (vals m)))

10:30 clojurebot: (:b 1 :a 0)

10:30 irctc: I'm having some issues trying to copy a whole table from Postgres, I'm using the jdbc copy manager which seems to be working, Clojure kills my database connection halfway through the copy anybody know why? https://gist.github.com/dpick/15dcd98167c099a356c6

10:30 SagiCZ: ,(do (def m {:a 0 :b 1}) (interleave (vals m) (keys m)))

10:30 clojurebot: (1 :b 0 :a)

10:31 SagiCZ: boxed: right, it really is more readable

10:31 hyPiRion: yeah, I flipped the order of keys and vals. Whoops.

10:31 justin_smith: swi: but try/catch won't let you access the partially evaluated json

10:33 stuartsierra: irctc: `doall` at line 25 is redundant.

10:33 `doseq` forces evaluation and always returns nil

10:33 irctc: stuartsieera: yeah I was getting frustrated and trying random things :(

10:34 stuartsierra: irctc: I don't see anything obviously wrong with that code snippet, except that you never close the input stream.

10:34 irctc: stuartsierra: I had it as a with-open which if I understand correctly should close the stream, but either way the connection to postgres gets killed part of the way through the table

10:35 swi: justin_smith: in this particular situation of it's wrong json - there is no usable data for me, but i even can't understand why it's fail

10:36 stuartsierra: irctc: I don't know, then. Maybe a timeout or maximum somewhere in the postgres driver.

10:36 justin_smith: swi: I guess in that case the best you can do is try/catch and maybe log the client and raw string for forensic purposes

10:37 irctc: stuartsierra: alright, thanks for looking

10:38 swi: justin_smith: i see.

10:39 but, how can this http://paste.debian.net/111225/ can lead to " Unexpected character ('}' (code 125)): was expecting double-quote to start field" ?

10:40 stuartsierra: Any suggestions to make sure Leiningen searches *only* repositories specified in ~/.lein/profiles.clj and nothing else? I've got :repositories ^:replace […] and :mirrors but it's still trying to fetch things from Clojars & Central.

10:42 xsyn: Say I've got a collection of maps

10:42 how do I remove those maps that have a nil id

10:42 so

10:42 ({id: 1} {:id nil})

10:43 I want ({:id 1}

10:43 ?

10:43 I've tried remove nil?

10:43 justin_smith: ,(filter :id '({:id 1} {:id nil} {:id 2}))

10:43 clojurebot: ({:id 1} {:id 2})

10:44 xsyn: and I can pass filder a vector of keywords

10:44 yay

10:44 thanks

10:44 justin_smith: that would also remove things that just didn't have an :id key at all

10:44 mping_: anyone uses liberator ?

10:44 justin_smith: you need an actual predicate if you want something more specific (but non-nil :id of course amounts to :id)

10:44 mping_: having trouble tracing the requests

10:44 john2x: is it possible to specify a Schema to a function's return value? or do I need core.typed for that?

10:45 SagiCZ: how do i convert this (:a :b :c) to this :a :b :c

10:45 justin_smith: SagiCZ: in what context?

10:45 xsyn: justin_smith: magic thank you

10:46 SagiCZ: i need for to spit out single things, not join them into list

10:46 justin_smith: john2x: maybe a post condition if you want to throw an assertion error if the structure is invalid at runtime

10:46 SagiCZ: you can only have a single return value from a given form

10:46 though you can use concat / mapcat to do a layer of flattening if you need that

10:46 SagiCZ: justin_smith: no way to solve that then?

10:47 boxed: ,(flatten [[1 2] [3 4]])

10:47 clojurebot: (1 2 3 4)

10:47 justin_smith: like I said, if you are producing a collection, you can remove a layer of structure

10:47 ~flatten

10:47 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

10:47 justin_smith: boxed: better to use apply concat, or mapcat

10:48 SagiCZ: justin_smith: gee i just feel i am doing more things wrong than correct in clojure

10:48 boxed: better why?

10:48 justin_smith: boxed: read what clojurebot said above

10:48 flatten destroys structure

10:48 SagiCZ: ,(concat (:a :b :c))

10:48 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>

10:48 SagiCZ: ,(concat '(:a :b :c))

10:48 clojurebot: (:a :b :c)

10:48 SagiCZ: didnt remove any layer

10:49 swi: Hehe, can someone look at my first clojure crap code and say why it's all wrong ? :)

10:50 SagiCZ: swi: yeah i would stand behind you in that line

10:50 llasram: swi: refheap/gist something up and I'd be haappy to comment

10:51 As I'm sure would others

10:51 swi: http://paste.debian.net/111228/ :D

10:51 SagiCZ: justin_smith: flatten did what i wanted in this case

10:51 llasram: Not one of the suggested paste sites. Rejected.

10:51 (j/k)

10:51 swi: ok

10:51 llasram: Joking joking!

10:52 swi: https://www.refheap.com/88510 is it better ?

10:52 xsyn: *chuckle*

10:52 llasram: Well... the syntax highlighting is more familiar, and thus more soothing

10:52 SagiCZ: swi: keep the closing parenthesees on the same line in getQuotes.. neat right? :)

10:53 llasram: swi: Yeah, so trivial level -- standard formatting places parens on the same line as the closing paren of the terminal form

10:54 swi: And naming convention using kebob-case (aka levitating-snake-case) vs javaCamelCase

10:54 john2x: swi: was just reading this earlier https://github.com/bbatsov/clojure-style-guide

10:54 swi: in fact it's haskelNameingCase in my situation, never learn java

10:55 SagiCZ: llasram: levitating snake case.. :D

10:55 john2x: hmm i guess I'll try out core.typed tomorrow, see how it feels vs Schema.

10:57 llasram: swi: In practice you should only need `declare` if you have e.g. mutually recursive functions. Otherwise it's more conventional->readable to just order your functions in reverse-dependency order

10:58 SagiCZ: What does this mean? "Can't use qualified name as parameter: user/something"

10:59 justin_smith: SagiCZ: note that I said (apply concat ...) not just concat

10:59 or mapcat instead of map

10:59 llasram: swi: The `doseq`s seem a bit out-of-place -- they turn the entire program into a sequence of side-effect-only imperative statements vs a more functional style

10:59 mthvedt: sagicz: usually means you’re syntax-quoting something that you didn’t want to syntax quote

10:59 swi: llasram: i knew that i would be trying to imperate this :D

11:01 llasram: you mean doseq at :50 ? cause at :25 it's a copy-paste from http-kit docs

11:05 SagiCZ: ,(cond #(%) :form)

11:05 clojurebot: :form

11:05 SagiCZ: what gets pasted as the parameter to the function?

11:05 justin_smith: SagiCZ: that function never gets called

11:06 SagiCZ: justin_smith: what if i want a function that returns true or false as a result of some complicated test?

11:06 justin_smith: ,(cond "anything" :form)

11:06 clojurebot: :form

11:06 teslanick: The last form of cond will always evaluate because there are no conditional statements.

11:06 justin_smith: SagiCZ: than call it

11:06 SagiCZ: ,(cond (#(%)) :form)

11:06 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval77/fn--78>

11:07 SagiCZ: ,(cond (#(false)) :form)

11:07 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>

11:07 justin_smith: SagiCZ: what are you trying to do?

11:08 SagiCZ: justin_smith: i am writing this complicated macro and i dont thing it was a good idea in the beginning.

11:08 justin_smith: ,(cond (> 0 1) :wat (> 1 0) :OK)

11:08 clojurebot: :OK

11:08 teslanick: The first rule of macro club is don't write macros.

11:08 SagiCZ: justin_smith: i am almost done, i will paste it and maybe you can have a quick glance

11:09 justin_smith: SagiCZ: if you are trying to write a macro, I hope you at least know about macroexpand

11:09 teslanick: I had a problem in clojure and thought to write a macro. Now I have ~@problems.

11:11 llasram: swi: Got pulled into a meat-space convo... Anyway, I mean both. The point of `doseq` is to run things for side-effects, so any use of it is necessarily a step out of the functional paradigm

11:11 SagiCZ: justin_smith: yeah i do know that :]

11:11 llasram: swi: Also, you don't need the `doall` in `getQuotes` -- randomly de-lazing sequences is not a good habit to get into

11:12 swi: llasram: but getting from http and println - it's sideeffect, doesn it ?

11:13 llasram: GETing from HTTP is IO, but the code is actually that functionally, yielding the result of the request as the return value of the function

11:13 s,result of,response to,

11:14 The `println` is only for side-effects, but it'd be be (IMHO) better style to write a functional program which only printed the results you want at the top level

11:15 (Or made use of Clojure's impurity to debugging print/log things at intermediate points while still yielding values functionally)

11:15 SagiCZ: so this is it.. be harsh.. also it might help if you heard about finite state machines, i am trying to implement some framework for them

11:15 the macro is almost done, but the last bits when putting together the conditionals are too hard for me

11:15 https://www.refheap.com/88516

11:16 swi: llasram: so i.e. i need to remove println from function and just return data strcuter that i need to -main, and there make a print loop ?

11:16 llasram: swi: That'd be the style I'd advocate, yes

11:16 It's easier to extend if you keep as much of your program as possible written in a functional style

11:17 SagiCZ: justin_smith: pasted the macro above

11:18 justin_smith: SagiCZ: you may want to consider condp instead of cond

11:18 (doc condp)

11:18 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which m

11:19 SagiCZ: (doc-for-simple-people condp)

11:19 justin_smith: ,(condp > 1 0 :wat 1 :umm 2 :OK 3 :huh)

11:19 clojurebot: :OK

11:20 swi: em... seems like need to rest, can even figure out how to do print loop :D

11:20 justin_smith: it's harder to read as a one liner, the first two args are special, the rest are taken as pairs

11:20 swi: s/can/can't/

11:20 justin_smith: SagiCZ: so in your cace (condp = cmd :condensation (water r) :depositation (ice r) ...

11:21 SagiCZ: justin_smith: i dont think this is what i need.. the conditions for each transition may be arbitraly complicated possibly with some heavy calculations.. i use simple keywords in my example

11:21 justin_smith: though I think it would require taking some stuff out of the cond

11:21 OK

11:21 SagiCZ: so i want to pass a function that computes a boolean value, if the transition is possible

11:22 swi: llasram: thanks a lot for help :)

11:22 clojurebot: Huh?

11:22 justin_smith: SagiCZ: well, for future reference, you can make repetitive cond blocks clearer with condp sometimes

11:22 llasram: swi: np!

11:22 SagiCZ: justin_smith: yeah it seems handy

11:23 justin_smith: SagiCZ: so what is it in the definition of fsm that requires it to be a macro?

11:25 SagiCZ: in the macroexpansion, you have things like [[user/cmd & user/r]]

11:26 this is something ` does, for heigene, but it messes up the creation of local bindings

11:26 are you sure you want to use syntax quote on the binding vector, and not just normal quote?

11:28 similar issue with commands in the top level fn

11:29 what you may want is commands#

11:29 which is a shortcut for using gensym to make a binding

11:33 llasram: I'm pretty sure they don't actually want a macro

11:34 justin_smith: llasram: yeah, that was my suspicion as well

11:34 it is clearly a learning exercise

11:35 Glenjamin: http://www.shouldthisbeamacro.com/

11:35 justin_smith: heh

11:35 <h1>NO</h1>

11:36 Glenjamin: ls

11:36 lazybot: bin boot etc home lib lib64 media root run srv sys tmp usr

11:36 Glenjamin: my favourite bot joke

11:36 justin_smith: ls

11:36 lazybot: boot etc home lib64 media mnt opt proc run sbin srv tmp usr var

11:36 justin_smith: it also really calls ls, and returns a random selection of the output

11:37 SagiCZ: justin_smith: so are you saying i should use a function? i just want to simpify the calls and not having to repeat the code

11:37 justin_smith: https://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/unix_jokes.clj

11:37 SagiCZ: then write a working function first, then make the syntax macro call that function

11:37 it's much easier that way

11:38 the syntax alteration and the functionality are two separate concerns, it's easier to address one at a time

11:38 SagiCZ: justin_smith: oh like that! i see what you mean.. so there is no reason to do anything else in macro than syntax alteration

11:38 justin_smith: right

11:39 SagiCZ: thanks

11:39 mthvedt: pwd

11:39 lazybot: #clojure

11:40 justin_smith: mutt

11:40 lazybot: Woof!

11:40 justin_smith: lol

11:40 echo ,(+ 1 1)

11:40 lazybot: ,(+ 1 1)

11:40 clojurebot: 2

11:40 justin_smith: ROFL

11:40 the bots used to ignore one another...

11:41 nobodyzzz: ls ect

11:41 lazybot: bin boot dev etc lib64 lost+found media mnt run sbin srv tmp var

11:41 nobodyzzz: ls etc

11:41 lazybot: home lib lost+found media proc run srv sys tmp var

11:41 SagiCZ: echo ,(println "hoe")

11:41 lazybot: ,(println "hoe")

11:41 clojurebot: hoe\n

11:41 nobodyzzz: ls etc/home

11:41 lazybot: bin boot etc home lib lib64 lost+found media opt proc run srv usr var

11:41 mthvedt: echo ,(println “mutt”)

11:41 lazybot: ,(println “mutt”)

11:41 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “mutt” in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:41 nobodyzzz: ls home

11:41 lazybot: bin boot etc home lib mnt proc root run sbin srv tmp

11:41 mthvedt: boo

11:41 that doesn’t even make sense

11:41 swi: Goodbye :)

11:42 justin_smith: nobodyzzz: you can see from the source I pasted, it ignores the args to ls

11:42 mthvedt: why did you feed "smartquotes" to the bot?

11:42 llasram: SagiCZ: For what you're trying to do, I believe you can get the same effect more clearly by just using higher-order functions

11:42 justin_smith: echo ,(println "mutt")

11:42 lazybot: ,(println "mutt")

11:42 clojurebot: mutt\n

11:42 nobodyzzz: echo nice

11:42 lazybot: nice

11:42 justin_smith: echo ,(print "mutt")

11:42 lazybot: ,(print "mutt")

11:42 clojurebot: mutt

11:42 justin_smith: oh, the final step of the recursion is missing

11:43 llasram: I think the bots ignore each other after... gfredericks? hyPiRion? figured out that cross-bot mutual quine

11:43 Or rather, lazybot ignores clojurebot bot

11:43 mthvedt: dang, that was going to be my next suggestion

11:43 justin_smith: llasram: right, but I just make lazybot trigger clojurebot

11:43 I thought it was a mutual ignore too, clearly it is just one way

11:45 gfredericks: okay okay okay so transit

11:46 has some edge-case ambiguity wrt json interpretation?

11:46 did anybody ask about this yet?

11:50 rhickey said that "all json is valid transit"; and I can't see how that isn't an ambiguity

11:51 justin_smith: gfredericks: got an example somewhere?

11:51 Glenjamin: that doesn't seem strictly true

11:51 gfredericks: justin_smith: no, I haven't played with it yet, it just seems logically necessary if you're encoding one thing as another

11:51 Glenjamin: well, i guess {"a": "~a"} is still valid transit, but it's not very useful

11:51 since the transit meaning differs from the json meaning

11:53 gfredericks: if my json happens to look like transit, it'll get processed differently by accident

11:53 probably an expedient compromise and not likely to be a problem, I just wanted to make sure I understood

11:53 SagiCZ: llasram: what do you mean by using higher-order functions? you mean disregard the whole machine function?

11:56 justin_smith: SagiCZ: btw, one of the more awesome things in clojure is a massive macro wrapping a state machine: core.async

11:56 bbloom: CookedGr1phon: did writing your own `locking macro fix it?

11:57 llasram: SagiCZ: The code invoking `fsm` is already passing in functions for checking each possible state transition. `fsm` can just be a function which executes on state data + the checking-functions

11:57 SagiCZ: Instead of generating code which uses `letfn` to generate functions, you just iterate over all the states, calling a function which itself returns accepts the state-description and returns a function for that state

11:58 SagiCZ: `fsm` itself then just returns the function composing those state-functions into the final state-machine

11:58 SagiCZ: llasram: " calling a function which itself returns accepts the state-description and returns a function for that state"

11:59 llasram: ?

11:59 llasram: er, remove "itself returns"

11:59 benkay: <justin_smith> benkay: any reason you need to create the uberjar on the micro? why not a more powerful machine dedicated to doing the builds? // because i am a cheap bastard

12:00 also because - hey, that's a neat standard for "is your stack lightweight?": build and run app on micro

12:00 SagiCZ: llasram: would i still need trampoline then?

12:01 benkay: this micro is now running postgres, docker, datomic, the app uberjar and occasionally falls over when building new uberjars.

12:01 justin_smith: benkay: I either use jenkins on a dedicated box, or just build locally

12:01 CookedGr1phon: bbloom: sort of, moving the monitor-enter outside the try block seems to have fixed it in some instances, but others are still failing

12:01 benkay: so i think it's reasonably lightweight.

12:01 justin_smith: yeah, i've been wanting to do builds locally for a bit now, but that'll entail rewriting the deploy scripts more than i'm in the mood to at the moment.

12:01 H4ns: i have a beginner java interop message: i need to use a few static fields of a java class. is there a way to import them somehow so that i don't have to use the.long.class.name/FIELD_NAME everywhere?

12:01 CookedGr1phon: bbloom: but I've just noticed I actually have the android build of clojure plus vanilla clojure included in my deps, so that might be affecting things, will remove that and try again

12:02 justin_smith: I don't know, there isn't much reasonably lightweight about clojure compared to anything else i have used seriously

12:02 H4ns: s/message/question/, sorry

12:02 benkay: justin_smith: tell me about it.

12:02 i still can't use clojure for scripting :(

12:02 justin_smith: H4ns: (import long.class name) name/FIELD_NAME

12:03 H4ns: justin_smith: thank you!

12:03 bbloom: CookedGr1phon: i'd file an issue here: https://code.google.com/p/android/issues/list be sure to include the generated byte code

12:03 llasram: SagiCZ: I don't think so, because you wouldn't have actual mutually recursive references to the state functions. You'd probably end up having the function composed by `fsm` "manually" trampoline between states by their keyword-names

12:05 justin_smith: H4ns: correcting myself: (import java.io.File) not (import java.io File)

12:05 SagiCZ: llasram: I will try to do that

12:05 justin_smith: the former works

12:05 H4ns: justin_smith: it was the "import" bit that i was missing, i've figured out how to put it into my ns declaration. thanks!

12:05 justin_smith: np

12:05 SagiCZ: ,(+ 2 5)

12:05 clojurebot: 7

12:05 justin_smith: you can also use :import in the ns form

12:05 SagiCZ: ,(println "hot dog")

12:05 clojurebot: hot dog\n

12:06 H4ns: justin_smith: that's what i do now :)

12:06 justin_smith: H4ns: ahh, and my invalid syntax is actually usable for the ns form, if you look at (doc ns)

12:06 (doc ns)

12:06 clojurebot: "([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax of refer-clojure/require/use/import/load/gen-class respectively, except the arguments are unevaluated and need not be quoted. (:gen-class ...), when supplied, de

12:06 justin_smith: $doc ns

12:06 * justin_smith shrugs.

12:09 llasram: ,(import '[java.io File])

12:09 clojurebot: java.io.File

12:10 clgv: &(doc ns)

12:10 lazybot: ⇒ "Macro ([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax o... https://www.refheap.com/88517

12:12 justin_smith: (inc clgv)

12:12 lazybot: ⇒ 24

12:12 justin_smith: that's what I wanted

12:13 (inc llasram)

12:13 lazybot: ⇒ 28

12:13 justin_smith: and that too

12:13 seangrove: I can't seem to get xml-zip and xml-> to work

12:14 (xml-filter/xml-> (zip/xml-zip (:response rr)) (xml-filter/tag= :Envelope)) => ()

12:14 clgv: :)

12:14 seangrove: Just looking to see if that looks like the vaguely correct syntax

12:15 devn: Anyone here have any Azul experience?

12:16 Specifically, Zing.

12:18 justin_smith: devn: with a name like that I would be afraid that after some period of attempting to use the API, they would reveal the punchline "lol you actually tried to use this! joke's on you! ZING"

12:18 devn: heh

12:19 justin_smith: in all seriousness, I know nothing about azul zing

12:19 devn: It sounds cool. I remember Rich talking about running his ants simulation on one of the Azul systems.

12:20 Which makes me curious to know whether that required Zing

12:22 jgt: Hello everyone

12:22 I’m new to Clojure, and was tinkering with the language; writing some small functions, etc.

12:23 and I’m wondering, why does my cond example work, but my case example does not? http://pastebin.com/P8mZFW7d

12:24 llasram: jgt: The case dispatch values are unevaluted Clojure literals

12:24 So that case statement is using the *symbols*, not the classes they resolve to

12:26 jgt: llasram: Should I use condp instead?

12:26 looks as though condp does evaluation

12:26 llasram: jgt: condp instance? is probably better, for a few reasons

12:27 It's pretty common to have a utility macro around `case` which evals the dispatch forms, but be aware that class hash values are not stable across JVM runs, so using that with class dispatch will break under AOT

12:28 hiredman: llasram: I think that may not be as common as you think

12:29 llasram: jgt: Mine http://blog.platypope.org/2011/10/15/clojure-case-is-not-for-you/ which include a link to cemerick's

12:29 hiredman: I use it relatively frequently for dispatching on e.g. Java static final integer constants

12:29 And have a variation of it for dispatching on Java enums which I also use relatively frequently

12:33 CookedGr1phon: bbloom: seems that I've actually fixed it, not getting verify errors any more. The issue was actually that I was loading in two copies of clojure core, one of which had my change, the other didn't

12:35 bbloom: CookedGr1phon: ah, in that case may i suggest a patch on clojure's JIRA? :-)

12:36 CookedGr1phon: You may, and I shall. Just going to do a bit more testing around, see if I can find any other situations where it still gives a verify error

12:36 but all clojure's tests pass no problem

12:40 johnwalker: how do you specify that dependencies are only required for testing?

12:41 oh derp, you just use a testing profile

12:42 hcumberdale: if I get a list back from a fn and I want the result not to be used as a list, instead it should be plain values

12:42 ,(print '(1 2 3))

12:42 clojurebot: (1 2 3)

12:43 justin_smith: hcumberdale: then do something with the individual values

12:43 ,(doseq [i '(1 2 3)] (print i))

12:43 clojurebot: 123

12:43 hcumberdale: justin_smith: a list of strings is returned

12:43 justin_smith: OK, clojure has plenty of ways of acting on each element of a list

12:43 hcumberdale: ,(print "a" "b" "c")

12:43 clojurebot: a b c

12:43 justin_smith: you can use clojure.string/join to make one string

12:44 hcumberdale: ,(print '("a" "b" "c"))

12:44 clojurebot: (a b c)

12:44 justin_smith: ,(apply print '(1 2 3)) is another option

12:44 clojurebot: 1 2 3

12:44 hcumberdale: yeah! I solved nearly all such cases with apply

12:44 justin_smith: ,(clojure.string/join " " '("these" "are" "strings"))

12:44 clojurebot: "these are strings"

12:48 hcumberdale: trying to use loom.graph/add-edges graph ["x" (fn that returns list of strings)]

12:48 ends up with an edge: "x" '("a" "b" "c")

12:49 justin_smith: try (apply loom.graph/add-edges graph "x" (fn that returns list of strings))

12:51 hcumberdale: justin_smith: results in scary output with some kind of alphabet in the nodeset

12:52 justin_smith: maybe you want (add-edges graph (cons "x" (fn that returns list of strings)))

12:53 https://github.com/aysylu/loom/blob/master/src/loom/graph.clj#L63 but looking at this, you should be constructing a list of 3 element lists

12:54 or 2 element

13:06 ChouLin: /m Hi I'm trying to to this: ( loop a file -> split each line into words -> store word-count in a hashmap); here's how I scope with a single line:

13:06 (defn get-word-counts [line]

13:06 (reduce

13:06 (fn [words w] (assoc words w (inc (words w 0)))) {}

13:06 (str/split (str/lower-case line) #"\W+")))

13:06

13:06

13:10 justin_smith: ChouLin: please use refheap or gist for multiple lines of code

13:12 ,(reduce (fn [words w] (update-in words [w] (fnil inc 0))) {} ["a" "a" "b"])

13:12 clojurebot: {"b" 1, "a" 2}

13:13 sigmavirus24: hey tbaldridge I have a couple questions about transit-python, would a PM be more appropriate?

13:14 tbaldridge: sure

13:20 augustl: I have '("x" "a" "b"), is there anything in core for validating that '("x" "a" "b" "f" "g") starts with the first sequence and get '("b" "f" "g") back?

13:20 err, get '("f" "g") back I mean

13:23 Glenjamin: i don't think there's one function that will do just that

13:23 (= a (take b (count a)) will do the first bit

13:23 erm, reverse those take arguments

13:25 ,(defn leftovers [prefix coll] (if (= prefix (take (count prefix) coll) (drop (count prefix) coll)))

13:25 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

13:25 Glenjamin: ,(defn leftovers [prefix coll] (if (= prefix (take (count prefix) coll)) (drop (count prefix) coll)))

13:25 clojurebot: #'sandbox/leftovers

13:25 Glenjamin: ,(leftovers '(a b c) '(a b c d e f))

13:25 clojurebot: (d e f)

13:26 justin_smith: ,((fn [[p & ps :as pattern] [i & is :as input]] (cond (empty? pattern) input (= p i) (recur ps is) :else false)) ["x" "a" "b"] ["x" "a" "b" "f" "g"])

13:26 clojurebot: ("f" "g")

13:43 mdrogalis: A wild licensing debate appears! https://twitter.com/bodil/status/491960370521976832

13:45 SegFaultAX: Oh Bodil.

13:46 mdrogalis: I actually didn't realize it was her before I posted that - since she changed her avatar.

13:47 tbaldridge: ah yes, the never ending battle of personal ideals vs legal realities....

13:48 mdrogalis: I'm actually completely fine with Datomic being closed source. That obviously took an amazing amount of work, and Cognitect deserves every dime they make off it.

13:50 ToxicFrog: mdrogalis: I'm not, but I also think that everything should be at least visible-source even if it's not released under a FOSS license, so.

13:50 Glenjamin: there are examples of dual-licenced databases

13:51 mdrogalis: ToxicFrog: Fair argument.

13:51 Glenjamin: being able to fix the tools you use is nice, but not a necessary feature

13:51 mdrogalis: So, is the issue that Cognitect is only taking contributions via Jira as usual for Transit, or are they not taking anything period?

13:52 Glenjamin: "Because transit is incorporated into products and client projects, we prefer to do development internally and are not accepting pull requests or patches."

13:53 mdrogalis: Oh, well that's gross.

13:54 At a minimum, continue development in house and progressively merge the "open source" version back in with the main line or something.

13:54 SagiCZ: (dotime [_ 10000] (println "o"))

13:55 ,(dotimes [_ 10000] (println "o"))

13:55 clojurebot: o\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no\no...

13:55 tbaldridge: issues can be created via github, Transit doesn't use JIRA

13:56 mdrogalis: tbaldridge: What's the point if they'll never be acted on?

13:56 llasram: tbaldridge: What "legal realities"?

13:57 tbaldridge: But here's the legal part of it (as far as I understand it). Let's say I go and create a product and sell it to some company. That product goes horribly wrong, and nukes somebody's server, they come to sue me. I can't turn around and say "welp, mdrogalis wrote that PR so go sue him". Nope if I accept a PR I accept the right to be sued for that code.

13:57 llasram: ...

13:57 tbaldridge: mdrogalis: they'll be acted on, they already have...

13:57 boxed: don’t operate in Common Law countries :P

13:58 tbaldridge: mdrogalis: https://github.com/cognitect/transit-js/pulls?direction=desc&page=1&sort=created&state=closed

13:58 Notice, the PR wasn't used, but the feedback was.

13:58 mdrogalis: tbaldridge: I'm not being saracastic by the way. I assumed it worked the same way issues were working with other Clojure Github projects

13:58 bbloom: tbaldridge: presumably that's the point of the "absolutely no warentee" startup messages

13:58 llasram: I'm glad most of the word has the paranoia dial set somewhere below eleven

13:58 s,word,world,

14:00 mdrogalis: Bottom line though - not submitting user contributions puts me off a lot.

14:00 Certainly not to blame anyone.

14:00 tbaldridge: bbloom: presumably being the key word....

14:01 bbloom: tbaldridge: *shrug* lawyers

14:01 tbaldridge: and what can and cannot be done may be trumped by a contract signed by two companies.

14:01 bbloom: the problem is that people talk to their council, who recommends MAXIMUM CAUTION, and they follow counsil's instructions

14:01 mdrogalis: Yeah, integrating it into client work was a no-no IMO.

14:02 bbloom: but in reality, you need to weigh risk vs reward

14:02 and at some point, once you fall below your risk tollerence, you need to tell your counsil to bugger off

14:02 council*

14:02 b/c somebody can always sue you

14:02 doesn't mean they'll win...

14:08 tbaldridge: but sorry, no reason to take it out on you :-P

14:09 tbaldridge: bbloom: nah, I agree with most opinions of this stuff, and I think most people agree, the world would be better with less of this sort of stuff.

14:10 But I've worked with enough larger companies to know that this stuff has to be taken seriously.

14:10 For that matter when I worked with MS they outright banned GPL software on their servers, and frowned on LGPL. And that wasn't even a product they were selling, it was a internal service.

14:11 mdrogalis: tbaldridge: Yeah, apologies. I know you didn't have any say in that choice.

14:11 bbloom: well the GPL is a whole other discussion

14:11 but, speaking of MS:

14:11 https://github.com/Microsoft/TypeScript/pulls?direction=desc&page=1&sort=created&state=open

14:11 AimHere: MS did have a bee in its bonnet about the GPL circa 2000ish or so

14:11 bbloom: :-P

14:11 AimHere: The Halloween documents and all that

14:11 tbaldridge: bbloom: ;-)

14:11 mdrogalis: Bee in its bonnet lol

14:11 Havent heard that in a while

14:14 seancorfield: tbaldridge: when I worked at Adobe, they had a similar stance on GPL (and on LGPL)

14:15 tbaldridge: hopefully someday all this stuff will get tested in court, but until then most of these licenses are just words and theory

14:15 AimHere: GPL has been to court lots of times

14:15 seancorfield: I got dragged into a software license audit - for an internal project - and the upshot was we had to go to a FOSS project we wanted to use and ask if they would consider changing the license they used (from LGPL in that case) so we could actually leverage their project...

14:16 justin_smith: seancorfield: given that the LGPL is a license to modify or redistribute, you also had the option of relicensing your own code, in order to be able to access that license

14:16 seancorfield: and it doesn't help that the US attitude to software licenses seems to be at odds with the rest of the world so folks in the FOSS community get all bent out of shape when a discussion like this one (Bodil's tweet) start up

14:17 justin_smith: it was not for a distributable project, nor was it for open source usage

14:17 andrzejsliwa: Hi guys, short question... how to disable appearing of java icon in dock of macosx when running leiningen?

14:18 johnwalker: which bodil tweet? ;)

14:18 andrzejsliwa: I found :jvm-opts ["-Dapple.awt.UIElement=true"]

14:18 justin_smith: seancorfield: if you weren't distributing, why did you need a license to copy and redistribute?

14:18 Bodil: This discussion amuses me tremendously.

14:18 andrzejsliwa: but this disable icon only for jvm of cider

14:18 seancorfield: the LGPL project in question involved code generation and legal counsel were not happy with questions around how LGPL affected the generated code, which blended in parts of the LGPL project, and was then incorporated into our internal project

14:19 justin_smith: IANAL - but the lawyers had issues

14:19 Glenjamin: I suppose the open source transits could be treated as forks which never merge back upstream

14:19 seancorfield: hey, who said Bodil three times? :)

14:19 _alejandro: andrzejsliwa: how are you running your app?

14:19 algernon: "lawyers had issues" - the world would be so much better if lawyers were bug free.

14:19 andrzejsliwa: I just run lein

14:20 Bodil: The GPL makes it hard for people to exploit free software to build their proprietary software. That's a feature. 😁

14:20 andrzejsliwa: and Java icon appearing in dock... for time of running lein

14:20 seancorfield: licensing issues are not about common sense or rationality in a lot of cases - legal concerns are often on a higher plane :)

14:20 technomancy: protip: you can sue anyone whether or not you have a case against them.

14:20 _alejandro: andrzejsliwa: what happens if you do `lein trampoline run`?

14:20 AimHere: Is clojure's GPL-incompatibility a feature too?

14:21 seancorfield: Bodil: indeed, and GPL is an important license for that reason - but no one should be surprised when large US corporations then object to using software that is GPL :)

14:21 tbaldridge: Bodil: assuming said exploitation is undesirable...

14:21 Bodil: seancorfield: Obvious

14:21 andrzejsliwa: icon popup... and disapear after process is stopped

14:21 seancorfield: (even for internal projects with no redistirbution)

14:21 Bodil: Obviously*

14:21 technomancy: https://twitter.com/coda/status/428944437884891136

14:21 Bodil: tbaldridge: If so, one probably shouldn't be using the GPL. 😊

14:22 seancorfield: Getting dragged into those license audits was a particularly icky part of my career - I felt dirty afterward! :)

14:23 hahaha... love this: https://twitter.com/al3x/status/428990149897093120 (from that same thread)

14:23 Bodil: I quit a few enterprise jobs over bad attitudes towards free software, tbh.

14:23 technomancy: seancorfield: nice

14:24 Bodil: And I know a lot of enterprise consultants who hate the GPL because of being asked to deal with these things.

14:24 seancorfield: Bodil: the difference between Macromedia's attitude and Adobe's attitude was stark - I enjoyed my six years at Macromedia, not so much my one year at Adobe after they purchased us

14:24 _alejandro: andrzejsliwa: sorry no clue.

14:24 seancorfield: (and I did quit Adobe)

14:24 Bodil: seancorfield: I've heard a few people echo that sentiment. Not surprised. 😊

14:24 technomancy: seancorfield: does Adobe just classify free software advocates as "those crazy folks who always complain about flash?" =)

14:24 _alejandro: did you do anything to make it show up? I just realized I've never had the icon pop up at all

14:25 technomancy: at least back then

14:25 justin_smith: _alejandro: I know that certain libs make the icon show up (for example ring, because it loads some classes in swing)

14:25 (specifically the lein ring plugin)

14:26 seancorfield: technomancy: the discussion around Flash was rarely a rational one IMO... and I'll leave it at that...

14:26 technomancy: heh

14:26 justin_smith: _alejandro: iirc if you don't load the swing classes, you won't get that icon

14:26 seancorfield: (I worked on the ActionScript 3 / Flash Player 9 test suite for a few months during a transition in roles)

14:26 justin_smith: maybe I should direct that at andrzejsliwa

14:27 _alejandro: justin_smith: yeah, I think they were looking for how to suppress it

14:27 justin_smith: right, and the trick is to make sure nobody loads the swing classes

14:27 it's some annoying initializer in swing that creates that icon

14:29 _alejandro: justin_smith: although fwiw, I don't get the icon when I run `lein ring server` in one of my apps

14:29 justin_smith: interesting, they may have changed this since I stopped using OSX

14:30 which was a while ago

14:30 andrzejsliwa: in my profile i have only cider-repl

14:30 project is just blank lein repo

14:31 even without project... when running lein icon appear

14:31 johnwalker: is the mozilla public license compatible with clojure libraries?

14:31 andrzejsliwa: on 1.7 and 1.6 everything is fine

14:31 OscarZ: what are the most popular dev tools for clojure nowadays?

14:32 justin_smith: OscarZ: lein is still "the way" to handle deps and set up the classpath

14:33 technomancy: sed is making a comeback

14:33 justin_smith: I think more of us are using emacs than any other editor

14:33 OscarZ: yes, i ment more like editor / ide ..

14:33 _alejandro: OscarZ: emacs + CIDER

14:34 justin_smith: fireplace + vim is popular too (but not as popular)

14:34 OscarZ: i dont like vim :)

14:34 andrzejsliwa: there is lighttable and plugin for intellij, sublime etc

14:34 but true, most people using emacs

14:35 llasram: I don't know that I'd say "most people"

14:35 SagiCZ: ,(def m [{:a 0 :b 1} {:c 5 :d 6}])

14:35 clojurebot: #'sandbox/m

14:36 justin_smith: llasram: more people use emacs than any other single editor I am sure, but I don't know if the emacs usage outnumbers everything else combined - do we have numbers on it?

14:36 SagiCZ: ,(map #(:a %) [{:a 0 :b 1} {:a 5 :b 6}]

14:36 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:36 SagiCZ: ,(map #(:a %) [{:a 0 :b 1} {:a 5 :b 6}])

14:36 clojurebot: (0 5)

14:37 justin_smith: SagiCZ: #(:a %) is the same as :a

14:37 ,(map :a [{:a 0 :b 1} {:a 5 :b 6}])

14:37 clojurebot: (0 5)

14:37 technomancy: llasram: http://cemerick.com/2013/11/18/results-of-the-2013-state-of-clojure-clojurescript-survey/ "more than half" last year

14:37 llasram: Looks like in cemerick's last "State of Clojure" survey, Emacs was just under 50%

14:37 SagiCZ: justin_smith: thank you

14:37 llasram: technomancy: Yeah -- took me a minute to drill down to the actual data, which is over in this "polldaddy" thing

14:37 justin_smith: SagiCZ: np

14:38 technomancy: istr cemerick saying that was the last survey he planned on running

14:38 llasram: Awww

14:38 technomancy: maybe?

14:38 anyway, might be a good time to find a successor

14:38 llasram: We've got a few months

14:39 SagiCZ: is there any catch with map on nested maps?

14:40 justin_smith: llasram: those emacs answers are separated between cider+nrepl, inferior lisp, slime -- if you combine those it edges over 50% using emacs

14:40 SagiCZ: ,(map :a [{:a 0 :b {:x 5 :y 4}} {:a 5 :b {:x 5 :y 4}}])

14:40 clojurebot: (0 5)

14:40 llasram: justin_smith: Oh, my eye glided right over that. Good point

14:41 SagiCZ: What sort of catch would there be?

14:42 SagiCZ: llasram: i dont understand it.. the (map :keyword vector-of-maps) works fine on toy examples but in my case it returnes the whole vector of maps unchanged

14:43 andrzejsliwa: ok I solved problem by:

14:43 export JVM_OPTS="-Dapple.awt.UIElement=true"

14:43 export LEIN_JVM_OPTS=$JVM_OPTS

14:43 justin_smith: SagiCZ: that makes no sense

14:43 SagiCZ: llasram: but (:keyword (first vector-of-maps)) works fine

14:44 llasram: SagiCZ: Then in your non-toy case you have a bug :-)

14:44 SagiCZ: llasram: yup

14:48 ,(map :name [{:name :water :behavior 0} {:name :ice :behavior 2}])

14:48 clojurebot: (:water :ice)

14:48 SagiCZ: wow!

14:48 thats a bug in my repl!

14:48 troydm: how is that a bug?

14:48 SagiCZ: yep.. restarded repl and it works fine now

14:49 i guess i messed up something with my endless experiments :>

14:49 troydm: it was returning something else in my REPL

14:51 llasram: Re-defined `map` somehow maybe?

14:51 ,(let [map {}] (map :whatever [{:whatever :huh?}]))

14:51 clojurebot: [{:whatever :huh?}]

14:51 SagiCZ: llasram: yeah that would be it.. i ignored the warnings!

14:54 is there an easier way to do this?

14:54 (zipmap (map foo1 coll) (map foo2 coll))

14:59 justin_smith: (into {} (map (juxt foo1 foo2) coll))

14:59 llasram: SagiCZ: Maybe (into {} (map (juxt foo1 foo2) coll))

14:59 justin_smith: jinx!

14:59 justin_smith: indeed

15:00 the into version will perform better, for what it's worth

15:00 and I think its a little more clear

15:02 SagiCZ: thanks

15:06 ,m

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

15:39 SagiCZ: can i create anonymous function with variable amount of parameters? like this (#(...?...) can call with some arguments)

15:39 bbloom: ,(#(count %&) 1 2 3)

15:40 clojurebot: 3

15:40 SagiCZ: ,(#(println %&) :hello :this :is :dog)

15:40 clojurebot: (:hello :this :is :dog)\n

15:40 SagiCZ: bbloom: thank you sir

15:40 bbloom: SagiCZ: try apply in that case

15:40 ,(#(apply println %&) :hello :this :is :dog)

15:40 clojurebot: :hello :this :is :dog\n

15:41 bbloom: well, or just use println directly... i guess you were just looking to see what %& was

15:41 SagiCZ: wait what was wrong with my approach

15:41 bbloom: SagiCZ: nothing, ignore me

15:42 SagiCZ: bbloom: ok then

15:43 bbloom: what if someone is passing an argument to my anonymous function but i dont want to use it? #(domystuff (comment %)) ?

15:43 bbloom: SagiCZ: just use fn

15:44 SagiCZ: (fn [&] (do my stuff)) ?

15:45 teslanick: (fn [_] (...))

15:45 bbloom: or (fn [& _] (...))

15:45 teslanick: Underbar is idiomatic for "I don't care what this argument is."

15:45 justin_smith: bbloom's version with & _ takes any number of args, and ignores them all (unless you decide to be silly and use the _ binding)

15:45 SagiCZ: (fn [_] (...)) would accept one parameter only right?

15:46 teslanick: Yes

15:46 SagiCZ: alright thanks :)

15:46 justin_smith: yeah, & _ ignores any number of args

15:46 enn: What is the equality function used to determine set membership?

15:46 justin_smith: enn: =

15:46 enn: justin_smith: thank you

15:46 justin_smith: np

15:47 teslanick: ,(= #{ :enn :justin_smith } #{ :justin_smith :enn })

15:47 clojurebot: true

15:47 justin_smith: ,(contains? #{[1 2 3]} '(1 2 3)) that means that sets do structural equality, like = does

15:47 clojurebot: true

15:47 justin_smith: so things can be equal even if they are not the same class

15:50 amontalenti: I have a situation with lein where running "lein deploy" results in this exception: Error: Could not find or load main class clojure.main // Compilation failed: Subprocess failed. Strangely, if I run "lein compile" and "lein jar" first, then the "lein deploy" succeeds.

15:51 justin_smith: amontalenti: any reason to run lein jar rather than lein uberjar?

15:51 amontalenti: justin_smith, prepping for a clojars deployment, uberjar is not appropriate for that, right?

15:52 justin_smith: oh, right

15:53 how are you invoking lein deploy?

15:53 amontalenti: justin_smith, "lein deploy clojars"

15:54 Fare: hi

15:54 justin_smith: amontalenti: hmm, I use lein push for that

15:54 Fare: in the documentation for defmulti, I see room for only one dispatch function — can I dispatch on multiple arguments, just with one dispatch function?

15:57 oh, the function takes all the parameters, eh?

15:57 tbaldridge: Fare: yes it takes all params

15:58 SagiCZ: hey i need something like "some" but the "conditional function" should take the elements in coll as parameter

15:58 (doc some)

15:58 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

15:58 Fare: how do I deal with [:class1 :class2] hierarchies?

16:00 SagiCZ: ,(some (> 5 %) [2 0 4 9])

16:00 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:01 SagiCZ: ,(some #(> 5 %) [2 0 4 9])

16:01 clojurebot: true

16:01 SagiCZ: i need "9" not true

16:03 samflores: SagiCZ filter

16:03 nullptr: ,(filter #(> 5 %) [2 0 4 9])

16:03 clojurebot: (2 0 4)

16:03 samflores: ,(filter (some #(> % 5) [2 0 4 9]))

16:03 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/filter>

16:03 SagiCZ: ,(first (filter #(> 5 %) [2 0 4 9]))

16:03 clojurebot: 2

16:03 nullptr: ,(filter #(> % 5) [2 0 4 9])

16:03 clojurebot: (9)

16:03 samflores: ,(filter #(> % 5) [2 0 4 9]))

16:04 clojurebot: (9)

16:04 SagiCZ: ,(first (filter #(> % 5) [2 0 4 9]))

16:04 clojurebot: 9

16:04 SagiCZ: this is it

16:04 samflores: yep

16:12 SagiCZ: what if i want to return foo1 if its non-nil and return :default when foo1 returned nil? (def foo [] (foo1) :default)

16:12 arrdem: just wrap the whole thing in an or..

16:12 SagiCZ: duh

16:12 thanks

16:14 justin_smith: SagiCZ: if foo1 is a lookup on a map, get takes an optional third argument

16:14 ,(:foo {:bar 0} :not-here)

16:14 clojurebot: :not-here

16:22 SagiCZ: justin_smith: it wasnt a lookup but i was looking if (filter) can default to something.. forgot about OR

16:23 ,(nil? nil)

16:23 clojurebot: true

16:23 SagiCZ: ,(not-nil? nil)

16:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: not-nil? in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:23 SagiCZ: :(

16:25 justin_smith: ,((comp not nil?) nil)

16:25 clojurebot: false

16:25 justin_smith: (def not-nil? (comp not nil?))

16:25 SagiCZ: yeah.. i actually wanted not-empty but thanks

16:25 ,(= nil [])

16:25 clojurebot: false

16:26 SagiCZ: good to know

16:26 justin_smith: not-empty is seq

16:26 ,(empty? [])

16:26 clojurebot: true

16:26 justin_smith: ,(seq [])

16:26 clojurebot: nil

16:26 justin_smith: ,(seq [1])

16:26 clojurebot: (1)

16:27 SagiCZ: yeah :)

16:27 i finally finished my state machine.. no macros needed

16:27 no trampoline either

16:27 justin_smith: awesome

16:27 what replaces the trampoline, recur?

16:27 SagiCZ: yes

16:27 justin_smith: very nice

16:27 SagiCZ: recur with lookup in map.. it looks up the new function according to keyword the previous function returned

16:27 clojurebot: It's greek to me.

16:28 justin_smith: sounds about right

16:28 SagiCZ: justin_smith: i guess.. i will have to test it a lot.. supposed to control my money

16:31 i guess i should have some function that all the complicated parameters are correct.. should i use the "pre:" asserts for that?

16:33 justin_smith: :pre and :post help with that

16:33 you can also use clojure.test

16:33 eigenlicht: what's the easiest way to go from map => keys and vec => indices?

16:33 justin_smith: and try to figure out good corner cases to test (alongside typical inputs, of course)

16:33 _alejandro: eigenlicht: map -> keys use keys

16:33 justin_smith: eigenlicht: for the former, use keys

16:34 _alejandro: ,(keys {:a 1 :b 2})

16:34 clojurebot: (:b :a)

16:34 eigenlicht: yeah, but keys doesn't work on vectors

16:34 justin_smith: for the latter - maybe (range (count v))

16:34 _alejandro: for the latter, probably range count

16:34 justin_smith: nice

16:34 justin_smith: great minds think alike

16:34 teslanick: ,(range (count [ 1 2 3 ]))

16:34 clojurebot: (0 1 2)

16:34 SagiCZ: justin_smith: will work on that tomorrow, thanks

16:34 eigenlicht: I'm a nooby, what's the easist way to put that in one function? check for type?

16:35 justin_smith: eigenlicht: what is your goal here?

16:35 llasram: eigenlicht: Generally you don't -- you write your function to expect either a map or a vector

16:35 SagiCZ: i like how the experienced users usually come up with almost identical solutions.. i am glad the language isnt nearly as random as it seems to me now :)

16:35 llasram: There's not many circumstances where it's actually reasonable to use either

16:37 eigenlicht: justin_smith: I want to recurse through a nested datastructure which can consist of any collections (maps, vectors, ...) and modify the leaves in a way

16:37 justin_smith: eigenlicht: the first thing that occurs to me is that you want to do something for each index / each key, but you can use map or reduce to do that directly

16:37 teslanick: eigenlicht: Use a zipper.

16:37 llasram: eigenlicht: clojure.walk

16:37 teslanick: Or that

16:38 eigenlicht: I actually do not want to modify it in place, but create a new datastrucuture with same structure - still zippers?

16:38 justin_smith: eigenlicht: we have many nice ways to walk over a collection and do something at each step, starting with the indexes is not likely to be the best approach

16:38 eigenlicht: thats a good thing, because clojure datatypes are immutible

16:38 and you would have either failed, or produced something really evil

16:38 eigenlicht: here's my apporach til now, which doesnt work with vectors: https://www.refheap.com/88526

16:39 teslanick: eigenlicht: You can't modify the code datastructures in place; they're all immutable.

16:39 eigenlicht: it's an abstraction - of course my modifcation is more complex than (str)

16:40 teslanick: A zipper (or walker) will feel like modifying nodes in place but return a new copy when you're done.

16:40 eigenlicht: oh, stupid me. I'm basically transcribing my python code

16:41 I'm still wondering whether that transcription could work. what would I really put in there for (keys) if I wanted to get either keys or indices?

16:41 justin_smith: you could make a multimethod that dispatches on the class of the thing

16:41 _alejandro: you could do a conditional on vec? or something

16:41 justin_smith: but really either a zipper or walk/postwalk will be much easier here

16:41 eigenlicht: so, type checking?

16:42 alright, thanks. checking out zippers later

16:42 arrdem: type dispatch != typechecking

16:42 justin_smith: well, multimethods abstract over typechecking, so you should avoid dispatching on type directly

16:42 maio: is there something like perltidy for clojure? that will format my clojure code according to some standards

16:42 arrdem: maio: TL;DR no

16:42 SagiCZ: maio: clojure.pprint ?

16:43 justin_smith: maio: emacs' indentation rules for clojure are pretty well accepted, and you can run emacs headless theoretically

16:43 _alejandro: maio: arrdem: I wish there were though

16:43 teslanick: Your code should be art! Would you let a robot make art? I think not! ;)

16:43 SagiCZ: teslanick: hey are you robofobic?!

16:43 arrdem: maio: emacs clojure-mode has some minimal support for automatic indentation, but it's not especially bright

16:44 justin_smith: emacs -batch myfile.clj --eval '(indent-region (point-min) (point-max) nil)' -f save-buffer

16:44 SagiCZ: maio: IntelliJ IDEA Cursive indents very well

16:44 justin_smith: the above will work from a command line, if you have emacs installed and it loads clojure-mode proerply

16:44 no need to actually interact with the editor

16:45 arrdem: so you frequently find yourself overriding emacs' indentation choices? or are you talking about where line breaks should go?

16:45 maio: justin_smith: yes I'm using Emacs, but indentation is just one part of the problem

16:46 arrdem: justin_smith: for some stuff like cond I'll format by hand because I like my consequents indented two spaces more than my predicates but for the most part I just use the default indentation and worry about more important things.

16:46 <3 align-cljlet

16:47 _alejandro: arrdem: does your emacs not re-indent after a newline? I end up having my custom indentation screwed up by accident and just get frustrated

16:48 justin_smith: _alejandro: electric return or whatever they call it is a thing you can turn off

16:48 arrdem: _alejandro: the last shop I work at told me, and I quote "turn that shit off" when I asked about whitespace conventions wrt automagic whitespace cleanup and reindent

16:49 _alejandro: justin_smith: yeah, but then don't you have to hit tab after you hit enter?

16:49 justin_smith: but I gave up long ago (before I even started using clojure) on trying to use an indentation policy other than the one my editor can implement (or at least respect)

16:49 _alejandro: or M-h M-w indent-region to align the current defun

16:49 or whatever other method floats your boat

16:49 _alejandro: justin_smith: hmm, may give that a go and turn off the auto

16:51 justin_smith: the M-w is redundant there, really you can do M-h C-M-\

16:51 that selects the entire defun as region, then indents it

16:52 I use auto-indent to find trivial formatting errors (if something indents weird I probably nested something wrong)

16:55 arrdem: I should try that.. I often find that I have one paren too many or too few and cider of late has been really bad about matching buffer lines to errors

16:56 as in jumping two defs down from where the error is bad

16:56 DomKM: Is it possible to test if a type implements a protocol method? Here's what I'm trying to solve: https://www.refheap.com/88529

16:59 _alejandro: DomKM: why do an incomplete extension of the protocol?

17:01 justin_smith: ,(instance? clojure.lang.IFn :a)

17:01 clojurebot: true

17:01 justin_smith: DomKM

17:01 oh, for the specific method coverage, that is another issue entirely

17:01 _alejandro: justin_smith: I don't think that will work if you don't actually implement the entire interface

17:02 DomKM: _alejandro: Because some of the methods are optional but I want to provide default implementations. Function `blah` calls `-blah` if it exists, otherwise does a default thing. The only alternative I can think of is using multiple single-method protocols.

17:02 justin_smith: yeah, I think the solution is to implement it fully

17:02 DomKM: you can use a hash-map to extend a type to a protocol, and merge your custom methods with the map of defaults

17:03 DomKM: example here https://github.com/caribou/caribou-plugin/blob/master/src/caribou/plugin/protocol.clj#L26

17:03 DomKM: justin_smith: I'm not sure what you mean. Is there any example?

17:03 a second too slow to hit enter ;)

17:03 justin_smith: see the definitions of null-implementation and make

17:06 DomKM: another (very ugly) option would be to verify that the protocol is implemented at all, and then catch the IllegalArgumentException. But I don't like that idea.

17:06 DomKM: justin_smith: that extend technique is very clever. Unfortunately, cljs lacks extend and I need this to be portable.

17:06 justin_smith: oh, ouch

17:06 DomKM: justin_smith: yeah I considered trying and catching but I want to avoid that

17:10 akhudek: hah, while trying to write an example to illustrate one error, I find another

17:10 DomKM: so there's really no way to check if a protocol method is implemented? In that case, why is it even possible to partially implement a protocol?

17:10 akhudek: does anyone know waht is wrong with this code?

17:10 https://github.com/akhudek/om-async-error/blob/master/src/om_async_error/core.cljs

17:10 justin_smith: ,(:a 5) DomKM: dunno, same reason you can do keyword lookup on a number?

17:10 akhudek: specifically, as soon as you type into the text box, the dump-chan channel stops working

17:10 clojurebot: nil

17:11 DomKM: justin_smith: looks on objects that arent's associative return nil

17:11 akhudek: you can clone that repository, run cljsbuild, then open index.html to run it locally

17:11 DomKM: justin_smith: it's debatable whether that's a positive or not

17:11 justin_smith: DomKM: right, and extend lets you incompletely implement a protocol

17:11 it's a liberal language

17:12 DomKM: justin_smith: but it currently seems like a type can satisfy a protocol but, when you call the protocol method, it could be missing

17:12 justin_smith: with no way of testing if it's actually implemented

17:20 _alejandro: akhudek: I think it's because dump-chan is not the same after a re-render

17:20 akhudek: probably because of the redefine of chan on 44

17:21 akhudek: so if base's render method gets called again, it makes a new chan and gives it to myform, but myform's willmount method doesn't get called again, so there's nothing listening on the new channel

17:22 akhudek: _alejandro: Ok, that makes sense thanks. I’ve fixed it and managed to reproduce the original bug that was trying to demonstrate.

17:24 _alejandro: would you mind taking a quick look at the actual problem I was trying to reproduce? I have the description in the readme. https://github.com/akhudek/om-async-error

17:24 This particular one can be fixed by making sure that you actually close the channel before toggling the form off

17:25 but I have no idea why it occurs in the first place

17:30 _alejandro: akhudek: looking, but I know very little about Om, so unlikely to be of help

17:35 akhudek: _alejandro: hmm, I think I may have figured it out. I guess unmounting the form doesn’t gc the go block and so subsequent messages to dump-chan alternate between the new go block and the old unmounted one.

17:35 _alejandro: akhudek: interesting. good find

17:35 how do you fix that?

17:36 akhudek: I’m not sure what the best way is at the moment. It’s surprising though, because the style I used here is pretty typical for om applications.

17:36 at least I thought it was

17:36 _alejandro: yeah, sorry I was no help

17:36 if you push the fix, i'd be interested to see it though

17:36 good luck

17:37 akhudek: _alejandro: no worries, thanks for taking the time to look though, sometimes it just helps to have someone to talk over with :-)

18:06 fifosine: ,(map (fn [f] (nth "012" (f 5 3))) '(quot rem))

18:06 clojurebot: #<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 3>

18:06 fifosine: ^ what's wrong with that?

18:07 ,(quot 5 3)

18:07 clojurebot: 1

18:07 fifosine: ,(rem 5 3)

18:07 clojurebot: 2

18:07 Bronsa: ,('quot 5 3)

18:07 clojurebot: 3

18:07 Bronsa: ,('rem 5 3)

18:07 clojurebot: 3

18:07 fifosine: I thought the quot meant "don't evaluate this"?

18:07 *quote

18:07 technomancy: fifosine: it does

18:08 Bronsa: fifosine: right, you're invoking a symbol rather than a function

18:08 fifosine: errr

18:08 ok

18:08 justin_smith: right, so you get the symbol 'quot which when used as a function invokes get which uses its second arg as a default if the value is not found in the first arg

18:08 Bronsa: and when a symbol is invoked it behaves like a get

18:08 so ('foo bar baz) ~ (get bar 'foo baz)

18:08 aperiodic: ,('a '{a :foo} :bar)

18:08 clojurebot: :foo

18:08 technomancy: I wonder if anyone has ever done that intentionally

18:08 aperiodic: ,('a '{b :foo} :bar)

18:08 clojurebot: :bar

18:09 justin_smith: (inc technomancy)

18:09 lazybot: ⇒ 124

18:09 Bronsa: technomancy: yeah I'm not a big fan of symbols-as-functions either

18:09 fifosine: so what I really want is (list quot rem)?

18:10 Bronsa: fifosine: yes, or [quot rem]

18:10 technomancy: huh, I thought I passed 127; has someone been dec'ing me?

18:11 it wasn't one of you, was it? I thought we were pals.

18:11 justin_smith: $karma justin_smith

18:11 lazybot: justin_smith has karma 51.

18:12 justin_smith: $karma so

18:12 lazybot: so has karma -31.

18:14 arrdem: technomancy: how much memory did it eat? I have an Arduino Mega lying around for a post-GSoC hardware project and AVR/Arduino C can suck it.

18:15 {blake}: technomancy, According to lazybot.org your last inc was last Friday from catern, and it raised your karma to 123.

18:16 technomancy: arrdem: it got about 20% of the way into my firmware code before using up all 2.5kb of ram

18:16 {blake}: hmmm... maybe I dreamed it

18:16 arrdem: technomancy: my logs show no instances of dec applied to you evar

18:16 technomancy: arrdem: awww. group hug.

18:17 arrdem: <3

18:17 pls maintain leiningen will give incs

18:17 {blake}: heh

18:19 arrdem: pman and so appear to be the dec whipping boys..

18:19 *pmap

18:19 $karma pmap

18:19 lazybot: pmap has karma -3.

18:20 technomancy: arrdem: how much ram does this board of yours have?

18:21 arrdem: technomancy: 8kb SRAM

18:21 technomancy: luxury!

18:22 arrdem: heh

18:22 just as long as I don't have to dig out a tome on garbage collection and implement it myself..

18:23 technomancy: forth doesn't really have GC

18:23 "just use the stack"

18:24 arrdem: yeah looks like there is no scheme/lua for Arduino, only C or Forth

18:25 technomancy: for AVR, yeah

18:25 there is an ARM arduino

18:25 but it's really overpriced

18:25 akhudek: dang, it turns out I don’t understand om and core.async as well as I thought. :-/

18:25 arrdem: the Beaglebones are the only not overpriced ARM devish boards, and they're out of stock :P

18:26 technomancy: arrdem: the existing forths for AVR work by overwriting the arduino bootloader, which is cool if you aren't planning on using it for anything else

18:26 arrdem: the arduino due is a plaything compared to the beaglebone

18:26 aperiodic: I found a lisp that was advertised to run on AVR ucs once, but it looked like C with parentheses. not at all pleasant to program in

18:26 akhudek: so for this poroblem https://github.com/akhudek/om-async-error/tree/master, there is this fix https://github.com/akhudek/om-async-error/tree/alts-fix, but it doesn’t scale easily for more than one go-block

18:27 arrdem: aperiodic: I designed such a lang not long before I came to clojure... it was never implemented for exactly that reason. C in sexprs doesn't buy you much besides real macros.

18:27 akhudek: and while I know how to fix it, I don’t actually understand why https://github.com/akhudek/om-async-error/tree/chan-opts-bug happens

18:27 it was suggested that it was due to the base component getting rerendered, but that isn’t actually the case

18:28 arrdem: technomancy: hum... really all I'm trying to do is use an xbee for packet radio and a little bit of state machine pin IO so I'll probably just suck it up and write C

18:28 technomancy: arrdem: if you want a reasonable bare-metal arm board, a teensy 3 or one of these would be my recommendation: https://mchck.org/

18:28 arrdem: technomancy: ooh cool I'll check that out

18:29 technomancy: the teensy 3 is more polished but not an oss design. the mchck looks somewhat immature; would require a more adventurous soul.

18:29 arrdem: heh

18:29 technomancy: but looks pretty amazing if it delivers on its goals

18:36 justin_smith: arrdem: beaglebone is awesome

18:46 technomancy: justin_smith: it is, but total overkill for a lot of situations

18:46 especially sensor networks

18:47 justin_smith: yeah, it's true

18:47 that mc hck thing looks pretty cool for small stuff

18:47 technomancy: yeah, I love the idea of something cheap enough that you don't feel bad if you step on it or something

18:48 so far the only things under USD10 I've seen have been attiny-based

18:48 justin_smith: technomancy: http://ebrombaugh.studionebula.com/synth/stm32f4_codec/ I have a few of these in the works for making tiny signal processing boxes (think guitar pedals / modular synth units)

18:48 technomancy: nice

18:49 justin_smith: we ordered the open source pcb board from a manufacturor - ordering like 40 was $10 more compared to getting 4 of them

18:49 the whole thing is free / open designs as much as is feasible, which is cool

18:50 the amazing thing is someone has a scheme to attach desktop ram to the thing...

18:50 which opens up huge opportunities with DSP stuff

18:51 (long delays, complex convolutions for hardware or acoustic space simulation, big sample memory...)

18:52 technomancy: yeah it's weird how the economics of pcbs work

18:52 always sucks if you want just one of anything

18:52 justin_smith: to be sure

18:53 and I wouldn't even be able to play with this except my friend has a pick+place machine, which makes soldering to the board much more reasonable

18:53 http://en.wikipedia.org/wiki/SMT_placement_equipment

18:53 aperiodic: the OSH Park community PCB order is the best thing I've been able to find for small-scale boards

18:55 technomancy: jealous

19:08 FuzzyHarpyBug: Hello! What topics are allowed here?

19:08 justin_smith: FuzzyHarpyBug: clojure is encouraged, but people get away with a lot

19:10 technomancy: no racism, misogyny, spam, or excessive cusses

19:10 FuzzyHarpyBug: Well, since it seems quiet right now...

19:10 Ok, maybe someone here can help me with this question instead. I have root login and password auth disabled for my ubuntu 14.04 server, public key auth only. Is there a way to make just a certain directory accessible with a username and password?

19:10 technomancy: our rules about only allowing Haskell evangelism between the hours of 2300 and 0200 have been temporarily lifted but may be reinstated if the need arises

19:11 scape_: lol

19:11 FuzzyHarpyBug: XD

19:11 Or...

19:12 I need a little help connecting dreamweaver to my apache server. trying to use mod_dav but I have no idea what I'm doing. This is what I've got so far http://pastie.org/9415872 in the apache2.conf file, and http://imgur.com/iDmWXpn in the dreamweaver config.

19:12 scape_: FuzzyHarpyBug, you could install an ACL package, or create a local user account and add it to a group

19:12 Is there a clojure library/method for communicating back and forth with Android/java running threads?

19:12 FuzzyHarpyBug: Don't quite see how that would help though... I have password authentication disabled globally.

19:13 justin_smith: FuzzyHarpyBug: even for local (already logged in) user account login via su?

19:13 scape_: are you sure? the new ssh, I thought, allowed local account login-- disallowed root

19:14 justin_smith: scape_: well, clojure is a java library - do you mean within one vm, between vms, between hosts?

19:14 scape_: within one vm/environment

19:14 FuzzyHarpyBug: justin_smith: No, I can use sudo su and then it asks me for my root password, that works. Initial connection has to be public key auth though.

19:15 scape_: my android activity starts my clojure program, I'd like to be able to spin off a thread on the android side first and communicate with it

19:15 justin_smith: FuzzyHarpyBug: sudo should not be asking for root password, and you can directly use su if you know the pw of the targetted user after login. Maybe I don't understand what you are actually trying to do here.

19:16 augustl: ugh, talking to jdbc directly and building prepared statements by hand was fun until I needed a function that takes either a string or null for a field..

19:16 clojurebot: I don't understand.

19:16 FuzzyHarpyBug: Hmm....

19:17 scape_: why was string a pain? augustl

19:17 justin_smith: scape_: you could use a queue for each side, in order to pass messages back and forth. Or any other standard java inter-thread coordination method

19:17 augustl: scape_: have to either do foo = ? or foo IS NULL and then figure out whether or not to call setInteger on the prepared statement and what not

19:17 boring..

19:18 scape_: okay, just wasn't sure if there was a library out there that handled this

19:18 FuzzyHarpyBug: I'm trying to connect Dreamweaver so I can pull and push files directly. But I don't want anything on the server other than the website files accessible except by keypair auth.

19:18 scape_: FuzzyHarpyBug, what's wrong with ftp?

19:18 FuzzyHarpyBug: At the moment I'm just doing it manually with WinSCP

19:18 can't use ftp without password auth

19:19 justin_smith: scape_: not specifically for java -> clojure ipc that I know of, but look into the API for java.util.concurrent.SynchronousQueue, it effectively is that library and comes with the jvm

19:20 scape_: okay, i've messed with that before. good idea. maybe I'm over thinking it :D

19:20 justin_smith: scape_: just have two queues, each side reads from one and writes to the other

19:21 FuzzyHarpyBug: what about sshfs, using a keypair specific to that user

19:22 that will create a local drive, anything moved to that drive will be scp'd to the remote

19:22 FuzzyHarpyBug: justin_smith: never heard of it... that sounds like it could be useful though.

19:22 justin_smith: https://code.google.com/p/win-sshfs/ windows, right?

19:22 FuzzyHarpyBug: justin_smith: starting yesterday this is the first time i've touched anything linux in over 4 years. lol

19:23 justin_smith: yes, my local machine is Win7 x64, my server is on a ubuntu 14.04 linode vps

19:24 justin_smith: yeah, if your network connection is mostly reliable, sshfs is pretty convenient (as long as you remember that reads and writes will be slow and don't try to use it like a normal disk, of course - since each write is really a server upload, and each read is really a download)

19:25 FuzzyHarpyBug: right, hehe

19:25 actually this looks really really useful...

19:25 hmm

19:25 scape_: good idea justin_smith

19:25 justin_smith: thanks

19:26 arrdem: technomancy: have you done anything with small single sensor wireless nodes?

19:26 FuzzyHarpyBug: problem is I'm carrying the adobe suite and my auth keys around on a flashdrive... i'd rather not have to set this up everytime i sit at a new computer...

19:26 i like to just plug in the drive and go

19:26 arrdem: technomancy: I've been surprised looking at the xbee hardware that it's got enough onboard power that the spec provides for simple remote IO and polling

19:27 technomancy: arrdem: I have not. the beaglebone is the only sensor node I've got, and I used that because I wanted it to be an xmpp bot too.

19:27 arrdem: technomancy: gotcha.

19:27 justin_smith: FuzzyHarpyBug: maybe it would be easier to just use a copy of pscp (from the putty folks) installed to the flash drive

19:27 technomancy: the only real uc projects I've done apart from the keyboards have been silly things with my kids like LED cycling and a clock

19:27 justin_smith: but I dunno, maybe sshfs can install to the flash drive? that seems less likely

19:28 arrdem: justin_smith: I think sshfs is a standalone binary more or less... should be doable

19:28 justin_smith: arrdem: awesome, haven't had to use it outside my home world of linux, so I wasn't sure

19:28 FuzzyHarpyBug: yes, but you'd have to map the drive on every new computer. not too bad i suppose...

19:29 justin_smith: FuzzyHarpyBug: running the binary should map the drive, I don't think there would be much to it

19:29 arrdem: justin_smith: I mean neither have I... better grab `which sshfs` and try running it from somewhere random..

19:29 FuzzyHarpyBug: hmm. ok. i'll try it out

19:29 Thanks!

19:38 augustl: I do a reduce for side effects (jdbc calls). Should I wrap it in doall?

19:39 technomancy: augustl: no

19:41 augustl: I like to have everything with a side effect inside something that says "do" :)

19:41 arrdem: right... but reduce is for accumulating a value

19:41 not for sequential side effects

19:41 doseq dotimes or something else would be a better construct

19:42 technomancy: yeah, if you can separate out your side-effects from your values you should

19:42 augustl: I do care about the return value, though, so I guess reduce makes sense, even though getting the return value requires side effects

19:43 arrdem: meh this is a masturbatory "what is idiomatic" point.

19:44 I'd probably write (->> (reduce) (doall)), I've seen Bronsa write doseq with an atom for the result..

19:44 it doesn't matter.

19:45 augustl: arrdem: yeah my main goal is to communicate intent, and be future proof :)

19:46 as in, is it reasonable to assume that reduce won't be lazy in future clojure releases, or is that unspecified

19:46 arrdem: unspecified and it may be lazy now

19:46 AFAIK

19:46 but this is very poorly documented teritory. ask amalloy, the true magus, for details. I know not.

19:47 Bronsa: I don't think reduce could be lazy

19:47 arrdem: Bronsa: depends on the value...

19:47 (reduce concat) totally can be, but that's lazy on the function not on reduce

19:48 (reduce assoc) not so much

19:48 Bronsa: arrdem: that's like saying that identity can be lazy because (identity (range)) :)

19:48 arrdem: Bronsa: :P

19:48 in Clojure 2.X reduce shall return a delay

19:48 WHAT NOW

19:49 Bronsa: ,(reduce concat (range))

19:49 Raynes: arrdem: excuse me

19:49 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

19:49 augustl: well 2.0 can break anything it wants to ;)

19:49 Bronsa: definitely lazy arrdem

19:50 augustl: do we like (->> coll (reduce ...) (doall)) or (->> col (reduce ...) doall)? :)

19:51 bbloom: augustl: is the result of the reduce a seq?

19:51 augustl: bbloom: no, an int

19:52 and by answering that question I now understand why it makes no sense to think of reduce as lazy

19:52 bbloom: augustl: https://github.com/brandonbloom/transduce

19:52 Bronsa: augustl: also, ##(doall 1)

19:52 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long

19:52 augustl: when would it ever make sense to have a lazy reduce

19:52 bbloom: you can just copy/paste map-state and each

19:52 i guess in theory there could also be an each-state

19:53 but i've found map-state, mapcat-state, and each to all be useful more than a few times

20:06 justin_smith: maybe a lazy reductions?

20:07 well actually yeah, reductions, which is in fact lazy

20:07 so there we go

20:08 ,(last (take 50 (reductions *' (map inc (range)))))

20:08 clojurebot: eval service is offline

20:09 arrdem: when did justin_smith join me on the hellban list..

20:09 justin_smith: must have been very recent, if it happened at all

20:09 quxx: ,4

20:09 clojurebot: eval service is offline

20:10 arrdem: hum

20:10 may actually be down who knows

20:10 justin_smith: &(last (take 50 (reductions *' (map inc (range)))))

20:10 lazybot: ⇒ 30414093201713378043612608166064768844377641568960512000000000000N

20:10 justin_smith: there we go

20:10 nice big number there

20:11 typecheckforwhat: ,(+ 3 3)

20:11 clojurebot: eval service is offline

20:11 arrdem: bot iz dead

20:11 justin_smith: typecheckforwhat: goddammit now I have little john's voice shouting in my head

20:11 :)

20:12 arrdem: justin_smith: you're welcome

20:12 there are 16 words in that entire song..

20:13 justin_smith: fire up your cloud / another round of pull requests / type check for what

20:13 or some shit

20:13 arrdem: 13 distinct words

20:13 if "'nother" != "another"

20:15 justin_smith: &(last (take 1024 (reductions *' (map inc (range)))))

20:15 lazybot: ⇒ 541852879605885728307692194468385473800155396353801344448287027068321061207337660373314098413621458671907918845708980753931994165770187368260454133333721939108367528012764993769768292516937891165755680659663747947314518404886677672556125188694335251213677274521963430... https://www.refheap.com/88534

20:15 justin_smith: haha the number was too big so he had to refheap it

20:16 technomancy: isn't last+take just nth?

20:17 justin_smith: yeah, I was being silly

20:17 gfredericks: can't do nth with ->>

20:18 come on nth why you gotta be like that

20:23 technomancy: functions gonna funk

20:23 or wait

20:23 maybe that was functors

20:26 deathknight: clj-facebook-graph has an example file that is a whole web app that can be run by a lein command. how would I run a specific file in a lein project via lein command?

20:27 said file is in ~/clj-facebook-project-folder/test/clj_facebook_graph/example.clj

20:27 technomancy: deathknight: lein run -m my.ns

20:32 ttasterisco: technomancy: hey, how do the projects that have a checkouts/ folder deal with the version of the project defined in their :dependencies? do they ignore it?

20:33 technomancy: ttasterisco: sort of. the :dependencies version is shadowed on the classpath by the checkout, but it's still there if you know where to look. see for yourself: `lein classpath`

20:39 gfredericks: technomancy: I think functions are functors so presumably they are also gonna funk

20:49 deathknight: technomancy: I'm getting a "can't find 'example.clj' as .class or .clj for lein run: please check the spelling" error

20:50 i'm running the command $ lein run -m example.clj from ~/project-dir/

20:50 ttasterisco: how are people running daemons in clojure? jsvc? is it me or I cant use the same jar to run multiple jsvc-s?

21:37 numberten: has anyone experienced a hanging that arises from exceptions being thrown in a pmap thread?

21:39 justin_smith: $karma pmap

21:39 lazybot: pmap has karma -3.

21:39 justin_smith: pmap is pretty unpopular

21:56 seancorfield: deathknight: based on that folder structure I'd suggest: lein run -m clj-facebook-graph.example

22:08 gfredericks: okay I think I want to make this library I've been imagining for wrapping values & thrown exceptions

22:09 trptcolin: Maybe you should

22:09 get it?

22:10 gfredericks: I think an either joke would be more appropriate

22:10 trptcolin: dangit

22:10 gfredericks: I was going to call it Ether but then I decided it's not quite the either monad

22:10 at least usage-wise

22:11 john2x: reading the core.typed User Guide, and it says "All vars/function params must be annotated". Does this mean all vars/functions in my whole project? (it's an all or nothing thing?)

22:11 justin_smith: I think ether is a better name for a library that makes your program pass out and hallucinate

22:12 gfredericks: justin_smith: I guess probably it redefines some clojure.core function

22:12 ,(alter-var-root #'assoc (constantly dissoc))

22:12 clojurebot: eval service is offline

22:12 gfredericks: yeah I bet it is

22:13 justin_smith: gfredericks: add a lingering headache and you're golden

22:14 seangrove: john2x: Kind of. You can use ^:no-check to tell core.typed to trust you

22:15 gfredericks: I found out yesterday that idris has a function(?) called believe_me

22:16 then I was going to call it handoff but I decided anything based around ball-carriers didn't make as much sense actually either

22:17 haha get it either

22:17 hellofunk: amalloy: I was just reading your response here and have a followup question for you (or anyone): http://www.reddit.com/r/Clojure/comments/1vc0at/clojurescript_gc_and_memory_leaks/

22:17 ah, he's not online

22:18 trptcolin: gfredericks: nailed it

22:18 hellofunk: anyway that reddit refers to this guys' code: http://blog.steveolsen.us/clojurescript-gc-and-memory/ I'm wondering why the issue described by amalloy doesn't also apply to the map function for new-vol in the code

22:19 justin_smith: what was the issue amalloy described?

22:20 hellofunk: justin_smith all noted above in links

22:20 justin_smith: hellofunk: this http://www.reddit.com/r/Clojure/comments/1vc0at/clojurescript_gc_and_memory_leaks/cer0svo ?

22:20 gfredericks: trptcolin: you just hang around #clojure for the occasional pun don't you

22:20 haha get it either

22:21 hellofunk: justin_smith look at the second link I posted from steveolsen.us

22:21 trptcolin: s/#clojure/wherever/g

22:21 hellofunk: http://blog.steveolsen.us/clojurescript-gc-and-memory/

22:21 justin_smith: yeah, that's the link that led me to the reddit post where I saw the thing you were asking amalloy about

22:22 oddly he didn't describe the information that fixed his problem in the blog post

22:26 gfredericks: under my so-far-unused first-random-name-from-wikipedia naming convention I would have to call it Goronwy Roberts

22:27 justin_smith: goronwy is definitely a googlable name

22:28 gfredericks: would have to admit to not knowing how to pronounce my own library's name

22:28 which seems like a win

22:29 justin_smith: http://www.forvo.com/word/goronwy/

22:29 that r tho

22:29 gfredericks: I refuse to listen to that

22:30 I must preserve my innocence

22:30 justin_smith: the origin of the name http://en.wikipedia.org/wiki/Gronw_Pebr

22:30 gfredericks: the fun thing about this naming convention is that you can define success as overtaking the wikipedia article in google search results

22:31 justin_smith: heh

22:31 "argentina at the 1998 winter olympics" is a mouthful of a name for a lib

22:31 gfredericks: no you take the first human name

22:32 justin_smith: stawno would work

22:32 sounds like something you could buy by the bottle

Logging service provided by n01se.net