#clojure logs

2014-07-23

00:01sm0kehow do i type hint return expression from a macro?
00:01Jaood,(let [[a [_ & b]] (split-with #(not= 3 %) [1 2 3 3 5 3 6])] (concat a b))
00:01clojurebot(1 2 3 5 3 ...)
00:02Jaood,(let [[a b] (split-with #(not= 3 %) [1 2 3 3 45 3 6])] (concat a (rest b)))
00:02clojurebot(1 2 3 45 3 ...)
00:02sm0ke(defmacro ^Foo [& b] `(...)) doesnt work
00:03sm0keoh ..(defmacro [&b] (vary-meta `(..) assoc :tag `Foo)) did the trick
00:04sm0keor may be not
00:04ambrosebssm0ke: you might need to wrap in an extra do sometimes (defmacro bar [& body] (with-meta (list* 'do body) {:tag 'Foo}))
00:04justin_smithwell you would need a macro name in there
00:05sm0keambrosebs: (defmacro [&b] (vary-meta `(do ..) assoc :tag `Foo)) would work too?
00:05justin_smithsm0ke: 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.
00:05ambrosebssm0ke: probably
00:06sm0kehurm doesnt help either
00:06sm0keis there something about type hinting inside record methods?
00:08sm0keoh an of course (defmacro [^String s]..) wont work either?
00:08sm0kewhat a mess
00:13sm0keok in a record method doing (foo [this ^String s] ...) just bluntly throws error
00:21nkozoJaood: not really idiomatic I think :): (filter (let [found (atom false)] #(or @found (not (reset! found (= % 3))))) [1 2 3 4 3 5])
00:24Jaoodnkozo: yeah, not idiomatic at all :), my attempt involves using a recursive fn using first, rest, conj
00:25nkozoJaood: the better way is to implement it using lazy-seq
00:25Jaoodnkozo: you first attempt was nice but not sure to call it idiomatic
00:26nkozoit really needs his own function
00:27Jaoodnkozo: https://www.refheap.com/88491
00:28Jaoodfrom the little schemer but wrote before looking at the answer
00:29Jaoodwas looking for an idiomatic version
00:30justin_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
00:30clojurebot(c b a b c ...)
00:32nkozoanother take: https://gist.github.com/anonymous/398e6732cae347d49339
00:33sm0kejustin_smith: i am already too deep in .. only few moreeeeeeeee fileSSAASRRFGGHH
00:34sm0keheh btw how to type hint the `..` macro?
00:35sm0ke(.. a ^String foo bar) doesnt seem to work
00:35justin_smithsm0ke: .. is pretty much replacable with ->
00:35justin_smithand I think people just recommend replacing it nowadays
00:36sm0kehurmm its pretty for use in builder pattern code
00:36sm0kea.foo().bar()
00:36justin_smith(-> a foo bar)
00:37sm0ke(.. a foo bar) vs (->> a .foo .bar)
00:37JaoodI think I'm distracting myself to much with idiomatic versions :P
00:37sm0keJaood: yep it soon turns into idotic versions
00:38justin_smith,(-> "hello" .length .toString)
00:38clojurebot"5"
00:38sm0ke,(.. "hello" length toString)
00:38clojurebot"5"
00:38justin_smithI don't think the -> is that much worse
00:39justin_smithand my original point was that you already figured out how to hint ->
00:41sm0keyep
00:41sm0keagreed
00:42Jaoodpython has so much stuff to get things done - clojure will get there!
00:44justin_smithJaood: clojure makes it possible to use multiple cores efficiently, python will likely never get there
00:46Jaoodnkozo: you are returning a nil value inside the lazyseq on empty collections
00:47Jaoodjustin_smith: yeah, the trade-offs one has to make ;)
00:52nkozoJaood: fixed, https://gist.github.com/nahuel/eb7073d02c0aec6256d2 ... btw, justin_smith version never returns for empty collections
00:52justin_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
00:52clojurebot(b a b a)
00:52justin_smithnkozo: ynx
00:52justin_smith*jynx
00:55amalloyjustin_smith: you don't really want to use & destructuring for building lazy sequences anyway
00:56amalloyyou'll consume more elements than you intend to, because you realize the first element of y even if nobody asks for it
00:56justin_smithoh, right
00:57justin_smiththat's an abuse of when too
00:57amalloywhich is stupid, imo, i wish that ##(let [[x & y] [1]] [x y]) returned [1 ()] instead of [1 nil], but there you have it
00:57lazybot⇒ [1 nil]
01:00amalloyjustin_smith: how is it an abuse of when?
01:01justin_smithreferring to the "when for side effects" discussion that was once perrenial here
02:37blur3dWould 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)
02:40engblomblur3d: 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.
02:40blur3dyeah… it doesn’t sit too well with me
02:41blur3ddo you know of an alternative - even if it means forking the dependancy
02:41blur3dsome kind of register-handler that you can hook into?
02:42nathan7blur3d: I'd clearly state it in internal docs
02:42nathan7blur3d: and do it anyway
02:43blur3dnathan7: yeah, that was the original thinking. Just make sure it was documented clearly
02:44blur3dIt would only have a max of 16 methods extending it, and they would be very project specific
02:44blur3dso it’s unlikely that you would have conflicts
02:45blur3dthe downside is that I don’t think you can remove a multi-method once defined - but again that would be very unlikely
02:46amalloyblur3d: it's something i'd aim to not do, but it's not necessarily a bad thing in every case
02:46amalloywhat library/multimethod is this?
02:47blur3dhttps://github.com/peterschwarz/clj-firmata/blob/develop/src/firmata/core.clj#L181
02:48blur3dIt’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
02:48blur3dor at least it’s done properly
05:09mpenet,(deftype x [^:volatile-mutable a b]) (def y (x. 1 2))
05:09clojurebotsandbox.x
05:10mpenet,(.a y)
05:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: y in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:10mpenetanyone knows what's wrong here?
05:10Glenjamin,(def a) (def b)
05:10mpenetwithout the volatile-mutable metadata it works fine
05:10clojurebot#'sandbox/a
05:10Glenjamin,b
05:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:10Glenjaminyou need a (do) in that first form for the irc repl
05:10mpenetah
05:11mpenet,(do (deftype z [^:volatile-mutable a b]) (let [x (z. 1 2)] (.a x)))
05:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: a for class sandbox.z>
05:11mpenet,(do (deftype z [a b]) (let [x (z. 1 2)] (.a x)))
05:11clojurebot1
05:13mpenetso it makes the field private apparently, I don't think it's documented anywhere
05:15swiHello again :) what good json library for clojure ? clojure/data.json is good one ?
05:15mpenetswi: cheshire
05:16swimpenet: thanks :)
05:17swiso many libs for one task :)
05:20swibtw, where is default :repositories of lein is written ?
05:21chamomileswi: nice ref - http://www.clojure-toolbox.com/
05:22swichamomile: wow, nice! thanks. I'm using http://clojuredocs.org/ right now, but seems they not complete
05:49ddellacostaswi lately folks have been using http://www.arrdem.com/grimoire/
05:49ddellacostaswi: clojuredocs.org is out of date, as you probably noticed
06:04fenrockis 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
06:04fenrocks/why_away/why/
06:20fenrockseems (ns-map 'user) does what i want
06:23rritoch@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.
06:25fenrockit's another clojure function that binds to user, but then vanishes from it after being called. trying to work out why
06:28swiddellacosta: yes, i'v noticed that cljdocs old, is there similar resource for actual version ?
06:28swiddellacosta: oops, sorry, open link and find out :) thanks
06:28ddellacostaswi: :-)
06:29rritochfenrock: 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.
06:29rritochfenrock: But if you also need the Java components you'll need to utilize the classloader
06:30fenrockcheers
06:30ddellacosta&*ns*
06:30lazybot⇒ #<Namespace sandbox5671>
06:30ddellacosta&(map first (ns-publics *ns*))
06:30lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
06:30ddellacostad'oh
06:31ddellacostafenrock: if you want to see public functions in a namespace the above can help ^
06:31ddellacostaor mappings I should say
06:31fenrockthanks ddellacosta
06:36swihm.. is clojure regex know about .* pattern ?
06:36fenrockddellacosta: wow, ns-publics cut the list down to just the stuff i was interested in. magic
06:36ddellacostafenrock: :-)
06:36ddellacostaswi: Regex in Clojure is the same as Java; just check out the Java docs for it.
06:37fenrockisn't there also less excessive back-slashing?
06:37ddellacosta&(re-find #".*" "foo")
06:37lazybot⇒ "foo"
06:38ddellacostafenrock: what do you mean?
06:38fenrockyou don't need to do "\\s", you can do "\s"
06:39fenrock&(re-find #"\shi\sthere" " hi there")
06:39lazybot⇒ " hi there"
06:39ddellacostaswi: 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
06:39ddellacostafenrock: oh yeah, I guess so. Do you need to add extra backslashes in Java for that?
06:40fenrockyes inside regular strings
06:40ddellacostahuh, didn't realize that.
06:40swiddellacosta: thanks, allready there :)
06:40ddellacostaswi: great. :-)
06:42swiyep, re-find works :)
06:42ddellacosta,(println "test")
06:42clojureboteval service is offline
06:43ddellacostadon't know why I bother to check
06:43Glenjamin,:why?
06:43clojurebot:why?
06:43ddellacosta_,:because
06:43clojurebot:because
06:43ddellacosta,:because
06:43clojureboteval service is offline
07:04swii'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 ?
07:08CookedGr1phonswi 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
07:09fenrockswi: 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."
07:10CookedGr1phonbut 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
07:11swiCookedGr1phon: so as i understand no diff, nice clojure do it's smart work and compile it's once :) Good
07:27SagiCZ,(println "quiet in here")
07:27clojurebotquiet in here\n
07:32madscientist`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
07:37vijaykiranmadscientist`: what is "this" in this context? is it something you are constructing ?
07:39madscientist`vijaykiran: I suppose it is the class context
07:40madscientist`the line is in a private method (not a constructor)
07:44vijaykiranmadscientist`: If you are calling the method - then you can create a proxy for the interface this
07:55madscientist`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
08:06vijaykiranmadscientist`: https://code.google.com/p/jdiameter/source/browse/core/jdiameter/api/src/main/java/org/jdiameter/api/NetworkReqListener.java
08:07vijaykiranmadscientist`: so you can create an instance/proxy with the processRequest method and pass it as this
08:07madscientist`vijaykiran: figured that out myself too, thanks for the help
08:27CookedGr1phonIs 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
08:27CookedGr1phonwhich states that every instruction where the monitorenter count > 0 should be within a catch all block
08:47agarmananyone have opinions on http://docs.paralleluniverse.co/pulsar/
08:53hcumberdaleHi there :)
08:54hcumberdaleHow 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?
08:55Glenjaminhcumberdale: you can use an explicit accumulator in the loop
08:55Glenjamin,(loop [a 10 acc nil] (if (zero? a) acc (recur (dec a) (conj acc a)))
08:55clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
08:56Glenjamin)
08:56Glenjamin,(loop [a 10 acc nil] (if (zero? a) acc (recur (dec a) (conj acc a))))
08:56clojurebot(1 2 3 4 5 ...)
08:56hcumberdalethat will be the same as adding the accumulator to the fn def and not using loop right?
08:57Glenjaminyeah, but then you either need to make it a required param, or have a multi-arity function
08:58hcumberdaleWhen not working with numbers and instead with list parameters, is there a shorter form for: if-let [next-node (first nodeset)] .... (recur .... (rest nodeset))?
09:01Glenjamin,(let [[head & tail] [1 2 3 4]] [head tail])
09:01clojurebot[1 (2 3 4)]
09:01Glenjamindoes that help?
09:01Glenjaminthere's probably some gotchas around destructuring vs (rest) vs (next), but i don't recall what they are
09:02tvanhensdoes anyone have any pallet experience with aws?
09:02hcumberdaleahh okay! thx
09:03hyPiRionhcumberdale: that looks like some pattern which can be transformed to use `map`, `filter` or `reduce`
09:04hyPiRioneither way, I tend to do destructuring in the binding for those things
09:05hyPiRion,(loop [acc () [f & r] [1 2 3 4 5]] (if f (recur (conj acc f) r) acc))
09:06clojurebot(5 4 3 2 1)
09:07chamomile,(str "test")
09:07clojurebot"test"
09:07chamomilenice
09:08yogsotothHi! 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.
09:09yogsotoththe type of body is class org.eclipse.jetty.server.HttpInput but I don't really know how to export the string out of it.
09:10yogsotothI don't use any middleware
09:11yogsotothCan anyone could help me? I am stuck for some time now.
09:11yogsotothMy google fu is weak.
09:11drbobbeatyyogsototh: 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))] ...)
09:12drbobbeatyyogsototh: Where I'm using the cheshire JSON parsing library :as json.
09:12yogsotothdrbobbeaty: thanks, I'll try it.
09:12jonasenI 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?
09:12drbobbeatyyogsototh:Good luck
09:13swiI dont understand http://paste.debian.net/111199/ what the difference ?
09:17augustlswi: nothing, it seems
09:18swiaugustl: than i dont understand macros, seems :)
09:19augustlswi: is there a difference?
09:20swiaugustl: in my point of view there is no diff. so i dont understand for what macros is :(
09:22yogsotothdrbobbeaty: I found a way somehow! Thanks! The problem was certainly that slurp was called before. Resulting in an empty string the next call.
09:22drbobbeatyyogsototh: Glad you got it working! :)
09:23augustlswi: well, the macro just returns the same code as the function
09:23augustlswi: so using that macro to understand macros might be a bit difficult since the macro doesn't provide any value :)
09:23michaelr525hey
09:23augustlswi: so, it's possible to create a macro that doesn't really do anything
09:27swiaugustl: doesnt' provide value ? return value not the same ?
09:29augustlswi: doesn't provide value as in value to a programmer :)
09:29augustlit doesn't do anything useful
09:30swiaugustl: seems like i need to read about macros again :) right from begining :)
09:31hyPiRionswi: The only thing it does is inlining the form, but that's compiler work anyway.
09:32hyPiRionsee -> or ->> instead on more valuable macros
09:32swihyPiRion: thanks, i will :)
09:39xsyncan I map juxt over a seq?
09:39justin_smith,(map (juxt inc dec) (range 10))
09:39clojurebot([1 -1] [2 0] [3 1] [4 2] [5 3] ...)
09:40xsynsweet
09:40hyPiRionyou can mapcat it too
09:48SagiCZany simple way to convert keyword to a symbol?
09:48boxed,(symbol (name :foo))
09:48clojurebotfoo
09:49boxedI think that’s right anyway :P
09:49SagiCZthanks
09:49SagiCZ,(symbol (name (def red :meat)))
09:49clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>
09:51jcromartieis this up to date? https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments
09:52boxed,(def red :meat)(symbol (name red))
09:52clojurebot#'sandbox/red
09:54justin_smithboxed: you need do
09:54boxedah
09:54justin_smith,(do (def red :meat) (symbol (name red)))
09:54clojurebotmeat
09:54justin_smith,(+ 1 1) (/ 1 0) all this invalid stuff is ignored (System/exit 0)
09:54clojurebot2
09:55boxedthat’s a bit awkward
09:56hyPiRionboxed: it's just the bot, not clojure itself
09:57boxedyea I get that, but it’s a bit awkward when trying to show stuff
09:57SagiCZ,{:red :meat :tasty :stuff}
09:57clojurebot{:tasty :stuff, :red :meat}
09:57boxedmaybe an implicit do around it would have been nice
09:58SagiCZguys.. what do i need this @ for when writing macros? i dont understand what splicing is
09:58Glenjamin,`(list ~@[1 2 3])
09:58clojurebot(clojure.core/list 1 2 3)
09:59Glenjamin,`(list ~[1 2 3])
09:59clojurebot(clojure.core/list [1 2 3])
09:59Glenjaminit unpacks one level of collection
09:59justin_smith,`(1 2 3 ~@(range 4 8))
09:59clojurebot(1 2 3 4 5 ...)
10:00hyPiRionSagiCZ: Assume you pass ((println 10 20) (println 40 50)) and want to evaluate it. How do you do so?
10:00SagiCZusing @?
10:00SagiCZi think i get it
10:01hyPiRionright, you can do ##(let [a '((println 10 20) (println 40 50))] `(do ~@a))
10:01lazybot⇒ (do (println 10 20) (println 40 50))
10:01SagiCZdoes it unpack map too?
10:01SagiCZ ,`(list ~@{:red :meat :tasty :stuff)
10:01clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
10:01SagiCZ,`(list ~@{:red :meat :tasty :stuff})
10:01clojurebot(clojure.core/list [:tasty :stuff] [:red :meat])
10:02SagiCZO.o
10:02boxedI guess the answer is “yes, but…” :P
10:02hyPiRionSagiCZ: @ calls seq on its input
10:02hyPiRion,(seq {:red :meat :tasty :stuff})
10:02clojurebot([:tasty :stuff] [:red :meat])
10:02SagiCZalright. i see
10:04SagiCZlets say i pass a map to a macro, and i want to use one of its values..
10:04SagiCZi would do... `(~passed-in-map :desired-keyword) .. right? it puts there the whole map for some reason
10:04hyPiRionright, that's correct
10:04swihmmm... do i need to place function from top to bottom in .clj file to bottom ones can use top one ?
10:05justin_smithswi: you can also use declare
10:05justin_smith(doc declare)
10:05clojurebot"([& names]); defs the supplied var names with no bindings, useful for making forward declarations."
10:05swijustin_smith: thanks
10:06justin_smith(declare foo) (defn bar [] (use foo somehow ...)) (defn foo ...)
10:06justin_smithsomething like that
10:06swilike a func declaration on .h in C :)
10:06justin_smithvery similar
10:06swigot it :)
10:11jcromartieso is the REPL broken in the latest ClojureScript or something?
10:11jcromartieI can't get this to work
10:11jcromartieI can connect
10:11jcromartiebut nothing evaluates and comes back
10:11jcromartiemy ClojureScript compiles successfully
10:12jcromartieand when I run "lein trampoline cljsbuild repl-listen" and open my app in the browser, it seems to connect
10:12jcromartiebut there is no communication beyond that
10:13jcromartiehm
10:13jcromartiemaybe I'm wrong… the ClojureScript REPL shows a prompt before it's connected
10:13jcromartieso that's kind of misleading
10:15boxedjcromartie: no warnings during compile?
10:15jcromartieno
10:16boxedjust making sure because mostly “warnings” in cljs are really super critical errors :P
10:16jcromartiehm, seems my repl namespace is not compiled, d'oh… the file wasn't saved because I never M-x make-directory'ed
10:17SagiCZ,(for [[vec] [[1 2 3] [4 5 6]]] vec)
10:17clojurebot(1 4)
10:17SagiCZwhat happened here
10:18jcromartieSagiCZ: you destructured the first element of each vector in the parent vector
10:18justin_smithSagiCZ: you destructured to get the first element of each vector
10:18llasramSagiCZ: Your binding from is `[vec]`, which uses destructuring to get just the first element of each
10:18llasramheh
10:18SagiCZi wanted to destructure it but it get just the first element of each?
10:19justin_smithoh man, I wonder what the record is for "simuiltanious same answer" on this channel
10:19justin_smithSagiCZ: I don't know if you wanted to, but that is what you did
10:19llasramSagiCZ: If I understand you correctly, you want `vec` instead of `[vec]`
10:19SagiCZi really just wanted to see if destructuring works in for
10:19john2xhow do I re-use the value returned by the previous expression in the repl?
10:19jcromartiejohn2x: *1
10:19justin_smithjohn2x: 81
10:19llasramAside -- I'd suggest not using a common core function name like `vec` as a local
10:20justin_smitherr, mis-shift, it's *1 of course
10:20SagiCZ2llasram: thanks, good idea
10:20teslanickSagiCZ: Of course it does. Anything that has a binding form supports destructuring.
10:20jcromartie,(for [v [[1 2 3] [4 5 6]]] v)
10:20clojurebot([1 2 3] [4 5 6])
10:20SagiCZ2teslanick: ok :)
10:20jcromartieok
10:20llasramSagiCZ: What's with the `2`s?
10:20justin_smith,(for [[a b c] [[1 2 3] [4 5 6]]] b)
10:20clojurebot(2 5)
10:20john2xthanks!
10:20justin_smithllasram: he hates client nick highlighting, and wants to prevent it, is my best guess
10:21SagiCZllasram: 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:21SagiCZso thanks for having difficult nicks!
10:22Glenjaminsag[tab]
10:22Glenjamingenerally clients will expand nicks when you hit tab
10:22SagiCZGlenjamin: ................................ ok that works
10:22justin_smithSagiCZ: 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_alejandroWhat do most people use as their irc clients? Emacs?
10:22SagiCZjustin_smith: i see..
10:22SagiCZi use Pidgin
10:23llasramSagiCZ: 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:23SagiCZGlenjamin: thanks really, you are a life saver
10:23llasraminformally even
10:23SagiCZllasram: so are people bothered by multiple dialogs going at once? is it better to take that private?
10:24nullptrERC 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:24llasramSagiCZ: Nope
10:24llasramThe cross-conversation noise is part of the fun
10:24SagiCZnullptr: yep it works! yay
10:25boxedSagiCZ: it’s also a good idea to read what other people are talking about, it spreads knowledge and broadens input
10:25SagiCZboxed: yeah i am trying to keep up
10:26boxedSagiCZ: 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:27SagiCZboxed: yeah but chat is a little less annoying than friends trying to yell over each other
10:27SagiCZi 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:28justin_smith,(apply concat (seq {:a 0 :b 1 :c 2}))
10:28clojurebot(:c 2 :b 1 :a ...)
10:28justin_smithoh, value first
10:28joegallo,(apply concat (map reverse {:a 1 :b 2}))
10:28clojurebot(2 :b 1 :a)
10:28justin_smith,(mapcat reverse (seq {:a 0 :b 1 :c 2}))
10:28clojurebot(2 :c 1 :b 0 ...)
10:28_alejandro,(map reverse (seq {:a 0 :b 1 :c 2}))
10:28clojurebot((2 :c) (1 :b) (0 :a))
10:29hyPiRionall these reverse things, hrm.
10:29joegallo,(mapcat reverse {:a 0 :b 1 :c 2}) ; no need for the seq, right?
10:29clojurebot(2 :c 1 :b 0 ...)
10:29SagiCZthats what i want
10:29SagiCZwhat solution is best? :D
10:29justin_smithjoegallo: right, I needed it for concat, and I had just up-arrowed and edited
10:29boxed,(for [[k v] (seq {:a 1, :b 2})] [v k])
10:29clojurebot([2 :b] [1 :a])
10:29hyPiRion(interleave (keys coll) (vals coll))
10:29joegallojustin_smith: ah, yeah, i see that now
10:29boxedI find that more readable as a python coder :P
10:30swidamn.. cheshire spit exception on crappy json :( i hate people that give craped json format :( Things like that is for try/except ?
10:30justin_smithjoegallo: oh wait, I didn't need it there either :)
10:30jcromartieheh ClojureScript is a whole new beast huh
10:30joegallohuh, how about that
10:30SagiCZ,(do (def m {:a 0 :b 1}) (interleave (keys m) (vals m)))
10:30clojurebot(:b 1 :a 0)
10:30irctcI'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:30SagiCZ,(do (def m {:a 0 :b 1}) (interleave (vals m) (keys m)))
10:30clojurebot(1 :b 0 :a)
10:31SagiCZboxed: right, it really is more readable
10:31hyPiRionyeah, I flipped the order of keys and vals. Whoops.
10:31justin_smithswi: but try/catch won't let you access the partially evaluated json
10:33stuartsierrairctc: `doall` at line 25 is redundant.
10:33stuartsierra`doseq` forces evaluation and always returns nil
10:33irctcstuartsieera: yeah I was getting frustrated and trying random things :(
10:34stuartsierrairctc: I don't see anything obviously wrong with that code snippet, except that you never close the input stream.
10:34irctcstuartsierra: 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:35swijustin_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:36stuartsierrairctc: I don't know, then. Maybe a timeout or maximum somewhere in the postgres driver.
10:36justin_smithswi: 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:37irctcstuartsierra: alright, thanks for looking
10:38swijustin_smith: i see.
10:39swibut, how can this http://paste.debian.net/111225/ can lead to " Unexpected character ('}' (code 125)): was expecting double-quote to start field" ?
10:40stuartsierraAny 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:42xsynSay I've got a collection of maps
10:42xsynhow do I remove those maps that have a nil id
10:42xsynso
10:42xsyn({id: 1} {:id nil})
10:43xsynI want ({:id 1}
10:43xsyn?
10:43xsynI've tried remove nil?
10:43justin_smith,(filter :id '({:id 1} {:id nil} {:id 2}))
10:43clojurebot({:id 1} {:id 2})
10:44xsynand I can pass filder a vector of keywords
10:44xsynyay
10:44xsynthanks
10:44justin_smiththat would also remove things that just didn't have an :id key at all
10:44mping_anyone uses liberator ?
10:44justin_smithyou need an actual predicate if you want something more specific (but non-nil :id of course amounts to :id)
10:44mping_having trouble tracing the requests
10:44john2xis it possible to specify a Schema to a function's return value? or do I need core.typed for that?
10:45SagiCZhow do i convert this (:a :b :c) to this :a :b :c
10:45justin_smithSagiCZ: in what context?
10:45xsynjustin_smith: magic thank you
10:46SagiCZi need for to spit out single things, not join them into list
10:46justin_smithjohn2x: maybe a post condition if you want to throw an assertion error if the structure is invalid at runtime
10:46justin_smithSagiCZ: you can only have a single return value from a given form
10:46justin_smiththough you can use concat / mapcat to do a layer of flattening if you need that
10:46SagiCZjustin_smith: no way to solve that then?
10:47boxed,(flatten [[1 2] [3 4]])
10:47clojurebot(1 2 3 4)
10:47justin_smithlike I said, if you are producing a collection, you can remove a layer of structure
10:47justin_smith~flatten
10:47clojurebotflatten 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:47justin_smithboxed: better to use apply concat, or mapcat
10:48SagiCZjustin_smith: gee i just feel i am doing more things wrong than correct in clojure
10:48boxedbetter why?
10:48justin_smithboxed: read what clojurebot said above
10:48justin_smithflatten destroys structure
10:48SagiCZ,(concat (:a :b :c))
10:48clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
10:48SagiCZ,(concat '(:a :b :c))
10:48clojurebot(:a :b :c)
10:48SagiCZdidnt remove any layer
10:49swiHehe, can someone look at my first clojure crap code and say why it's all wrong ? :)
10:50SagiCZswi: yeah i would stand behind you in that line
10:50llasramswi: refheap/gist something up and I'd be haappy to comment
10:51llasramAs I'm sure would others
10:51swihttp://paste.debian.net/111228/ :D
10:51SagiCZjustin_smith: flatten did what i wanted in this case
10:51llasramNot one of the suggested paste sites. Rejected.
10:51llasram(j/k)
10:51swiok
10:51llasramJoking joking!
10:52swihttps://www.refheap.com/88510 is it better ?
10:52xsyn*chuckle*
10:52llasramWell... the syntax highlighting is more familiar, and thus more soothing
10:52SagiCZswi: keep the closing parenthesees on the same line in getQuotes.. neat right? :)
10:53llasramswi: Yeah, so trivial level -- standard formatting places parens on the same line as the closing paren of the terminal form
10:54llasramswi: And naming convention using kebob-case (aka levitating-snake-case) vs javaCamelCase
10:54john2xswi: was just reading this earlier https://github.com/bbatsov/clojure-style-guide
10:54swiin fact it's haskelNameingCase in my situation, never learn java
10:55SagiCZllasram: levitating snake case.. :D
10:55john2xhmm i guess I'll try out core.typed tomorrow, see how it feels vs Schema.
10:57llasramswi: 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:58SagiCZWhat does this mean? "Can't use qualified name as parameter: user/something"
10:59justin_smithSagiCZ: note that I said (apply concat ...) not just concat
10:59justin_smithor mapcat instead of map
10:59llasramswi: 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:59mthvedtsagicz: usually means you’re syntax-quoting something that you didn’t want to syntax quote
10:59swillasram: i knew that i would be trying to imperate this :D
11:01swillasram: you mean doseq at :50 ? cause at :25 it's a copy-paste from http-kit docs
11:05SagiCZ,(cond #(%) :form)
11:05clojurebot:form
11:05SagiCZwhat gets pasted as the parameter to the function?
11:05justin_smithSagiCZ: that function never gets called
11:06SagiCZjustin_smith: what if i want a function that returns true or false as a result of some complicated test?
11:06justin_smith,(cond "anything" :form)
11:06clojurebot:form
11:06teslanickThe last form of cond will always evaluate because there are no conditional statements.
11:06justin_smithSagiCZ: than call it
11:06SagiCZ,(cond (#(%)) :form)
11:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval77/fn--78>
11:07SagiCZ,(cond (#(false)) :form)
11:07clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
11:07justin_smithSagiCZ: what are you trying to do?
11:08SagiCZjustin_smith: i am writing this complicated macro and i dont thing it was a good idea in the beginning.
11:08justin_smith,(cond (> 0 1) :wat (> 1 0) :OK)
11:08clojurebot:OK
11:08teslanickThe first rule of macro club is don't write macros.
11:08SagiCZjustin_smith: i am almost done, i will paste it and maybe you can have a quick glance
11:09justin_smithSagiCZ: if you are trying to write a macro, I hope you at least know about macroexpand
11:09teslanickI had a problem in clojure and thought to write a macro. Now I have ~@problems.
11:11llasramswi: 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:11SagiCZjustin_smith: yeah i do know that :]
11:11llasramswi: Also, you don't need the `doall` in `getQuotes` -- randomly de-lazing sequences is not a good habit to get into
11:12swillasram: but getting from http and println - it's sideeffect, doesn it ?
11:13llasramGETing 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:13llasrams,result of,response to,
11:14llasramThe `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:15llasram(Or made use of Clojure's impurity to debugging print/log things at intermediate points while still yielding values functionally)
11:15SagiCZso 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:15SagiCZthe macro is almost done, but the last bits when putting together the conditionals are too hard for me
11:15SagiCZhttps://www.refheap.com/88516
11:16swillasram: 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:16llasramswi: That'd be the style I'd advocate, yes
11:16llasramIt's easier to extend if you keep as much of your program as possible written in a functional style
11:17SagiCZjustin_smith: pasted the macro above
11:18justin_smithSagiCZ: you may want to consider condp instead of cond
11:18justin_smith(doc condp)
11:18clojurebot"([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:19SagiCZ(doc-for-simple-people condp)
11:19justin_smith,(condp > 1 0 :wat 1 :umm 2 :OK 3 :huh)
11:19clojurebot:OK
11:20swiem... seems like need to rest, can even figure out how to do print loop :D
11:20justin_smithit's harder to read as a one liner, the first two args are special, the rest are taken as pairs
11:20swis/can/can't/
11:20justin_smithSagiCZ: so in your cace (condp = cmd :condensation (water r) :depositation (ice r) ...
11:21SagiCZjustin_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:21justin_smiththough I think it would require taking some stuff out of the cond
11:21justin_smithOK
11:21SagiCZso i want to pass a function that computes a boolean value, if the transition is possible
11:22swillasram: thanks a lot for help :)
11:22clojurebotHuh?
11:22justin_smithSagiCZ: well, for future reference, you can make repetitive cond blocks clearer with condp sometimes
11:22llasramswi: np!
11:22SagiCZjustin_smith: yeah it seems handy
11:23justin_smithSagiCZ: so what is it in the definition of fsm that requires it to be a macro?
11:25justin_smithSagiCZ: in the macroexpansion, you have things like [[user/cmd & user/r]]
11:26justin_smiththis is something ` does, for heigene, but it messes up the creation of local bindings
11:26justin_smithare you sure you want to use syntax quote on the binding vector, and not just normal quote?
11:28justin_smithsimilar issue with commands in the top level fn
11:29justin_smithwhat you may want is commands#
11:29justin_smithwhich is a shortcut for using gensym to make a binding
11:33llasramI'm pretty sure they don't actually want a macro
11:34justin_smithllasram: yeah, that was my suspicion as well
11:34justin_smithit is clearly a learning exercise
11:35Glenjaminhttp://www.shouldthisbeamacro.com/
11:35justin_smithheh
11:35justin_smith<h1>NO</h1>
11:36Glenjaminls
11:36lazybotbin boot etc home lib lib64 media root run srv sys tmp usr
11:36Glenjaminmy favourite bot joke
11:36justin_smithls
11:36lazybotboot etc home lib64 media mnt opt proc run sbin srv tmp usr var
11:36justin_smithit also really calls ls, and returns a random selection of the output
11:37SagiCZjustin_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:37justin_smithhttps://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/unix_jokes.clj
11:37justin_smithSagiCZ: then write a working function first, then make the syntax macro call that function
11:37justin_smithit's much easier that way
11:38justin_smiththe syntax alteration and the functionality are two separate concerns, it's easier to address one at a time
11:38SagiCZjustin_smith: oh like that! i see what you mean.. so there is no reason to do anything else in macro than syntax alteration
11:38justin_smithright
11:39SagiCZthanks
11:39mthvedtpwd
11:39lazybot#clojure
11:40justin_smithmutt
11:40lazybotWoof!
11:40justin_smithlol
11:40justin_smithecho ,(+ 1 1)
11:40lazybot,(+ 1 1)
11:40clojurebot2
11:40justin_smithROFL
11:40justin_smiththe bots used to ignore one another...
11:41nobodyzzzls ect
11:41lazybotbin boot dev etc lib64 lost+found media mnt run sbin srv tmp var
11:41nobodyzzzls etc
11:41lazybothome lib lost+found media proc run srv sys tmp var
11:41SagiCZecho ,(println "hoe")
11:41lazybot,(println "hoe")
11:41clojurebothoe\n
11:41nobodyzzzls etc/home
11:41lazybotbin boot etc home lib lib64 lost+found media opt proc run srv usr var
11:41mthvedtecho ,(println “mutt”)
11:41lazybot,(println “mutt”)
11:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “mutt” in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:41nobodyzzzls home
11:41lazybotbin boot etc home lib mnt proc root run sbin srv tmp
11:41mthvedtboo
11:41mthvedtthat doesn’t even make sense
11:41swiGoodbye :)
11:42justin_smithnobodyzzz: you can see from the source I pasted, it ignores the args to ls
11:42justin_smithmthvedt: why did you feed "smartquotes" to the bot?
11:42llasramSagiCZ: For what you're trying to do, I believe you can get the same effect more clearly by just using higher-order functions
11:42justin_smithecho ,(println "mutt")
11:42lazybot,(println "mutt")
11:42clojurebotmutt\n
11:42nobodyzzzecho nice
11:42lazybotnice
11:42justin_smithecho ,(print "mutt")
11:42lazybot,(print "mutt")
11:42clojurebotmutt
11:42justin_smithoh, the final step of the recursion is missing
11:43llasramI think the bots ignore each other after... gfredericks? hyPiRion? figured out that cross-bot mutual quine
11:43llasramOr rather, lazybot ignores clojurebot bot
11:43mthvedtdang, that was going to be my next suggestion
11:43justin_smithllasram: right, but I just make lazybot trigger clojurebot
11:43justin_smithI thought it was a mutual ignore too, clearly it is just one way
11:45gfredericksokay okay okay so transit
11:46gfrederickshas some edge-case ambiguity wrt json interpretation?
11:46gfredericksdid anybody ask about this yet?
11:50gfredericksrhickey said that "all json is valid transit"; and I can't see how that isn't an ambiguity
11:51justin_smithgfredericks: got an example somewhere?
11:51Glenjaminthat doesn't seem strictly true
11:51gfredericksjustin_smith: no, I haven't played with it yet, it just seems logically necessary if you're encoding one thing as another
11:51Glenjaminwell, i guess {"a": "~a"} is still valid transit, but it's not very useful
11:51Glenjaminsince the transit meaning differs from the json meaning
11:53gfredericksif my json happens to look like transit, it'll get processed differently by accident
11:53gfredericksprobably an expedient compromise and not likely to be a problem, I just wanted to make sure I understood
11:53SagiCZllasram: what do you mean by using higher-order functions? you mean disregard the whole machine function?
11:56justin_smithSagiCZ: btw, one of the more awesome things in clojure is a massive macro wrapping a state machine: core.async
11:56bbloomCookedGr1phon: did writing your own `locking macro fix it?
11:57llasramSagiCZ: 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:57llasramSagiCZ: 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:58llasramSagiCZ: `fsm` itself then just returns the function composing those state-functions into the final state-machine
11:58SagiCZllasram: " calling a function which itself returns accepts the state-description and returns a function for that state"
11:59SagiCZllasram: ?
11:59llasramer, remove "itself returns"
11:59benkay<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:00benkayalso because - hey, that's a neat standard for "is your stack lightweight?": build and run app on micro
12:00SagiCZllasram: would i still need trampoline then?
12:01benkaythis micro is now running postgres, docker, datomic, the app uberjar and occasionally falls over when building new uberjars.
12:01justin_smithbenkay: I either use jenkins on a dedicated box, or just build locally
12:01CookedGr1phonbbloom: sort of, moving the monitor-enter outside the try block seems to have fixed it in some instances, but others are still failing
12:01benkayso i think it's reasonably lightweight.
12:01benkayjustin_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:01H4nsi 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:01CookedGr1phonbbloom: 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:02justin_smithI don't know, there isn't much reasonably lightweight about clojure compared to anything else i have used seriously
12:02H4nss/message/question/, sorry
12:02benkayjustin_smith: tell me about it.
12:02benkayi still can't use clojure for scripting :(
12:02justin_smithH4ns: (import long.class name) name/FIELD_NAME
12:03H4nsjustin_smith: thank you!
12:03bbloomCookedGr1phon: i'd file an issue here: https://code.google.com/p/android/issues/list be sure to include the generated byte code
12:03llasramSagiCZ: 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:05justin_smithH4ns: correcting myself: (import java.io.File) not (import java.io File)
12:05SagiCZllasram: I will try to do that
12:05justin_smiththe former works
12:05H4nsjustin_smith: it was the "import" bit that i was missing, i've figured out how to put it into my ns declaration. thanks!
12:05justin_smithnp
12:05SagiCZ,(+ 2 5)
12:05clojurebot7
12:05justin_smithyou can also use :import in the ns form
12:05SagiCZ,(println "hot dog")
12:05clojurebothot dog\n
12:06H4nsjustin_smith: that's what i do now :)
12:06justin_smithH4ns: ahh, and my invalid syntax is actually usable for the ns form, if you look at (doc ns)
12:06justin_smith(doc ns)
12:06clojurebot"([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:06justin_smith$doc ns
12:09llasram,(import '[java.io File])
12:09clojurebotjava.io.File
12:10clgv&(doc ns)
12:10lazybot⇒ "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:12justin_smith(inc clgv)
12:12lazybot⇒ 24
12:12justin_smiththat's what I wanted
12:13justin_smith(inc llasram)
12:13lazybot⇒ 28
12:13justin_smithand that too
12:13seangroveI can't seem to get xml-zip and xml-> to work
12:14seangrove(xml-filter/xml-> (zip/xml-zip (:response rr)) (xml-filter/tag= :Envelope)) => ()
12:14clgv:)
12:14seangroveJust looking to see if that looks like the vaguely correct syntax
12:15devnAnyone here have any Azul experience?
12:16devnSpecifically, Zing.
12:18justin_smithdevn: 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:18devnheh
12:19justin_smithin all seriousness, I know nothing about azul zing
12:19devnIt sounds cool. I remember Rich talking about running his ants simulation on one of the Azul systems.
12:20devnWhich makes me curious to know whether that required Zing
12:22jgtHello everyone
12:22jgtI’m new to Clojure, and was tinkering with the language; writing some small functions, etc.
12:23jgtand I’m wondering, why does my cond example work, but my case example does not? http://pastebin.com/P8mZFW7d
12:24llasramjgt: The case dispatch values are unevaluted Clojure literals
12:24llasramSo that case statement is using the *symbols*, not the classes they resolve to
12:26jgtllasram: Should I use condp instead?
12:26jgtlooks as though condp does evaluation
12:26llasramjgt: condp instance? is probably better, for a few reasons
12:27llasramIt'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:28hiredmanllasram: I think that may not be as common as you think
12:29llasramjgt: Mine http://blog.platypope.org/2011/10/15/clojure-case-is-not-for-you/ which include a link to cemerick's
12:29llasramhiredman: I use it relatively frequently for dispatching on e.g. Java static final integer constants
12:29llasramAnd have a variation of it for dispatching on Java enums which I also use relatively frequently
12:33CookedGr1phonbbloom: 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:35bbloomCookedGr1phon: ah, in that case may i suggest a patch on clojure's JIRA? :-)
12:36CookedGr1phonYou 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:36CookedGr1phonbut all clojure's tests pass no problem
12:40johnwalkerhow do you specify that dependencies are only required for testing?
12:41johnwalkeroh derp, you just use a testing profile
12:42hcumberdaleif 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:42hcumberdale,(print '(1 2 3))
12:42clojurebot(1 2 3)
12:43justin_smithhcumberdale: then do something with the individual values
12:43justin_smith,(doseq [i '(1 2 3)] (print i))
12:43clojurebot123
12:43hcumberdalejustin_smith: a list of strings is returned
12:43justin_smithOK, clojure has plenty of ways of acting on each element of a list
12:43hcumberdale,(print "a" "b" "c")
12:43clojurebota b c
12:43justin_smithyou can use clojure.string/join to make one string
12:44hcumberdale,(print '("a" "b" "c"))
12:44clojurebot(a b c)
12:44justin_smith,(apply print '(1 2 3)) is another option
12:44clojurebot1 2 3
12:44hcumberdaleyeah! I solved nearly all such cases with apply
12:44justin_smith,(clojure.string/join " " '("these" "are" "strings"))
12:44clojurebot"these are strings"
12:48hcumberdaletrying to use loom.graph/add-edges graph ["x" (fn that returns list of strings)]
12:48hcumberdaleends up with an edge: "x" '("a" "b" "c")
12:49justin_smithtry (apply loom.graph/add-edges graph "x" (fn that returns list of strings))
12:51hcumberdalejustin_smith: results in scary output with some kind of alphabet in the nodeset
12:52justin_smithmaybe you want (add-edges graph (cons "x" (fn that returns list of strings)))
12:53justin_smithhttps://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:54justin_smithor 2 element
13:06ChouLin/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:06ChouLin(defn get-word-counts [line]
13:06ChouLin (reduce
13:06ChouLin (fn [words w] (assoc words w (inc (words w 0)))) {}
13:06ChouLin (str/split (str/lower-case line) #"\W+")))
13:06ChouLin
13:06ChouLin
13:10justin_smithChouLin: please use refheap or gist for multiple lines of code
13:12justin_smith,(reduce (fn [words w] (update-in words [w] (fnil inc 0))) {} ["a" "a" "b"])
13:12clojurebot{"b" 1, "a" 2}
13:13sigmavirus24hey tbaldridge I have a couple questions about transit-python, would a PM be more appropriate?
13:14tbaldridgesure
13:20augustlI 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:20augustlerr, get '("f" "g") back I mean
13:23Glenjamini don't think there's one function that will do just that
13:23Glenjamin(= a (take b (count a)) will do the first bit
13:23Glenjaminerm, reverse those take arguments
13:25Glenjamin,(defn leftovers [prefix coll] (if (= prefix (take (count prefix) coll) (drop (count prefix) coll)))
13:25clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
13:25Glenjamin,(defn leftovers [prefix coll] (if (= prefix (take (count prefix) coll)) (drop (count prefix) coll)))
13:25clojurebot#'sandbox/leftovers
13:25Glenjamin,(leftovers '(a b c) '(a b c d e f))
13:25clojurebot(d e f)
13:26justin_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:26clojurebot("f" "g")
13:43mdrogalisA wild licensing debate appears! https://twitter.com/bodil/status/491960370521976832
13:45SegFaultAXOh Bodil.
13:46mdrogalisI actually didn't realize it was her before I posted that - since she changed her avatar.
13:47tbaldridgeah yes, the never ending battle of personal ideals vs legal realities....
13:48mdrogalisI'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:50ToxicFrogmdrogalis: 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:50Glenjaminthere are examples of dual-licenced databases
13:51mdrogalisToxicFrog: Fair argument.
13:51Glenjaminbeing able to fix the tools you use is nice, but not a necessary feature
13:51mdrogalisSo, is the issue that Cognitect is only taking contributions via Jira as usual for Transit, or are they not taking anything period?
13:52Glenjamin"Because transit is incorporated into products and client projects, we prefer to do development internally and are not accepting pull requests or patches."
13:53mdrogalisOh, well that's gross.
13:54mdrogalisAt a minimum, continue development in house and progressively merge the "open source" version back in with the main line or something.
13:54SagiCZ(dotime [_ 10000] (println "o"))
13:55SagiCZ,(dotimes [_ 10000] (println "o"))
13:55clojureboto\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:55tbaldridgeissues can be created via github, Transit doesn't use JIRA
13:56mdrogalistbaldridge: What's the point if they'll never be acted on?
13:56llasramtbaldridge: What "legal realities"?
13:57tbaldridgeBut 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:57llasram...
13:57tbaldridgemdrogalis: they'll be acted on, they already have...
13:57boxeddon’t operate in Common Law countries :P
13:58tbaldridgemdrogalis: https://github.com/cognitect/transit-js/pulls?direction=desc&amp;page=1&amp;sort=created&amp;state=closed
13:58tbaldridgeNotice, the PR wasn't used, but the feedback was.
13:58mdrogalistbaldridge: I'm not being saracastic by the way. I assumed it worked the same way issues were working with other Clojure Github projects
13:58bbloomtbaldridge: presumably that's the point of the "absolutely no warentee" startup messages
13:58llasramI'm glad most of the word has the paranoia dial set somewhere below eleven
13:58llasrams,word,world,
14:00mdrogalisBottom line though - not submitting user contributions puts me off a lot.
14:00mdrogalisCertainly not to blame anyone.
14:00tbaldridgebbloom: presumably being the key word....
14:01bbloomtbaldridge: *shrug* lawyers
14:01tbaldridgeand what can and cannot be done may be trumped by a contract signed by two companies.
14:01bbloomthe problem is that people talk to their council, who recommends MAXIMUM CAUTION, and they follow counsil's instructions
14:01mdrogalisYeah, integrating it into client work was a no-no IMO.
14:02bbloombut in reality, you need to weigh risk vs reward
14:02bbloomand at some point, once you fall below your risk tollerence, you need to tell your counsil to bugger off
14:02bbloomcouncil*
14:02bbloomb/c somebody can always sue you
14:02bbloomdoesn't mean they'll win...
14:08bbloomtbaldridge: but sorry, no reason to take it out on you :-P
14:09tbaldridgebbloom: 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:10tbaldridgeBut I've worked with enough larger companies to know that this stuff has to be taken seriously.
14:10tbaldridgeFor 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:11mdrogalistbaldridge: Yeah, apologies. I know you didn't have any say in that choice.
14:11bbloomwell the GPL is a whole other discussion
14:11bbloombut, speaking of MS:
14:11bbloomhttps://github.com/Microsoft/TypeScript/pulls?direction=desc&amp;page=1&amp;sort=created&amp;state=open
14:11AimHereMS did have a bee in its bonnet about the GPL circa 2000ish or so
14:11bbloom:-P
14:11AimHereThe Halloween documents and all that
14:11tbaldridgebbloom: ;-)
14:11mdrogalisBee in its bonnet lol
14:11mdrogalisHavent heard that in a while
14:14seancorfieldtbaldridge: when I worked at Adobe, they had a similar stance on GPL (and on LGPL)
14:15tbaldridgehopefully someday all this stuff will get tested in court, but until then most of these licenses are just words and theory
14:15AimHereGPL has been to court lots of times
14:15seancorfieldI 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:16justin_smithseancorfield: 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:16seancorfieldand 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:17seancorfieldjustin_smith: it was not for a distributable project, nor was it for open source usage
14:17andrzejsliwaHi guys, short question... how to disable appearing of java icon in dock of macosx when running leiningen?
14:18johnwalkerwhich bodil tweet? ;)
14:18andrzejsliwaI found :jvm-opts ["-Dapple.awt.UIElement=true"]
14:18justin_smithseancorfield: if you weren't distributing, why did you need a license to copy and redistribute?
14:18BodilThis discussion amuses me tremendously.
14:18andrzejsliwabut this disable icon only for jvm of cider
14:18seancorfieldthe 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:19seancorfieldjustin_smith: IANAL - but the lawyers had issues
14:19GlenjaminI suppose the open source transits could be treated as forks which never merge back upstream
14:19seancorfieldhey, who said Bodil three times? :)
14:19_alejandroandrzejsliwa: how are you running your app?
14:19algernon"lawyers had issues" - the world would be so much better if lawyers were bug free.
14:19andrzejsliwaI just run lein
14:20BodilThe GPL makes it hard for people to exploit free software to build their proprietary software. That's a feature. 😁
14:20andrzejsliwaand Java icon appearing in dock... for time of running lein
14:20seancorfieldlicensing issues are not about common sense or rationality in a lot of cases - legal concerns are often on a higher plane :)
14:20technomancyprotip: you can sue anyone whether or not you have a case against them.
14:20_alejandroandrzejsliwa: what happens if you do `lein trampoline run`?
14:20AimHereIs clojure's GPL-incompatibility a feature too?
14:21seancorfieldBodil: 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:21tbaldridgeBodil: assuming said exploitation is undesirable...
14:21Bodilseancorfield: Obvious
14:21andrzejsliwaicon popup... and disapear after process is stopped
14:21seancorfield(even for internal projects with no redistirbution)
14:21BodilObviously*
14:21technomancyhttps://twitter.com/coda/status/428944437884891136
14:21Bodiltbaldridge: If so, one probably shouldn't be using the GPL. 😊
14:22seancorfieldGetting dragged into those license audits was a particularly icky part of my career - I felt dirty afterward! :)
14:23seancorfieldhahaha... love this: https://twitter.com/al3x/status/428990149897093120 (from that same thread)
14:23BodilI quit a few enterprise jobs over bad attitudes towards free software, tbh.
14:23technomancyseancorfield: nice
14:24BodilAnd I know a lot of enterprise consultants who hate the GPL because of being asked to deal with these things.
14:24seancorfieldBodil: 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_alejandroandrzejsliwa: sorry no clue.
14:24seancorfield(and I did quit Adobe)
14:24Bodilseancorfield: I've heard a few people echo that sentiment. Not surprised. 😊
14:24technomancyseancorfield: does Adobe just classify free software advocates as "those crazy folks who always complain about flash?" =)
14:24_alejandrodid you do anything to make it show up? I just realized I've never had the icon pop up at all
14:25technomancyat least back then
14:25justin_smith_alejandro: I know that certain libs make the icon show up (for example ring, because it loads some classes in swing)
14:25justin_smith(specifically the lein ring plugin)
14:26seancorfieldtechnomancy: the discussion around Flash was rarely a rational one IMO... and I'll leave it at that...
14:26technomancyheh
14:26justin_smith_alejandro: iirc if you don't load the swing classes, you won't get that icon
14:26seancorfield(I worked on the ActionScript 3 / Flash Player 9 test suite for a few months during a transition in roles)
14:26justin_smithmaybe I should direct that at andrzejsliwa
14:27_alejandrojustin_smith: yeah, I think they were looking for how to suppress it
14:27justin_smithright, and the trick is to make sure nobody loads the swing classes
14:27justin_smithit's some annoying initializer in swing that creates that icon
14:29_alejandrojustin_smith: although fwiw, I don't get the icon when I run `lein ring server` in one of my apps
14:29justin_smithinteresting, they may have changed this since I stopped using OSX
14:30justin_smithwhich was a while ago
14:30andrzejsliwain my profile i have only cider-repl
14:30andrzejsliwaproject is just blank lein repo
14:31andrzejsliwaeven without project... when running lein icon appear
14:31johnwalkeris the mozilla public license compatible with clojure libraries?
14:31andrzejsliwaon 1.7 and 1.6 everything is fine
14:31OscarZwhat are the most popular dev tools for clojure nowadays?
14:32justin_smithOscarZ: lein is still "the way" to handle deps and set up the classpath
14:33technomancysed is making a comeback
14:33justin_smithI think more of us are using emacs than any other editor
14:33OscarZyes, i ment more like editor / ide ..
14:33_alejandroOscarZ: emacs + CIDER
14:34justin_smithfireplace + vim is popular too (but not as popular)
14:34OscarZi dont like vim :)
14:34andrzejsliwathere is lighttable and plugin for intellij, sublime etc
14:34andrzejsliwabut true, most people using emacs
14:35llasramI don't know that I'd say "most people"
14:35SagiCZ,(def m [{:a 0 :b 1} {:c 5 :d 6}])
14:35clojurebot#'sandbox/m
14:36justin_smithllasram: 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:36SagiCZ,(map #(:a %) [{:a 0 :b 1} {:a 5 :b 6}]
14:36clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:36SagiCZ,(map #(:a %) [{:a 0 :b 1} {:a 5 :b 6}])
14:36clojurebot(0 5)
14:37justin_smithSagiCZ: #(:a %) is the same as :a
14:37justin_smith,(map :a [{:a 0 :b 1} {:a 5 :b 6}])
14:37clojurebot(0 5)
14:37technomancyllasram: http://cemerick.com/2013/11/18/results-of-the-2013-state-of-clojure-clojurescript-survey/ "more than half" last year
14:37llasramLooks like in cemerick's last "State of Clojure" survey, Emacs was just under 50%
14:37SagiCZjustin_smith: thank you
14:37llasramtechnomancy: Yeah -- took me a minute to drill down to the actual data, which is over in this "polldaddy" thing
14:37justin_smithSagiCZ: np
14:38technomancyistr cemerick saying that was the last survey he planned on running
14:38llasramAwww
14:38technomancymaybe?
14:38technomancyanyway, might be a good time to find a successor
14:38llasramWe've got a few months
14:39SagiCZis there any catch with map on nested maps?
14:40justin_smithllasram: those emacs answers are separated between cider+nrepl, inferior lisp, slime -- if you combine those it edges over 50% using emacs
14:40SagiCZ,(map :a [{:a 0 :b {:x 5 :y 4}} {:a 5 :b {:x 5 :y 4}}])
14:40clojurebot(0 5)
14:40llasramjustin_smith: Oh, my eye glided right over that. Good point
14:41llasramSagiCZ: What sort of catch would there be?
14:42SagiCZllasram: 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:43andrzejsliwaok I solved problem by:
14:43andrzejsliwaexport JVM_OPTS="-Dapple.awt.UIElement=true"
14:43andrzejsliwaexport LEIN_JVM_OPTS=$JVM_OPTS
14:43justin_smithSagiCZ: that makes no sense
14:43SagiCZllasram: but (:keyword (first vector-of-maps)) works fine
14:44llasramSagiCZ: Then in your non-toy case you have a bug :-)
14:44SagiCZllasram: yup
14:48SagiCZ,(map :name [{:name :water :behavior 0} {:name :ice :behavior 2}])
14:48clojurebot(:water :ice)
14:48SagiCZwow!
14:48SagiCZthats a bug in my repl!
14:48troydmhow is that a bug?
14:48SagiCZyep.. restarded repl and it works fine now
14:49SagiCZi guess i messed up something with my endless experiments :>
14:49SagiCZtroydm: it was returning something else in my REPL
14:51llasramRe-defined `map` somehow maybe?
14:51llasram,(let [map {}] (map :whatever [{:whatever :huh?}]))
14:51clojurebot[{:whatever :huh?}]
14:51SagiCZllasram: yeah that would be it.. i ignored the warnings!
14:54SagiCZis there an easier way to do this?
14:54SagiCZ(zipmap (map foo1 coll) (map foo2 coll))
14:59justin_smith(into {} (map (juxt foo1 foo2) coll))
14:59llasramSagiCZ: Maybe (into {} (map (juxt foo1 foo2) coll))
14:59llasramjustin_smith: jinx!
14:59justin_smithindeed
15:00justin_smiththe into version will perform better, for what it's worth
15:00justin_smithand I think its a little more clear
15:02SagiCZthanks
15:06SagiCZ,m
15:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: m in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:39SagiCZcan i create anonymous function with variable amount of parameters? like this (#(...?...) can call with some arguments)
15:39bbloom,(#(count %&) 1 2 3)
15:40clojurebot3
15:40SagiCZ,(#(println %&) :hello :this :is :dog)
15:40clojurebot(:hello :this :is :dog)\n
15:40SagiCZbbloom: thank you sir
15:40bbloomSagiCZ: try apply in that case
15:40bbloom,(#(apply println %&) :hello :this :is :dog)
15:40clojurebot:hello :this :is :dog\n
15:41bbloomwell, or just use println directly... i guess you were just looking to see what %& was
15:41SagiCZwait what was wrong with my approach
15:41bbloomSagiCZ: nothing, ignore me
15:42SagiCZbbloom: ok then
15:43SagiCZbbloom: what if someone is passing an argument to my anonymous function but i dont want to use it? #(domystuff (comment %)) ?
15:43bbloomSagiCZ: just use fn
15:44SagiCZ(fn [&] (do my stuff)) ?
15:45teslanick(fn [_] (...))
15:45bbloomor (fn [& _] (...))
15:45teslanickUnderbar is idiomatic for "I don't care what this argument is."
15:45justin_smithbbloom's version with & _ takes any number of args, and ignores them all (unless you decide to be silly and use the _ binding)
15:45SagiCZ (fn [_] (...)) would accept one parameter only right?
15:46teslanickYes
15:46SagiCZalright thanks :)
15:46justin_smithyeah, & _ ignores any number of args
15:46ennWhat is the equality function used to determine set membership?
15:46justin_smithenn: =
15:46ennjustin_smith: thank you
15:46justin_smithnp
15:47teslanick,(= #{ :enn :justin_smith } #{ :justin_smith :enn })
15:47clojurebottrue
15:47justin_smith,(contains? #{[1 2 3]} '(1 2 3)) that means that sets do structural equality, like = does
15:47clojurebottrue
15:47justin_smithso things can be equal even if they are not the same class
15:50amontalentiI 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:51justin_smithamontalenti: any reason to run lein jar rather than lein uberjar?
15:51amontalentijustin_smith, prepping for a clojars deployment, uberjar is not appropriate for that, right?
15:52justin_smithoh, right
15:53justin_smithhow are you invoking lein deploy?
15:53amontalentijustin_smith, "lein deploy clojars"
15:54Farehi
15:54justin_smithamontalenti: hmm, I use lein push for that
15:54Farein the documentation for defmulti, I see room for only one dispatch function — can I dispatch on multiple arguments, just with one dispatch function?
15:57Fareoh, the function takes all the parameters, eh?
15:57tbaldridgeFare: yes it takes all params
15:58SagiCZhey i need something like "some" but the "conditional function" should take the elements in coll as parameter
15:58SagiCZ(doc some)
15:58clojurebot"([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:58Farehow do I deal with [:class1 :class2] hierarchies?
16:00SagiCZ,(some (> 5 %) [2 0 4 9])
16:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:01SagiCZ,(some #(> 5 %) [2 0 4 9])
16:01clojurebottrue
16:01SagiCZi need "9" not true
16:03samfloresSagiCZ filter
16:03nullptr,(filter #(> 5 %) [2 0 4 9])
16:03clojurebot(2 0 4)
16:03samflores,(filter (some #(> % 5) [2 0 4 9]))
16:03clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/filter>
16:03SagiCZ,(first (filter #(> 5 %) [2 0 4 9]))
16:03clojurebot2
16:03nullptr,(filter #(> % 5) [2 0 4 9])
16:03clojurebot(9)
16:03samflores,(filter #(> % 5) [2 0 4 9]))
16:04clojurebot(9)
16:04SagiCZ,(first (filter #(> % 5) [2 0 4 9]))
16:04clojurebot9
16:04SagiCZthis is it
16:04samfloresyep
16:12SagiCZwhat if i want to return foo1 if its non-nil and return :default when foo1 returned nil? (def foo [] (foo1) :default)
16:12arrdemjust wrap the whole thing in an or..
16:12SagiCZduh
16:12SagiCZthanks
16:14justin_smithSagiCZ: if foo1 is a lookup on a map, get takes an optional third argument
16:14justin_smith,(:foo {:bar 0} :not-here)
16:14clojurebot:not-here
16:22SagiCZjustin_smith: it wasnt a lookup but i was looking if (filter) can default to something.. forgot about OR
16:23SagiCZ,(nil? nil)
16:23clojurebottrue
16:23SagiCZ,(not-nil? nil)
16:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: not-nil? in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:23SagiCZ:(
16:25justin_smith,((comp not nil?) nil)
16:25clojurebotfalse
16:25justin_smith(def not-nil? (comp not nil?))
16:25SagiCZyeah.. i actually wanted not-empty but thanks
16:25SagiCZ,(= nil [])
16:25clojurebotfalse
16:26SagiCZgood to know
16:26justin_smithnot-empty is seq
16:26justin_smith,(empty? [])
16:26clojurebottrue
16:26justin_smith,(seq [])
16:26clojurebotnil
16:26justin_smith,(seq [1])
16:26clojurebot(1)
16:27SagiCZyeah :)
16:27SagiCZi finally finished my state machine.. no macros needed
16:27SagiCZno trampoline either
16:27justin_smithawesome
16:27justin_smithwhat replaces the trampoline, recur?
16:27SagiCZyes
16:27justin_smithvery nice
16:27SagiCZrecur with lookup in map.. it looks up the new function according to keyword the previous function returned
16:27clojurebotIt's greek to me.
16:28justin_smithsounds about right
16:28SagiCZjustin_smith: i guess.. i will have to test it a lot.. supposed to control my money
16:31SagiCZi guess i should have some function that all the complicated parameters are correct.. should i use the "pre:" asserts for that?
16:33justin_smith:pre and :post help with that
16:33justin_smithyou can also use clojure.test
16:33eigenlichtwhat's the easiest way to go from map => keys and vec => indices?
16:33justin_smithand try to figure out good corner cases to test (alongside typical inputs, of course)
16:33_alejandroeigenlicht: map -> keys use keys
16:33justin_smitheigenlicht: for the former, use keys
16:34_alejandro,(keys {:a 1 :b 2})
16:34clojurebot(:b :a)
16:34eigenlichtyeah, but keys doesn't work on vectors
16:34justin_smithfor the latter - maybe (range (count v))
16:34_alejandrofor the latter, probably range count
16:34_alejandrojustin_smith: nice
16:34justin_smithgreat minds think alike
16:34teslanick,(range (count [ 1 2 3 ]))
16:34clojurebot(0 1 2)
16:34SagiCZjustin_smith: will work on that tomorrow, thanks
16:34eigenlichtI'm a nooby, what's the easist way to put that in one function? check for type?
16:35justin_smitheigenlicht: what is your goal here?
16:35llasrameigenlicht: Generally you don't -- you write your function to expect either a map or a vector
16:35SagiCZi 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:35llasramThere's not many circumstances where it's actually reasonable to use either
16:37eigenlichtjustin_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:37justin_smitheigenlicht: 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:37teslanickeigenlicht: Use a zipper.
16:37llasrameigenlicht: clojure.walk
16:37teslanickOr that
16:38eigenlichtI actually do not want to modify it in place, but create a new datastrucuture with same structure - still zippers?
16:38justin_smitheigenlicht: 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:38justin_smitheigenlicht: thats a good thing, because clojure datatypes are immutible
16:38justin_smithand you would have either failed, or produced something really evil
16:38eigenlichthere's my apporach til now, which doesnt work with vectors: https://www.refheap.com/88526
16:39teslanickeigenlicht: You can't modify the code datastructures in place; they're all immutable.
16:39eigenlichtit's an abstraction - of course my modifcation is more complex than (str)
16:40teslanickA zipper (or walker) will feel like modifying nodes in place but return a new copy when you're done.
16:40eigenlichtoh, stupid me. I'm basically transcribing my python code
16:41eigenlichtI'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:41justin_smithyou could make a multimethod that dispatches on the class of the thing
16:41_alejandroyou could do a conditional on vec? or something
16:41justin_smithbut really either a zipper or walk/postwalk will be much easier here
16:41eigenlichtso, type checking?
16:42eigenlichtalright, thanks. checking out zippers later
16:42arrdemtype dispatch != typechecking
16:42justin_smithwell, multimethods abstract over typechecking, so you should avoid dispatching on type directly
16:42maiois there something like perltidy for clojure? that will format my clojure code according to some standards
16:42arrdemmaio: TL;DR no
16:42SagiCZmaio: clojure.pprint ?
16:43justin_smithmaio: emacs' indentation rules for clojure are pretty well accepted, and you can run emacs headless theoretically
16:43_alejandromaio: arrdem: I wish there were though
16:43teslanickYour code should be art! Would you let a robot make art? I think not! ;)
16:43SagiCZteslanick: hey are you robofobic?!
16:43arrdemmaio: emacs clojure-mode has some minimal support for automatic indentation, but it's not especially bright
16:44justin_smith emacs -batch myfile.clj --eval '(indent-region (point-min) (point-max) nil)' -f save-buffer
16:44SagiCZmaio: IntelliJ IDEA Cursive indents very well
16:44justin_smiththe above will work from a command line, if you have emacs installed and it loads clojure-mode proerply
16:44justin_smithno need to actually interact with the editor
16:45justin_smitharrdem: so you frequently find yourself overriding emacs' indentation choices? or are you talking about where line breaks should go?
16:45maiojustin_smith: yes I'm using Emacs, but indentation is just one part of the problem
16:46arrdemjustin_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:46arrdem<3 align-cljlet
16:47_alejandroarrdem: 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:48justin_smith_alejandro: electric return or whatever they call it is a thing you can turn off
16:48arrdem_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_alejandrojustin_smith: yeah, but then don't you have to hit tab after you hit enter?
16:49justin_smithbut 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:49justin_smith_alejandro: or M-h M-w indent-region to align the current defun
16:49justin_smithor whatever other method floats your boat
16:49_alejandrojustin_smith: hmm, may give that a go and turn off the auto
16:51justin_smiththe M-w is redundant there, really you can do M-h C-M-\
16:51justin_smiththat selects the entire defun as region, then indents it
16:52justin_smithI use auto-indent to find trivial formatting errors (if something indents weird I probably nested something wrong)
16:55arrdemI 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:56arrdemas in jumping two defs down from where the error is bad
16:56DomKMIs 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_alejandroDomKM: why do an incomplete extension of the protocol?
17:01justin_smith,(instance? clojure.lang.IFn :a)
17:01clojurebottrue
17:01justin_smithDomKM
17:01justin_smithoh, for the specific method coverage, that is another issue entirely
17:01_alejandrojustin_smith: I don't think that will work if you don't actually implement the entire interface
17:02DomKM_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:02justin_smithyeah, I think the solution is to implement it fully
17:02justin_smithDomKM: you can use a hash-map to extend a type to a protocol, and merge your custom methods with the map of defaults
17:03justin_smithDomKM: example here https://github.com/caribou/caribou-plugin/blob/master/src/caribou/plugin/protocol.clj#L26
17:03DomKMjustin_smith: I'm not sure what you mean. Is there any example?
17:03DomKMa second too slow to hit enter ;)
17:03justin_smithsee the definitions of null-implementation and make
17:06justin_smithDomKM: 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:06DomKMjustin_smith: that extend technique is very clever. Unfortunately, cljs lacks extend and I need this to be portable.
17:06justin_smithoh, ouch
17:06DomKMjustin_smith: yeah I considered trying and catching but I want to avoid that
17:10akhudekhah, while trying to write an example to illustrate one error, I find another
17:10DomKMso 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:10akhudekdoes anyone know waht is wrong with this code?
17:10akhudekhttps://github.com/akhudek/om-async-error/blob/master/src/om_async_error/core.cljs
17:10justin_smith,(:a 5) DomKM: dunno, same reason you can do keyword lookup on a number?
17:10akhudekspecifically, as soon as you type into the text box, the dump-chan channel stops working
17:10clojurebotnil
17:11DomKMjustin_smith: looks on objects that arent's associative return nil
17:11akhudekyou can clone that repository, run cljsbuild, then open index.html to run it locally
17:11DomKMjustin_smith: it's debatable whether that's a positive or not
17:11justin_smithDomKM: right, and extend lets you incompletely implement a protocol
17:11justin_smithit's a liberal language
17:12DomKMjustin_smith: but it currently seems like a type can satisfy a protocol but, when you call the protocol method, it could be missing
17:12DomKMjustin_smith: with no way of testing if it's actually implemented
17:20_alejandroakhudek: I think it's because dump-chan is not the same after a re-render
17:20_alejandroakhudek: probably because of the redefine of chan on 44
17:21_alejandroakhudek: 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:22akhudek_alejandro: Ok, that makes sense thanks. I’ve fixed it and managed to reproduce the original bug that was trying to demonstrate.
17:24akhudek_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:24akhudekThis particular one can be fixed by making sure that you actually close the channel before toggling the form off
17:25akhudekbut I have no idea why it occurs in the first place
17:30_alejandroakhudek: looking, but I know very little about Om, so unlikely to be of help
17:35akhudek_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_alejandroakhudek: interesting. good find
17:35_alejandrohow do you fix that?
17:36akhudekI’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:36akhudekat least I thought it was
17:36_alejandroyeah, sorry I was no help
17:36_alejandroif you push the fix, i'd be interested to see it though
17:36_alejandrogood luck
17:37akhudek_alejandro: no worries, thanks for taking the time to look though, sometimes it just helps to have someone to talk over with :-)
18:06fifosine,(map (fn [f] (nth "012" (f 5 3))) '(quot rem))
18:06clojurebot#<StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range: 3>
18:06fifosine^ what's wrong with that?
18:07fifosine,(quot 5 3)
18:07clojurebot1
18:07fifosine,(rem 5 3)
18:07clojurebot2
18:07Bronsa,('quot 5 3)
18:07clojurebot3
18:07Bronsa,('rem 5 3)
18:07clojurebot3
18:07fifosineI thought the quot meant "don't evaluate this"?
18:07fifosine*quote
18:07technomancyfifosine: it does
18:08Bronsafifosine: right, you're invoking a symbol rather than a function
18:08fifosineerrr
18:08fifosineok
18:08justin_smithright, 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:08Bronsaand when a symbol is invoked it behaves like a get
18:08Bronsaso ('foo bar baz) ~ (get bar 'foo baz)
18:08aperiodic,('a '{a :foo} :bar)
18:08clojurebot:foo
18:08technomancyI wonder if anyone has ever done that intentionally
18:08aperiodic,('a '{b :foo} :bar)
18:08clojurebot:bar
18:09justin_smith(inc technomancy)
18:09lazybot⇒ 124
18:09Bronsatechnomancy: yeah I'm not a big fan of symbols-as-functions either
18:09fifosineso what I really want is (list quot rem)?
18:10Bronsafifosine: yes, or [quot rem]
18:10technomancyhuh, I thought I passed 127; has someone been dec'ing me?
18:11technomancyit wasn't one of you, was it? I thought we were pals.
18:11justin_smith$karma justin_smith
18:11lazybotjustin_smith has karma 51.
18:12justin_smith$karma so
18:12lazybotso has karma -31.
18:14arrdemtechnomancy: 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:16technomancyarrdem: it got about 20% of the way into my firmware code before using up all 2.5kb of ram
18:16technomancy{blake}: hmmm... maybe I dreamed it
18:16arrdemtechnomancy: my logs show no instances of dec applied to you evar
18:16technomancyarrdem: awww. group hug.
18:17arrdem<3
18:17arrdempls maintain leiningen will give incs
18:17{blake}heh
18:19arrdempman and so appear to be the dec whipping boys..
18:19arrdem*pmap
18:19arrdem$karma pmap
18:19lazybotpmap has karma -3.
18:20technomancyarrdem: how much ram does this board of yours have?
18:21arrdemtechnomancy: 8kb SRAM
18:21technomancyluxury!
18:22arrdemheh
18:22arrdemjust as long as I don't have to dig out a tome on garbage collection and implement it myself..
18:23technomancyforth doesn't really have GC
18:23technomancy"just use the stack"
18:24arrdemyeah looks like there is no scheme/lua for Arduino, only C or Forth
18:25technomancyfor AVR, yeah
18:25technomancythere is an ARM arduino
18:25technomancybut it's really overpriced
18:25akhudekdang, it turns out I don’t understand om and core.async as well as I thought. :-/
18:25arrdemthe Beaglebones are the only not overpriced ARM devish boards, and they're out of stock :P
18:26technomancyarrdem: 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:26technomancyarrdem: the arduino due is a plaything compared to the beaglebone
18:26aperiodicI 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:26akhudekso 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:27arrdemaperiodic: 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:27akhudekand 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:27akhudekit was suggested that it was due to the base component getting rerendered, but that isn’t actually the case
18:28arrdemtechnomancy: 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:28technomancyarrdem: if you want a reasonable bare-metal arm board, a teensy 3 or one of these would be my recommendation: https://mchck.org/
18:28arrdemtechnomancy: ooh cool I'll check that out
18:29technomancythe teensy 3 is more polished but not an oss design. the mchck looks somewhat immature; would require a more adventurous soul.
18:29arrdemheh
18:29technomancybut looks pretty amazing if it delivers on its goals
18:36justin_smitharrdem: beaglebone is awesome
18:46technomancyjustin_smith: it is, but total overkill for a lot of situations
18:46technomancyespecially sensor networks
18:47justin_smithyeah, it's true
18:47justin_smiththat mc hck thing looks pretty cool for small stuff
18:47technomancyyeah, I love the idea of something cheap enough that you don't feel bad if you step on it or something
18:48technomancyso far the only things under USD10 I've seen have been attiny-based
18:48justin_smithtechnomancy: 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:48technomancynice
18:49justin_smithwe ordered the open source pcb board from a manufacturor - ordering like 40 was $10 more compared to getting 4 of them
18:49justin_smiththe whole thing is free / open designs as much as is feasible, which is cool
18:50justin_smiththe amazing thing is someone has a scheme to attach desktop ram to the thing...
18:50justin_smithwhich opens up huge opportunities with DSP stuff
18:51justin_smith(long delays, complex convolutions for hardware or acoustic space simulation, big sample memory...)
18:52technomancyyeah it's weird how the economics of pcbs work
18:52technomancyalways sucks if you want just one of anything
18:52justin_smithto be sure
18:53justin_smithand 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:53justin_smithhttp://en.wikipedia.org/wiki/SMT_placement_equipment
18:53aperiodicthe OSH Park community PCB order is the best thing I've been able to find for small-scale boards
18:55technomancyjealous
19:08FuzzyHarpyBugHello! What topics are allowed here?
19:08justin_smithFuzzyHarpyBug: clojure is encouraged, but people get away with a lot
19:10technomancyno racism, misogyny, spam, or excessive cusses
19:10FuzzyHarpyBugWell, since it seems quiet right now...
19:10FuzzyHarpyBugOk, 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:10technomancyour 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:11scape_lol
19:11FuzzyHarpyBugXD
19:11FuzzyHarpyBugOr...
19:12FuzzyHarpyBugI 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:12scape_FuzzyHarpyBug, you could install an ACL package, or create a local user account and add it to a group
19:12scape_Is there a clojure library/method for communicating back and forth with Android/java running threads?
19:12FuzzyHarpyBugDon't quite see how that would help though... I have password authentication disabled globally.
19:13justin_smithFuzzyHarpyBug: even for local (already logged in) user account login via su?
19:13scape_are you sure? the new ssh, I thought, allowed local account login-- disallowed root
19:14justin_smithscape_: well, clojure is a java library - do you mean within one vm, between vms, between hosts?
19:14scape_within one vm/environment
19:14FuzzyHarpyBugjustin_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:15scape_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:15justin_smithFuzzyHarpyBug: 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:16augustlugh, 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:16clojurebotI don't understand.
19:16FuzzyHarpyBugHmm....
19:17scape_why was string a pain? augustl
19:17justin_smithscape_: 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:17augustlscape_: 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:17augustlboring..
19:18scape_okay, just wasn't sure if there was a library out there that handled this
19:18FuzzyHarpyBugI'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:18scape_FuzzyHarpyBug, what's wrong with ftp?
19:18FuzzyHarpyBugAt the moment I'm just doing it manually with WinSCP
19:18FuzzyHarpyBugcan't use ftp without password auth
19:19justin_smithscape_: 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:20scape_okay, i've messed with that before. good idea. maybe I'm over thinking it :D
19:20justin_smithscape_: just have two queues, each side reads from one and writes to the other
19:21justin_smithFuzzyHarpyBug: what about sshfs, using a keypair specific to that user
19:22justin_smiththat will create a local drive, anything moved to that drive will be scp'd to the remote
19:22FuzzyHarpyBugjustin_smith: never heard of it... that sounds like it could be useful though.
19:22justin_smithhttps://code.google.com/p/win-sshfs/ windows, right?
19:22FuzzyHarpyBugjustin_smith: starting yesterday this is the first time i've touched anything linux in over 4 years. lol
19:23FuzzyHarpyBugjustin_smith: yes, my local machine is Win7 x64, my server is on a ubuntu 14.04 linode vps
19:24justin_smithyeah, 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:25FuzzyHarpyBugright, hehe
19:25FuzzyHarpyBugactually this looks really really useful...
19:25FuzzyHarpyBughmm
19:25scape_good idea justin_smith
19:25justin_smiththanks
19:26arrdemtechnomancy: have you done anything with small single sensor wireless nodes?
19:26FuzzyHarpyBugproblem 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:26FuzzyHarpyBugi like to just plug in the drive and go
19:26arrdemtechnomancy: 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:27technomancyarrdem: 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:27arrdemtechnomancy: gotcha.
19:27justin_smithFuzzyHarpyBug: maybe it would be easier to just use a copy of pscp (from the putty folks) installed to the flash drive
19:27technomancythe 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:27justin_smithbut I dunno, maybe sshfs can install to the flash drive? that seems less likely
19:28arrdemjustin_smith: I think sshfs is a standalone binary more or less... should be doable
19:28justin_smitharrdem: awesome, haven't had to use it outside my home world of linux, so I wasn't sure
19:28FuzzyHarpyBugyes, but you'd have to map the drive on every new computer. not too bad i suppose...
19:29justin_smithFuzzyHarpyBug: running the binary should map the drive, I don't think there would be much to it
19:29arrdemjustin_smith: I mean neither have I... better grab `which sshfs` and try running it from somewhere random..
19:29FuzzyHarpyBughmm. ok. i'll try it out
19:29FuzzyHarpyBugThanks!
19:38augustlI do a reduce for side effects (jdbc calls). Should I wrap it in doall?
19:39technomancyaugustl: no
19:41augustlI like to have everything with a side effect inside something that says "do" :)
19:41arrdemright... but reduce is for accumulating a value
19:41arrdemnot for sequential side effects
19:41arrdemdoseq dotimes or something else would be a better construct
19:42technomancyyeah, if you can separate out your side-effects from your values you should
19:42augustlI do care about the return value, though, so I guess reduce makes sense, even though getting the return value requires side effects
19:43arrdemmeh this is a masturbatory "what is idiomatic" point.
19:44arrdemI'd probably write (->> (reduce) (doall)), I've seen Bronsa write doseq with an atom for the result..
19:44arrdemit doesn't matter.
19:45augustlarrdem: yeah my main goal is to communicate intent, and be future proof :)
19:46augustlas in, is it reasonable to assume that reduce won't be lazy in future clojure releases, or is that unspecified
19:46arrdemunspecified and it may be lazy now
19:46arrdemAFAIK
19:46arrdembut this is very poorly documented teritory. ask amalloy, the true magus, for details. I know not.
19:47BronsaI don't think reduce could be lazy
19:47arrdemBronsa: depends on the value...
19:47arrdem(reduce concat) totally can be, but that's lazy on the function not on reduce
19:48arrdem(reduce assoc) not so much
19:48Bronsaarrdem: that's like saying that identity can be lazy because (identity (range)) :)
19:48arrdemBronsa: :P
19:48arrdemin Clojure 2.X reduce shall return a delay
19:48arrdemWHAT NOW
19:49Bronsa,(reduce concat (range))
19:49Raynesarrdem: excuse me
19:49clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
19:49augustlwell 2.0 can break anything it wants to ;)
19:49Bronsadefinitely lazy arrdem
19:50augustldo we like (->> coll (reduce ...) (doall)) or (->> col (reduce ...) doall)? :)
19:51bbloomaugustl: is the result of the reduce a seq?
19:51augustlbbloom: no, an int
19:52augustland by answering that question I now understand why it makes no sense to think of reduce as lazy
19:52bbloomaugustl: https://github.com/brandonbloom/transduce
19:52Bronsaaugustl: also, ##(doall 1)
19:52lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
19:52augustlwhen would it ever make sense to have a lazy reduce
19:52bbloomyou can just copy/paste map-state and each
19:52bbloomi guess in theory there could also be an each-state
19:53bbloombut i've found map-state, mapcat-state, and each to all be useful more than a few times
20:06justin_smithmaybe a lazy reductions?
20:07justin_smithwell actually yeah, reductions, which is in fact lazy
20:07justin_smithso there we go
20:08justin_smith,(last (take 50 (reductions *' (map inc (range)))))
20:08clojureboteval service is offline
20:09arrdemwhen did justin_smith join me on the hellban list..
20:09justin_smithmust have been very recent, if it happened at all
20:09quxx,4
20:09clojureboteval service is offline
20:10arrdemhum
20:10arrdemmay actually be down who knows
20:10justin_smith&(last (take 50 (reductions *' (map inc (range)))))
20:10lazybot⇒ 30414093201713378043612608166064768844377641568960512000000000000N
20:10justin_smiththere we go
20:10justin_smithnice big number there
20:11typecheckforwhat,(+ 3 3)
20:11clojureboteval service is offline
20:11arrdembot iz dead
20:11justin_smithtypecheckforwhat: goddammit now I have little john's voice shouting in my head
20:11justin_smith:)
20:12arrdemjustin_smith: you're welcome
20:12arrdemthere are 16 words in that entire song..
20:13justin_smithfire up your cloud / another round of pull requests / type check for what
20:13justin_smithor some shit
20:13arrdem13 distinct words
20:13arrdemif "'nother" != "another"
20:15justin_smith&(last (take 1024 (reductions *' (map inc (range)))))
20:15lazybot⇒ 541852879605885728307692194468385473800155396353801344448287027068321061207337660373314098413621458671907918845708980753931994165770187368260454133333721939108367528012764993769768292516937891165755680659663747947314518404886677672556125188694335251213677274521963430... https://www.refheap.com/88534
20:15justin_smithhaha the number was too big so he had to refheap it
20:16technomancyisn't last+take just nth?
20:17justin_smithyeah, I was being silly
20:17gfrederickscan't do nth with ->>
20:18gfrederickscome on nth why you gotta be like that
20:23technomancyfunctions gonna funk
20:23technomancyor wait
20:23technomancymaybe that was functors
20:26deathknightclj-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:27deathknightsaid file is in ~/clj-facebook-project-folder/test/clj_facebook_graph/example.clj
20:27technomancydeathknight: lein run -m my.ns
20:32ttasteriscotechnomancy: 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:33technomancyttasterisco: 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:39gfrederickstechnomancy: I think functions are functors so presumably they are also gonna funk
20:49deathknighttechnomancy: I'm getting a "can't find 'example.clj' as .class or .clj for lein run: please check the spelling" error
20:50deathknighti'm running the command $ lein run -m example.clj from ~/project-dir/
20:50ttasteriscohow are people running daemons in clojure? jsvc? is it me or I cant use the same jar to run multiple jsvc-s?
21:37numbertenhas anyone experienced a hanging that arises from exceptions being thrown in a pmap thread?
21:39justin_smith$karma pmap
21:39lazybotpmap has karma -3.
21:39justin_smithpmap is pretty unpopular
21:56seancorfielddeathknight: based on that folder structure I'd suggest: lein run -m clj-facebook-graph.example
22:08gfredericksokay I think I want to make this library I've been imagining for wrapping values & thrown exceptions
22:09trptcolinMaybe you should
22:09trptcolinget it?
22:10gfredericksI think an either joke would be more appropriate
22:10trptcolindangit
22:10gfredericksI was going to call it Ether but then I decided it's not quite the either monad
22:10gfredericksat least usage-wise
22:11john2xreading 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:11justin_smithI think ether is a better name for a library that makes your program pass out and hallucinate
22:12gfredericksjustin_smith: I guess probably it redefines some clojure.core function
22:12gfredericks,(alter-var-root #'assoc (constantly dissoc))
22:12clojureboteval service is offline
22:12gfredericksyeah I bet it is
22:13justin_smithgfredericks: add a lingering headache and you're golden
22:14seangrovejohn2x: Kind of. You can use ^:no-check to tell core.typed to trust you
22:15gfredericksI found out yesterday that idris has a function(?) called believe_me
22:16gfredericksthen I was going to call it handoff but I decided anything based around ball-carriers didn't make as much sense actually either
22:17gfrederickshaha get it either
22:17hellofunkamalloy: 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:17hellofunkah, he's not online
22:18trptcolingfredericks: nailed it
22:18hellofunkanyway 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:19justin_smithwhat was the issue amalloy described?
22:20hellofunkjustin_smith all noted above in links
22:20justin_smithhellofunk: this http://www.reddit.com/r/Clojure/comments/1vc0at/clojurescript_gc_and_memory_leaks/cer0svo ?
22:20gfrederickstrptcolin: you just hang around #clojure for the occasional pun don't you
22:20gfrederickshaha get it either
22:21hellofunkjustin_smith look at the second link I posted from steveolsen.us
22:21trptcolins/#clojure/wherever/g
22:21hellofunkhttp://blog.steveolsen.us/clojurescript-gc-and-memory/
22:21justin_smithyeah, that's the link that led me to the reddit post where I saw the thing you were asking amalloy about
22:22justin_smithoddly he didn't describe the information that fixed his problem in the blog post
22:26gfredericksunder my so-far-unused first-random-name-from-wikipedia naming convention I would have to call it Goronwy Roberts
22:27justin_smithgoronwy is definitely a googlable name
22:28gfrederickswould have to admit to not knowing how to pronounce my own library's name
22:28gfrederickswhich seems like a win
22:29justin_smithhttp://www.forvo.com/word/goronwy/
22:29justin_smiththat r tho
22:29gfredericksI refuse to listen to that
22:30gfredericksI must preserve my innocence
22:30justin_smiththe origin of the name http://en.wikipedia.org/wiki/Gronw_Pebr
22:30gfredericksthe fun thing about this naming convention is that you can define success as overtaking the wikipedia article in google search results
22:31justin_smithheh
22:31justin_smith"argentina at the 1998 winter olympics" is a mouthful of a name for a lib
22:31gfredericksno you take the first human name
22:32justin_smithstawno would work
22:32justin_smithsounds like something you could buy by the bottle