#clojure logs

2015-06-10

02:04Guest34113Help needed on our new genuinevBulletin forum software (it is not nulled) please visit https://www.criosphinx.net for more information (we're able to install vBulletin 5 Connect
03:10benhudahello
03:29dsapoetrahi guys, can somebody help me with clojurescript and domina library?
03:31dsapoetraso i've got a code ( https://gist.github.com/dsapoetra/10a61354b4151c528ba7 ), as you can see, in (defn ^:export init ..) i have 3 click event from 3 different link, each link change same html content, problem with my code is that only first event that worked, any suggestion?
03:45J_A_WorkIs there seriously not a way to properly restart a Cider REPL without entirely closing and restarting the buffer?
03:46J_A_WorkI’m doing a lot of work with reader conditionals in some .cljc files, and there’s a bug in the reload there on clojure side. Which, OK, not much to do about that, but from a UI level in Emacs it’s a pain in the arse.
03:46J_A_WorkThe restarted Cider buffer doesn’t even pop up in the same place.
04:04acron^morning
04:05acron^i want to pass a boolean to a fn but it doesn't feel idiomatic: (fetch-data location path true/false)
04:06acron^what's the idiomatic way to do this? keys?
04:07acron^(fetch-data location path :returnEmpty) ?
04:07zotacron^: context? why does passing a bool feel non-idiomatic? it's still data, even if its the simplest form
04:08acron^in this example, the boolean might indicate that an empty string should be returned, rather than throw
04:08amalloyi think acron^'s concern is that a function call like (foo true false false true) doesn't really have any apparent meaning
04:08acron^exactly amalloy
04:09zotwould 2 versions of the func make more sense, where one includes a default (a la 'get'), so you can pass "", and throw if no default is given?
04:09amalloyacron^: in clojure, usually you do this by passing a single map parameter, with keys for all the optional stuff: (foo {:cheat? true, :ai :dumb})
04:10acron^zot: yeah, i considered a 'fetch-data-no-throw' or something
04:10amalloythen at the call site there's evidence of what each arg is supposed to mean
04:10acron^amalloy: i think that's a good plan
04:11amalloysome clever bugger will tell you that (foo :cheat? true, :ai dumb) is way cooler, but don't believe them
04:11zotagreed. that sounds better than my idea. (for clarity — i meant same function name, just variable arity.)
04:13acron^is there shorthand for if a map key exists use the value, else use something else ?
04:14amalloyacron^: are you familiar with destructuring, or are you just using get?
04:15acron^i'm vaguely familiar with destructing....not really
04:15acron^yes, using get atm
04:15acron^well, i would
04:15amalloyacron^: then it's just (get m k default)
04:15acron^ahh
04:15acron^:D
04:15acron^thanks
04:16TEttinger(inc amalloy)
04:16lazybot⇒ 278
04:18zotamalloy: do you mind elaborating on the dislike of (foo :kw1 arg1 :kw2) mechanism? I've seen it a few times, and been curious why it's lightly used.
04:19amalloyzot: because the convenience it provides at the call-site when typed in manually by a human is saving two characters, and the inconvenience it adds when calling it programmatically is quite substantial
04:20zotamalloy: makes total sense. i've never actually used it (or had to try to build up an apply-able arg set). thanks!
04:20acron^amalloy: works a treat: https://www.refheap.com/102375
04:21acron^is the override necessary?
04:21acron^overload*
04:21amalloyno, but it's polite
04:21amalloyyou can do it if you want, or not
04:21acron^i shall strive to be polite :)
04:22amalloyacron^: now are you ready for destructuring cheat-mode?
04:22zotlol
04:22amalloy(defn opts-test ([name] (opts-test name {})) ([name {:keys [include] :or {include false}}]) (str name " " include)))
04:23amalloyso that you can put all the option names and all the default arguments in one place, instead of individually at each place where you happen to need them
04:24whompwhat's the difference between concat and a bunch of conj calls?
04:24hellofunkwhomp: for starters, concat is lazy
04:26hellofunkwhomp: also: concat accepts collections, whereas conj accepts one collection and then individual elements
04:26whomphellofunk, ok, so it's just lazy and with a slightly different way of dealing with arguments
04:27hellofunkwhomp: conceptually they are quite different. conj builds a collection and concat builds a sequence
04:27hellofunkwhomp: also, concat builds the seq the same way always, but conj uses the collection type's efficiency to determine where the addition is performed (front or end of the collection) while concat respects arg order always
04:28TEttinger,(conj [1 2 3] :a)
04:28oddcully,(conj (conj (conj '(0) 3) 2) 1)
04:29clojurebot[1 2 3 :a]
04:29oddcully,(concat '(0) [3 2 1])
04:29clojurebot(1 2 3 0)
04:29clojurebot(0 3 2 1)
04:29TEttinger,(conj '(1 2 3) :a)
04:29clojurebot(:a 1 2 3)
04:29acron^amalloy: awesome cheat, thanks
04:30TEttingerimportant thing to note, conj-ing onto a vector produces a vector (and appends to end), conjing onto a seq (aka list) produces a seq and prepends to beginning
04:30whomphellofunk, thx, very interesting
04:31TEttingerI don't actually know how conj works with maps
04:31TEttinger,(conj {} :a)
04:31clojurebot#error {\n :cause "Don't know how to create ISeq from: clojure.lang.Keyword"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: clojure.lang.Keyword"\n :at [clojure.lang.RT seqFrom "RT.java" 528]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 528]\n [clojure.lang.RT seq "RT.java" 509]\n [clojure.lang.APersistentMap cons "APersistentMap.java"...
04:31TEttinger,(conj {} [:a 1])
04:31clojurebot{:a 1}
04:31TEttingerah!
04:31TEttingerit just needs pairs
04:31hellofunkTEttinger: specifically, it needs a vector
04:32hellofunk,(conj {} '(1 2))
04:32clojurebot#error {\n :cause "java.lang.Long cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.APersistentMap cons "APersistentMap.java" 42]}]\n :trace\n [[clojure.lang.APersistentMap cons "APersistentMap.java" 42]\n [clojure.lang.RT conj "RT.java" 638]\n [clojure.core$conj__4114 inv...
04:32TEttingerI've noticed that before, any idea why that is?
04:32hellofunkTEttinger: the vector is the seq part of a map. hence why mapping over a map uses vectors for each pair
04:32TEttingeryep
04:32TEttingerthere's a non-seq part?
04:33hellofunkTEttinger: well the map itself is not a seq
04:33TEttingerahhhh
04:33TEttingerright
04:34whompwhat's the difference between a sequence and a collection? i see that ISeq extends from IPersistentCollection
04:34hellofunk,(= (seq? {:a 1}) (seq? (seq {:a 1})))
04:34clojurebotfalse
04:35hellofunkwhomp: some collectsions are not seqs, for example, as my last snippet shows
04:35TEttingerI think Collection refers to the parent of all generic Java collections and Clojure collections, except maaaaaaybe Maps
04:36hellofunkwhomp: and many seqs are not collections; a lazy-seq for example
04:36TEttinger,collection?
04:36clojurebot#error {\n :cause "Unable to resolve symbol: collection? in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: collection? in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: c...
04:36TEttingerhm
04:36hellofunk,(doc coll?)
04:36clojurebot"([x]); Returns true if x implements IPersistentCollection"
04:36whomphellofunk, but ISeq extends from IPersistentCollection
04:36TEttingerno, more interested in seeing if java.util.HashMap is actually a Collection
04:37hellofunkwhomp: personally, i recommend caring less about implementation details and more about the high-level concepts. for example, a map collection can have more than one implementation depending on its size and other factors
04:37TEttingeryep
04:38TEttingeryeah, it tends not to matter too often what interfaces clojure's data structures implement
04:38whompok, so collections are just structures where you know how many elements it has, and it doesn't need to be ordered, and sequences are where it needs to be ordered but you don't know necessarily how many things it has?
04:38hellofunkwhomp: sets and maps are important collections, but neither is a sequence. however a vector is also a collection, and it *is* ordered
04:38whompright, so is what i said a good summary?
04:39TEttingerso typically, most clojure functions that operate on data structures internally operate on seqs. if you look at the source for, say, frequencies, it probably calls seq on its collection argument to turn it to a sequence (or return nil if it is not a sequence, which is critical)
04:39hellofunkwhomp: you are right that a collection is a concrete, finite entity full of stuff. a sequence is an ordered entity, sometimes infinite. most importantly, a proper sequence enjoys the sequence api for all types of stuff. and, all collections can be made into sequences by calling seq on them
04:40TEttinger,(seq "hey!")
04:40clojurebot(\h \e \y \!)
04:40TEttingerand some non-collections too
04:40whompok, so a collection can always make up an order, even if there's not always a good way of determining what comes before what, e.g. for a map
04:40TEttingerstrings are a bit of a special case
04:41TEttingerright
04:41TEttingeryou can call seq on a Map or Set just fine
04:41TEttinger,(seq {:a 1 :b 2})
04:41clojurebot([:a 1] [:b 2])
04:41hellofunkwhomp yes all collections can be made into sequences, which is why you can map over a map. but if the collection is un-ordered, you cannot guarantee what order that seq will be in
04:41hellofunk,(map identity #{1 2 3})
04:41clojurebot(1 3 2)
04:42whompok awesome, thanks guys it makes a lot of sense :)
04:42TEttingerclojure's a great language, my favorite by far
04:42hellofunk,(into #{} "hello!")
04:42clojurebot#{\! \e \h \l \o}
04:42TEttingerhaha wow
04:43TEttinger(inc hellofunk)
04:43lazybot⇒ 2
04:43jonathanjshould i use data.json or cheshire?
04:43hellofunk,(map int "what's up?")
04:43clojurebot(119 104 97 116 39 ...)
04:44amalloyjonathanj: probably cheshire. there's nothing *wrong* with data.json as far as i know, but cheshire is better
04:45jonathanjamalloy: better in what way?
04:46amalloyi don't really remember, honestly. it's been a while since i looked. more configurable, probably better performance, probably also using a better underlying java library
04:46kungiQuestion to all the native english speakers here. Would you use "salutation" as a database field name or something else?
04:46jonathanjit's certainly more popular
04:47amalloya more active maintainer who doesn't have to go through jira
04:47amalloykungi: i think salutation is recognizable
04:47amalloy"title" is maybe fine too, but i've certainly seen it called salutation
04:47puredangercheshire does keyword keys and data.json does not
04:47jonathanjkungi: sure, why not, you might find people using "greeting" more commonly though
04:47puredangerand cheshire is faster
04:47amalloyjonathanj: well uh, salutation also means a different thing, i believe
04:48amalloylike one meaning is greeting, yes
04:48amalloy$dict salutation
04:48lazybotamalloy: noun: A polite expression of greeting or goodwill.
04:48kungijonathanj: greeting sounds perfect thank you :-)
04:48jonathanjamalloy: yes, that's true, i hadn't thought of using it as title
04:48jonathanjmy interpretation was a greeting though
04:48kungititle is reserved for Dr. or Prof. or Rittmeister :-)
04:49dsapoetraHi everyone, sorry to interrupt, please help me in this issue : http://stackoverflow.com/questions/30751038/clojure-event-listener-on-domina-library , will appreciate any help. Have a good day
04:49jonathanjso if i had a file of json objects separated by newlines, i guess i can combine line-seq to achieve what i want?
04:49jonathanj(map cheshire/parse-string (line-seq rdr))?
04:50jonathanjand both map and line-seq are lazy... *checks docs*
04:51jonathanjwhen is Clojure 1.7.0 final likely to be released? anyone have any guesses or insider information?
04:51puredangerunknown (and that is the most official info you'll find)
04:51puredangerwe release when we're done
04:51zotkungi: sure, or 'greeting', if i understand what you want, and you want something less formal
04:52puredangerI am hoping to get an RC2 out this week
04:52zotwhoops, didn't realize i was in scrollback :/
04:52amalloyjonathanj: well, beware that valid json objects can have newlines in them
04:52amalloy(as i recall)
04:52jonathanjpuredanger: i was going to say, i saw RC1 a little while ago
04:52jonathanjamalloy: the thing outputting this JSON has a strict output
04:53puredangergenerally when we get an RC that doesn't have any major objections, that becomes the final release
04:53puredangerthat is, it really is a candidate for release
04:54oddcullypuredanger: "when it's done OR later" (always keep your options)
04:54jonathanjare there any things i can tune to improve start up time of clojure (or java in general, i guess) software?
04:57oddcullyjonathanj: what exactly are you talking about?
04:58oddcullythere is always the option to moar ghz, moar ram, moar ssd (at least to some degree)
04:58TEttingerjonathanj, it's uh an open problem. ssd would be the best help I think
04:59TEttingerTimothy Baldridge started work on a clojure-like language called Pixie that avoids the JVM to improve startup time
04:59TEttingerbut if you need to use java, there are plenty of wacky opts
05:00TEttingerrunning the java.exe or javaw.exe (or other platform specific java program) with args like:
05:00TEttingerjava.exe -server -XX:+TieredCompilation -Xms512m -Xmx512m -jar MY_THING.jar
05:00jonathanji have an SSD, i'm running a high-end 15" rMBP
05:00jonathanj(and OS X)
05:01TEttingerwould have a definite improvement if the machine can handle -server, which not all windows machines have enabled
05:01TEttingerif you can increase -Xms and -Xmx higher, do it. they are starting memory and max memory, respectively
05:02jonathanjthe reason i ask is on a friend's machine (running Debian Sid) running lein does not seem to take as long to get going
05:02jonathanjmaybe OpenJDK is faster than Oracle's JDK?
05:02jonathanj(the hardware is not significantly different)
05:02TEttingerOpenJDK does always have -server available, Oracle not always, but Oracle should have -server on any mac you try it on...
05:02amalloyTEttinger: that is bad advice. setting Xms and Xmx too high will just lead to really long GC pauses, with roughly the same average performance unless your program is actually memory-starved
05:03TEttingerhm, didn't know that, but I did often hit max memory with usually using less
05:03TEttingerinteresting
05:03amalloywell sure, the jvm will use all the memory you give it
05:03amalloybut it uses it as a dumpster, to let trash pile up
05:03TEttingerah
05:04amalloylike lazybot runs on 60MB, and 4clojure.com is on i think 80MB?
05:04TEttingernice
05:04amalloyit used to be 40MB, and still could be except that there is a problem with startup that i never got around to fixing
05:04acron^omg...how do i merge two vecs??
05:04lazybotacron^: Uh, no. Why would you even ask?
05:04TEttingeracron^: concat?
05:04acron^thanks
05:05acron^tip of my tongue/brain
05:05TEttinger,(concat [1 2 3] [10 20 30])
05:05crocketDoes java 8 use an aggressive garbage collector by default?
05:05clojurebot(1 2 3 10 20 ...)
05:05TEttingerwill produce a seq
05:05TEttinger,(vec (concat [1 2 3] [10 20 30]))
05:05clojurebot[1 2 3 10 20 ...]
05:05crocketGC is lazy....
05:05crocketMy clojure REPL sits on top of 1.5GB of RAM.
05:05TEttingercrocket, heh ask amalloy!
05:06crocketWhy
05:06jonathanjhrm, i read this recently: http://stuartsierra.com/2015/04/26/clojure-donts-concat
05:06TEttingeramalloy was just saying that lazybot runs on 60MB of RAM
05:06amalloyjonathanj: indeed, concat is the wrong answer
05:06amalloyyou want into
05:06crocketProbably, his lazybot was launched with -Xmx 60M
05:07crocketamalloy, How did you conclude immediately that 'if-let-all' didn't fit your 'useful' project?
05:08amalloycrocket: because i've participated in many discussions about that function before, with different names, and i don't want it
05:08jonathanjwhat are the correct circumstances for using lazy sequences in Clojure?
05:08crocketamalloy, Why not?
05:08jonathanji seem to read about a lot of people who advise against using them
05:08crocketI was not in the discussion
05:09crocketjonathanj, If you want to process 16GB of data with 2GB of ram, use a lazy seq.
05:09crocketIt's good for streaming large data with a little amount of RAM.
05:10amalloyi don't really want to get into it, crocket. you can probably find it in the google groups archives, ,or the irc log archives somewhere. these days i stay out of the big design discussions, which tend to tread the same ground over and over, and just answer small questions to help people with specific problems
05:10crocketIt seems you were burnt out.
05:10TEttinger,(into [] [1 2 3] [10 20 30])
05:10clojurebot#error {\n :cause "Key must be integer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Key must be integer"\n :at [clojure.lang.APersistentVector invoke "APersistentVector.java" 284]}]\n :trace\n [[clojure.lang.APersistentVector invoke "APersistentVector.java" 284]\n [clojure.core$transduce invoke "core.clj" 6583]\n [clojure.core$into invoke "core.clj" 6600]\n [sandbox$eval...
05:10TEttinger...what
05:11TEttinger,(into [1 2 3] [10 20 30])
05:11clojurebot[1 2 3 10 20 ...]
05:11TEttingerok phew
05:11amalloycrocket: yes, on those types of things
05:12amalloyTEttinger: into just takes one coll. the extra optional argument, as of 1.7, is a transducer
05:12TEttingerahhh
05:12whodidthishow do i get C-j back to auto indent with emacs 24.4
05:14jonathanjshould i use (reader) within a (with-open)?
05:14jonathanjthe examples on clojuredocs seem to suggest it, so i guess so
05:16hellofunkacron^: TEttinger: just be aware that into uses conj, so unlike concat, preservation of order will dependon the collection type, while concat always preserves order.
05:17whodidthisoh electric-indent-mode -1
05:22WickedShellApparently (.setProperty System "awt.useSystemAAFontSettings" "lcd") isn't valid as setProperty couldn't be found as a matching method but I can see it here https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#setProperty-java.lang.String-java.lang.String- any reason that this might be happening?
05:24TEttingerwhich exception of those 3 do you get, WickedShell? or a different one?
05:24TEttingeroh!
05:24TEttingerstatic
05:25TEttinger(System/setProperty "awt.useSystemAAFontSettings" "lcd")
05:26WickedShellwell that definetly fixed it. So if it's static I always need to address it in that manner?
05:26TEttingerI think there's a way with the dot syntax , but slash is definitely the way I usually see it with static methods
05:27TEttinger$google clojure.org java interop
05:27lazybot[Clojure - java_interop] http://clojure.org/java_interop
05:27WickedShell... yup it was right there and I read right passed it. (Forgot that it was a static method)
05:27WickedShellThanks!
05:29TEttinger(. System setProperty "" "") is what the / effectively compiles down to, but / is much more readable, since the paren dot space args special form has lots of different orders that mean different things for its arguments
05:30TEttingerno prob, WickedShell
05:31TEttingerI think it's about damn time for me to start implementing macroexpansion for my clojuresque language... wish me luck...
05:33Guest34113vBulletin vbShout for versions 5.x download the attachment without signning up! http://bit.ly/1FIwtND - More vBulletin products/plugins for any version will be added in due course.
05:33kungiWhat is the equivalent of select * in datomic?
05:33Guest34113vBulletin vbShout for versions 5.x download the attachment without signning up! http://bit.ly/1FIwtND - More vBulletin products/plugins for any version will be added in due course.
05:53jonathanjis there something like Python's defaultdict() in Clojure?
05:55hellofunkjonathanj: what does that fn do?
05:56jonathanji want to use (get-in) without first having to worry about creating nonexistent elements in a nested map structure
05:56jonathanjhellofunk: creates nonexistent keys with the provided callable before setting them
05:57Duke-you can use (get-in m [keys] default-value) with a normal map
05:57hellofunkjonathanj: you mean you want to generate a map that already has a bunch of default keys, but just nil as their values?
05:57jonathanjsorry, i have to deal with real life, i'll try explain better in a moment
05:58hellofunk,(into {} (for [k [:a :b :c]] [k :default-val]))
05:58clojurebot{:a :default-val, :b :default-val, :c :default-val}
05:58oddcullydefauldict() gets a fn and getting key, that are not there, return (fn key) instead iirc
05:59oddcully.withDefault if you know groovy
06:03hellofunkjust came across this, lol: http://i.imgur.com/NsMbRKD.png
06:09jonathanjwhat i'm actually trying to do is create a lopsided tree structure, which was originally modelled in Python with dicts, perhaps there is a better choice in Clojure
06:11jonathanjmaybe tree-seq can help me
06:24J_A_WorkCan anyone suggest a painless tool for quickly testing a Compojure API?
06:25Empperihttps://github.com/ring-clojure/ring-mock
06:25Empperishould do it
06:40isaac_rkswhy is clojures build tool named after a racist story
06:40isaac_rksthis is problematic and i will be advising everyone i know to stop using clojure as it promotes racist attitudes
06:41p_l... damn, Poe's Law strikes again
06:45wasamasaI just had an idea why this particular short story was picked
06:45isaac_rksbecause it's a story which denigrates native americans
06:45isaac_rks?
06:45wasamasathe tool to manage java packages before maven was ant
06:46wasamasait's simple as that
06:47isaac_rksas simple as that eh
06:47Empperiisaac_rks: I'd say you can pick almost any word in any language and find it offensing in some culture somewhere around the world
06:47isaac_rksas simple as mindlessly accepting western patriarchal culture's racist attitudes
06:47Empperifor instance, I had zero knowledge Leiningen is considered offensive by native americans
06:48isaac_rksthats because you have white privilege
06:48wasamasaEmpperi: like the pidora linux distro
06:48wasamasaEmpperi: or the master/slave terminology in databases and whatnot
06:48EmpperiI'm pretty damn sure that's just a sad coincidence considering technomancy and that he actually moved to Thailand to do charity work
06:48Empperistopped doing programming
06:48Empperimostly
06:48wasamasayeah
06:49Empperiso I'm pretty damn sure he isn't a racist asshole
06:49wasamasahe's currently working on minor projects to teach his kids
06:49isaac_rksim bored and pretending to be a sjw
06:50isaac_rkshe sounds like an interesting character
06:50Empperitrolling level 1 achieved
06:50Empperiand yeah, he is
06:50Empperireally nice guy
06:50Empperihaven't met him in person
06:50Empperibut been chatting with him
06:51Bronsaisaac_rks: trolling is not welcome in this channel
06:51isaac_rksok i will desist
06:51wasamasafun, reminds me of the futile troll attempts on #haskell or #emacs
06:51isaac_rksirc is just such a tempting trolling medium
06:51J_A_Workleave that for your subreddit please,
06:52isaac_rksinstant gratification
06:52Empperiisaac_rks: the problem here is, irc is a minority chatting medium and most of the guys here are above average in intelligence
06:52Empperiespecially on channels like this
06:52Empperiyou'll find it really hard to do successfull trolling
06:52EmpperiI was 110% certain you were trolling but I was bored
06:53jonathanjhrm, is there a function to map over values of a map but produce a map again?
06:54jonathanji'm trying to sort the results of (group-by)
06:54wasamasaEmpperi: here's said game: https://github.com/technomancy/calandria
06:54isaac_rksjohnathanj idk about clojure but in racket i would use a fold
06:55wasamasajonathanj: so you're looking of the map equivalent of mapv
06:55wasamasajonathanj: you could alternatively use into and {}
06:55wasamasahttp://clojuredocs.org/clojure.core/into
06:56jonathanj(into {} (map (fn [[k v]] [k (f v)]) some-map))?
06:56Bronsathat's one way to write map-vals, yes
06:57Bronsaanother is (zipmap (keys map) (map f (vals map)))
06:57Bronsa(reduce-kv (fn [m k v] (assoc m k (f v))) {} map) is a little more verbose but probably the most efficient version
07:01TEttingerBronsa, that last one looks weird
07:01TEttingerwhat is f there?
07:02BronsaTEttinger the same f in the previous 3 esamples :)
07:02TEttingerah
07:02TEttinger,(let [f str] (reduce-kv (fn [m k v] (assoc m k (f v))) {} map) )
07:03clojurebot#error {\n :cause "No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.core$map"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.core$map"\n :at [clojure.core$_cache_protocol_fn invoke "core_deftype.clj" 55...
07:03TEttingerthe map at the end was also weird
07:03TEttinger,(let [f str] (reduce-kv (fn [m k v] (assoc m k (f v))) {}) )
07:03clojurebot#error {\n :cause "Wrong number of args (2) passed to: core/reduce-kv"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (2) passed to: core/reduce-kv"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 36]\n [sandbox$eval51 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang....
07:03TEttingerhm
07:03Bronsa`map` is a map, not c.c/map
07:04TEttinger,(let [f str] (reduce-kv (fn [m k v] (assoc m k (f v))) {} {:a 1 :b 2}) )
07:04clojurebot{:a "1", :b "2"}
07:04TEttingerah, nice
07:05TEttingerit's much more fun to figure out clojure code than C# code, especially while less capable due to sleeping pills
07:05TEttingerI've tried both
07:05TEttingerand #clojure tends to be more helpful :)
07:06wasamasathere's a c# channel?
07:08jonathanjhmm
07:08jonathanji have a POSIX timestamp represented in milliseconds
07:08jonathanj(in JSON data)
07:09jonathanjwhen i parse the timestamp (which is a float) with cheshire i end up with a value like 1.425356936278875E9 in the repl
07:10jonathanji'm wondering about losing precision
07:11jonathanjthe number as it appears in the JSON is 1425356936.278875
07:12jonathanjwhy does it end up with the exponent notation representation?
07:12EmpperiI wonder why on earth your timestamp is a float if it is in milliseconds?
07:12Empperiand it gets parsed to floating point number which is by definition an inaccurate number format
07:13Empperibut I'm still finding it hard to grasp why floating point?
07:13Empperi,(System/currentTimeMillis)
07:13clojurebot1433934806288
07:13Empperithat returns a long
07:13oddcully1970-01-17? really?
07:14jonathanjEmpperi: maybe it's not in milliseconds then
07:14jonathanji just assumed it was but i guess it's obviously not
07:14Empperiit's something very wierd
07:14Empperi:)
07:14jonathanjit's just the result of time.time() in Python, i'm guessing
07:15Empperibut anyway, I'd try to handle it myself and read it as BigDecimal
07:15oddcullyseconds
07:15Empperi"The method time() returns the time as a floating point number expressed in seconds since the epoch, in UTC."
07:15TEttingerJSON only has one kind of number
07:15Empperigeesh, who thought it was a good idea to use seconds?
07:15oddcully,(java.util.Date. (long (* 1425356936.278875 1000)))
07:15clojurebot#inst "2015-03-03T04:28:56.278-00:00"
07:15TEttingerwhat clojure calls a double, IIRC
07:16wasamasafloaty floats
07:16Empperiwell, actually there's both float and double in java
07:16TEttingerI mean in JavaSCRIPT
07:16TEttingerJSON standard...
07:16TEttinger$google json.org
07:16lazybot[JSON] http://json.org/
07:17isaac_rksyou don't need any java knwoledge for clojure, aye
07:17Empperianyway, if the data given to you is in seconds with decimal part then doing it like oddcully suggests should work
07:17isaac_rkslooking for a more practical alternative to racket
07:17Empperibut you need to read it in as BigDecimal to keep it accurate
07:17wasamasaisaac_rks: even more practical?
07:17TEttingerisaac_rks, you don't need it but it sure helps
07:17Empperiyeah
07:17Empperiyou'll face java sooner or later when doing clojure
07:17wasamasaisaac_rks: and sure, you'll need it once you make use of anything java
07:17isaac_rkswasamasa: by practical i mean "more libraries"
07:17TEttingeryep
07:18wasamasalike, when doing file IO :D
07:18isaac_rkshmm
07:18TEttingerclojure has a ton of clojure libraries and easy access to even more in java-land
07:18isaac_rksface what parts of java?
07:18TEttingerfirst things first:
07:19TEttingerthe guy who designed Java's Generic Collections stuff for java 2.4 was...
07:19TEttingerthe same guy who invented Scheme
07:19TEttingerone of the same guys *
07:19wasamasaguy steele?
07:19TEttingeryes
07:19wasamasaoh well
07:19p_lTEttinger: he was one of the designers of java in general
07:19TEttinger$google guy steele java generics
07:19lazybot[Code Reads #10: Guy Steele, “Growing a Language” — Wordyard] http://www.wordyard.com/2007/06/12/steele-growing/
07:19p_land iirc also did aspectj
07:20isaac_rksoh yeah, interesting
07:20wasamasamaybe I should bring that up next time our android hacker at work rants about james gosling being the reason for all the sucky decisions
07:20TEttingeryep, so there's just more in common than you'd think
07:20p_lleading to infamous quote about how at java conferences "this would be the moment people give an ovation" when he finished his AspectJ prelection at ILC, iirc
07:21TEttingerJava was originally called Oak. Oak was a language designed "for average programmers," not bad ones but not particularly good ones either
07:22isaac_rksTEttinger: this is a good article
07:22TEttingerif you can learn clojure, learning the basics of java should be a cinch
07:22Empperibut the intricacies of JVM on the other hand...
07:22Empperi:)
07:23isaac_rksthats what scares me
07:23Empperibut JVM is still the best virtual machine out there
07:23p_lEmpperi: not really
07:24Empperioh, which is better these days?
07:24isaac_rksthere arent any perfect languages :( i find this very frustrating
07:24isaac_rkshaha
07:24Empperitry haskell if you want a perfect language
07:24Empperi:P
07:24Empperibut forget about pragmatism
07:24Empperi(ok, now I'm trolling)
07:25isaac_rksnah i need s expressions
07:25p_lEmpperi: JVM got a bunch of stuff working because of huge amounts of money poured to make it work (indeed, HotSpot has to "deoptimize" code to optimize it etc.)
07:25Empperiwell, I don't really care how it's done when the end result is excellent
07:25isaac_rkss expressions are fkn amazing, all i had used was python, then when i started doing scheme
07:25isaac_rksit makes programs so much easier to read imo
07:26p_lEmpperi: also, JVM is IMO extremely hurt by the fact that most people know only Oracle's (openjvm being afaik pretty much the same)
07:26dysfunlisp is lisp is lisp. i've stopped caring which lisp i'm writing for
07:26isaac_rksfeels like writing an actual language instead of flipping switches on a machine
07:26TEttingerdownsides to an amazing JIT compiler: the core standard lib that java needs to load with every new run of a program is 32 MB, loaded from disk to RAM before it can do anything
07:26Bronsadysfun: really? that doesn't make much sense to me
07:27TEttingerthen you load more libs, and if your HDD is not good... it's slow
07:27EmpperiTEttinger: yeah and Clojure makes it even worse
07:27p_lTEttinger: it's unrelated to the JIT compiler, it's an issue with Oracle/Sun JVM
07:27Bronsathere are *huge* differences between lisps
07:27p_lTEttinger: I am very happy about using J9 as main JRE because of that :D
07:27TEttingerp_l, well where is the hotspot implementation?
07:27dysfunBronsa: i spent long enough bending my brain to read s-expressions that they're much of a muchness
07:27TEttingeroh?
07:27TEttingerwhat does J9 do, p_l
07:27dysfunBronsa: sure, i've got slightly different techniques for doing stuff in different lisps and i've got different standard libraries
07:27p_lTEttinger: among other things, it can do code-sharing between multiple JVM processes for other than the stdlib cache
07:28TEttingernice!
07:28TEttingeris this an OpenJDK?
07:28dysfunBronsa: but mostly i pick which lisp to use based on boring stuff like "$platform has $library i want to use"
07:28dysfune.g. there are immutable datastructure libraries for common lisp, and the standard library there definitely is not geared to immutability
07:28p_lTEttinger: OpenJDK pretty much is Oracle
07:29p_lJ9 is IBM's stuff
07:29TEttingerexcept redistribution, openjdk is much more permissive
07:29TEttingerhow's startup time with J9, and is it open source?
07:29p_lTEttinger: the difference boils down to few libs that Sun didn't have apropriate rights to
07:30p_land no, not open source - but it shows that there *is* some work other than HotSpot
07:31p_lUnfortunately, HotSpot has to work uphill, both ways, to get the performance, and due to its design can only get it when in long-running process
07:31dysfunp_l: there are many java distributions. especially if you include proprietary ones
07:32p_ldysfun: yes. Unfortunately, it appears general public only knows of one (I don't really consider OpenJDK separate except for bugs from having slightly different few libs)
07:32dysfune.g. azul systems have one, oracle has several and most of the big companies involved in java have their own variants
07:33dysfunbut for open source java, we're pretty much looking at openjdk
07:33TEttingerazul has zing and zulu, but zulu is OpenJDK patched up nice
07:33dysfunyeah, but zing definitely isn't
07:33TEttingeryeah zing is pricey
07:34dysfunhowever, i was speaking to one of the azul guys the other day, and they will give you it for free for open source projects that meet their requirements
07:34TEttingerwaiting on 32-bit zulu before I start distributing clojure apps with zulu's jdk 8
07:34dysfunyou're deploying to old hardware or the windows desktop?
07:34TEttingerapparently it works great when you need to bundle JREs on Mac today
07:35TEttingerwindows
07:35TEttinger(Macs all being able to run 64-bit apps)
07:35TEttinger(zulu is currently 64-bit only last I checked)
07:36dysfunprobably because the client backend was shit so hotspot became the only one people bothered to maintain because servers are where the money is
07:40TEttingerthere may be a 32-bit -server profile
07:41dysfunmaybe. i shouldn't expect azul will make money off it though. even the new raspi is 64-bit capable, isn't it?
07:45TEttingeryeah, they don't make money off zulu anyway I guess
07:45TEttingerreally it's just another thing to be able to test on for stuff like automated builds, that would find it useful
08:01ro_sthas anyone used core.memoize with memcached as a backend before? i'm struggling and i'm not finding any decent reference examples to follow
08:05dysfunthat's ambiguous. could you explain specifically what you want from it?
08:05dysfunare you expecting core.cache to talk to memcached?
08:06ro_sttrying to use this
08:06ro_sthttps://github.com/clojurewerkz/spyglass/blob/master/src/clojure/clojurewerkz/spyglass/cache.clj
08:06ro_stwith this http://clojure.github.io/core.memoize/#clojure.core.memoize/PluggableMemoization
08:06bilusI haven't used it this way but this may be helpful: https://github.com/clojurewerkz/spyglass/issues/10
08:06ro_stin a core.memoize/ttl memoizer
08:08ro_stthanks bilus
08:10ro_stdamn. on first inspection, it seemed that i could simply (hah) plug memcached into core.memoize. looks like it's not that easy
08:12ro_stseems like memoize's ttl uses (delay)s and memcached can't store that
08:15bilusPerhaps rolling your own memoize would be the easiest way?
08:16bilusI mean the built-in memoize has like what? 5 lines of code?
08:19ro_stcore.memoize, the library, not clojure.core/memoize
08:19ro_stbut i take your point :-)
08:19bilusok :)
08:35kwladykait is noob quesion but... what is the best pratice to read nested value from map, in my example from RING+compojure, sended form by POST: (render-file "register-2.html" {:name "step 2" :email (get-in req [:form-params "email"])})
08:35kwladykais it ok or i should do this without get-in?
08:38hellofunkkwladyka: you could also destructure your req in the compojure route, but get-in is pretty standard too
08:40BronsaI find multi-level destructuring really hard to parse
08:40Bronsaget-in is perfectly fine
10:07jonathanjdo Clojure maps preserve their insertion order?
10:09kungijonathanj: no
10:09kungijonathanj: there are no guarantees for any map order in clojure
10:10kungijonathanj: except you use a sorted-map
10:10J_Arcanehttp://blog.circleci.com/its-the-future/
10:13noncomi have a edn {}, and say that X can be either a key of it or a sub-{}, or it can be a member of a [] in any of the values in the {} or sub-{}. how do I remove the kvs were k==X and also free all the []s from being X present in them?
10:14noncomi am trying to use clojure.walk/postwalk for that, but still my results are not too good
10:15Bronsanoncom: an example? it's not really clear
10:15noncomok, wait a sec
10:17noncomhttps://www.refheap.com/102385
10:17noncomi am trying to walk the datastructure and act accordingly to the situation on each step, but i don't have a big success with that
10:18noncomi remove "X" from a [] by first turning it into a set and then disj and then back (into []) - that's ok i think...
10:18noncombut otherwise..
10:18noncomidk..
10:19oddcullysets are unordered
10:19kwladykaWho use https://github.com/juxt/bidi ?
10:19noncomorder is not important here, right
10:19noncomhere is my current state: https://www.refheap.com/102386
10:19noncomit just keeps going in circles
10:19noncomon first {}
10:19kwladykai just want confirm is it good as routing library for fornt and back side and there is no other alternative :)
10:20kwladyka*better alternative
10:20noncomkwladyka: seeing it for the first time, but looks good to me
10:23kwladykathx for your opinion
10:27andyfjonathanj: The Clojure cheat sheet here lists several forms of sorted maps and sorted sets, including some that preserve insertion order: http://jafingerhut.github.io
10:28andyfSome operations on maps return unsorted maps, though, so depending on what you are doing with maps, sorting them just before you need them sorted might be more maintainable.
10:29kwladykawhat Pedesal can by default whan Ring cant?
10:29kwladyka*expect routing
10:32andyfjonathanj: update-in creates maps if necessary when they do not exist. I've not seen anything exactly like Python's defaultdict, but the function fnil can help you achieve something similar. See the second group of examples here http://clojuredocs.org/clojure.core/fnil
10:42noncomBronsa: did it: https://www.refheap.com/102388
11:15kwladykaWhat is the best partice in clojure to for create handler for create-user? (defn create-user [user] ... ) and pass the map when calling function or (defn create-user [name surname email ....] ...) or ?
11:25justin_smithkwladyka: if it's more than 4 distinct pieces of data, I prefer a map
11:25kwladykajustin_smith, "prefer a map" - i will be glad if you can write me example of code to be more precise
11:26justin_smith(defn create-user [{:keys [name surname email password-hash phone prefs]}] ...)
11:27kwladykaoh in that way, thx
11:27justin_smithbecause the caller is actually readable as code if they use a map with named keys
11:27justin_smithcalling a function with more than four positional args isn't often readable (unless all the args are used identically)
11:28kwladykaand call that (create-user {:phone "12321"}) ?
11:28justin_smithswap! / update-in / etc. excluded as a special case
11:28justin_smithkwladyka: exactly, though I assume you would provide the other keys too
11:28kwladykayes, but it is good to know it is possibility to not do that
11:28justin_smith,((fn [{:keys [a b]}] (+ a b)) {:a 22 :c "OK" :b 20})
11:28clojurebot42
11:30kwladykais there a way to force to put all map keys? like name, surname, email, password,phoen,prefs not only phone?
11:30justin_smithkwladyka: you could use a precondition or assert so you would throw an AssertionError if keys are missing
11:31justin_smithkwladyka: also there is prismatic/schema which has extensive tools for making assertions about data
11:35kwladykaso... if i will use assert i have to write (assert :phone) (assert :sruname) etc.?
11:35kwladykahmm but i guess it is data validation from that moment
11:36kwladykaand it is another topic
11:36kwladykatopic for some additional library
11:36justin_smithkwladyka: (assert (empty? (remove (set (keys input)) [:phone :email ...]))
11:36justin_smithit will fail if any of the keys in that final vector are missing from the input
11:37kwladykammm but i have to rewrite all keys from function parameters in that way, so it is not exatly what i expected
11:38justin_smithkwladyka: that's a fair point, yeah
11:39oddcullyare those really all mandatory?
11:39justin_smithI guess a macro that expands to do the keys destructuring and also outputs the assert that all keys were provided could be done
11:40justin_smithoh, yeah, if not all keys are required you need to describe the required separate from accepted anyway, so no big loss there
11:41kwladyka:form-params in ring+compojure gives "email" instead of :email as the name of input fields. I thing to use "keyword" function to convert that in some way. Is any better way?
11:42kwladykaor it is not necessary and i should care about that?
11:42kwladyka*shouldnt
11:42justin_smithkwladyka: there is wrap-keyword-params - but really unless the data is entered as a literal, why not let the key be a string?
11:43justin_smithI am trying to remember if it was bbloom who had a rant about wasting so many CPU cycles turning strings into keywords when there were no data literals actually making the keywords useful
11:43kwladykajustin_smith, on the and i want have handler which will get :keys as function what we created and i want have handler for website which will call that handler
11:43justin_smithkwladyka: :strs works
11:43kwladykabut website handler will get data as "email", handler for uers will get data as :email
11:44justin_smith,((fn [{:strs [a b]}] (+ a b)) {"a" 10 "b" 32})
11:44clojurebot42
11:44kwladykaor maybe my idea of doing handlers like that is not wise?
11:45justin_smithwait, what are "website handler" and "handler for users" ?
11:46kwladykaok, so user handler is the part of independend architecture. on this stage software don't know anything about website, it is just core of system with business model
11:47kwladykahandler website - function for GUI which will call core function
11:47justin_smithkwladyka: if you have a standard representation for the data inside the app, I'd make a converter that takes the data as provided by the http request and returns the other representation
11:48justin_smithkwladyka: I wouldn't try to manipulate the http server / middleware / etc. so that what you get is identical to your internal representation
11:48kwladykaso convert {"email" "bla@bla.com" "password" "secret"} into {:email "bla@bla.com" :password "secret}?
11:49justin_smithkwladyka: yeah, inside your http handler
11:49kwladykaoh using middleware...mmm it can be good idea
11:49justin_smithwell, I wouldn't do it as middleware, because I think that's logically the job of the request handler, to create the data you would use internally
11:50justin_smithI mean yeah, I have used wrap-keyword-params so that the data is more usable straight off the request, but this also can lead to a mess I think, as opposed to having one piece of code (the handler) that has the job of taking the data from http and creating the data for your app
11:51justin_smithin the long run I think that's a more flexible way to do things
11:51kwladykaso something like (def web-handler (core-handler (change-data :form-params))) ?
11:51justin_smithkwladyka: yeah, and you could consider change-data a sort of middleware
11:52justin_smithbut a middleware that is dedicated to a specific data format
11:52kwladykaso... any hints which function i can use to convert {"email" "bla@bla.com" "password" "secret"} into {:email "bla@bla.com" :password "secret}?
11:53kwladykai guess keyword?
11:53kwladykabut maybe there is something better
11:53justin_smith,(reduce-kv (fn [m k v] (assoc m (keyword k) v)) {} {"a" 0 "b" 1 "c" 2})
11:53clojurebot{:a 0, :b 1, :c 2}
11:54kwladykahttp://stackoverflow.com/questions/9406156/clojure-convert-hash-maps-key-strings-to-keywords - oh i think i found something
11:54justin_smithbut if that is the extent of the conversion you need, wrap-keyword-params does that - just remember you have the choice of doing something more specific
11:54justin_smithkwladyka: haha, that top answer is a slightly worse version of my example above
11:56kwladykalol i didint know about wrap-keyword-params :/
11:57kwladykaoh not... i misslead
11:58kwladykai just discover :params has keys, but :form-params has strings
12:06kwladykahmm strage, it doesn't change anythink:
12:06kwladyka(def app
12:06kwladyka (-> app-routes
12:06kwladyka wrap-keyword-params
12:06kwladyka wrap-params
12:06kwladyka (wrap-defaults site-defaults)))
12:06kwladykaoh... sorry for multilines
12:07kwladykastill i have :params as keys and :form-params as strings
12:08kwladykaanyway with your hints i am able to solve that
12:08kwladykathank you again!
12:23klebervirgilioWhat's up guys!! Who are working with clojure???
12:23lazybotklebervirgilio: Yes, 100% for sure.
12:23justin_smithlazybot: are you a dumbass???
12:23lazybotjustin_smith: Yes, 100% for sure.
12:25hellofunklazybot: (*&@#(*$%???$#&$^*()#$
12:26hellofunkoh, so *now* you get quiet
13:12justin_smithlazybot: *@#$&*#$&**??
13:12lazybotjustin_smith: Definitely not.
13:18xemdetiais this lazybot magic 8 ball day
13:20justin_smithis it lazybot magic 8 ball day???
13:20lazybotjustin_smith: Oh, absolutely.
13:24xemdetiaoh my fault
13:45code-apeHey, I'm looking at an IDE to use and am considering either Cursive or LightTable. Does anyone have any recommendations?
13:50justin_smithcode-ape: cursive is the better choice
13:51tcrayford____code-ape: I've used bolth. Light table (when I used it, maybe 6 months ago or so) had pretty gnarly perf issues if you had a file over like 100 lines or so
13:51hellofunkcode-ape: yes definitely cursive
13:52code-apetcrayford____: hunh, good to know!
13:52hellofunkcode-ape: i gave lighttable a try about a year ago and all the bugs were a real buzzkill (i used it on mac)
13:52code-apeAnd thanks justin_smith and hellofunk, I'll definitely get Cursive then!
13:53tcrayford____code-ape: documentation was also relatively bad, and customizing it seemed pretty hard. Saw a bunch of bugs as well. It has a lot of promise, but it's riddled by implementation issues imo
13:53hellofunkcode-ape: be sure to check out Colin's videos on ClojureTV youtube video, including a new one from the clojure west conference a couple months ago.
13:54code-apehellofunk: "Debugging Clojure with Cursive"?
13:54hellofunkcode-ape: yes, and there is at least 1 more from about a year ago that is a great intro to how cursive works with clojure
13:55hellofunkcode-ape: basically look at anything Colin has done, and also join his mailing list, lots of helpful people on there
13:56code-apehellofunk: will do! Thanks for the help, I always love the clojure community :)
13:58hellofunk(inc #clojure)
13:58lazybot⇒ 10
14:10jonathanjis there function that can give me the length of the common prefix between two vecs?
14:10jonathanjor rather, the length of the longest prefix match
14:12justin_smithhmm, something like ##(count (take-while (partial apply =) (map list [1 2 3 4] [1 2 3 7 8])))
14:12lazybot⇒ 3
14:13jonathanjah yeah, i guess take-while is what i was after
14:13jonathanji was also wondering if that operation had a more common name
14:14justin_smith,(count (take-while true? (map = [1 2 3 4] [1 2 3 7 8])))
14:14clojurebot3
14:14justin_smithif you just want the count, at least
15:12noncomwhat's the most iniomatic way to see if a [] contains something?
15:12seangrov`(seq [])
15:13BronsaI'd say empty?
15:13noncomoh, sorry, i have misworded my query
15:13BronsaI've never liked using seq in place of empty?
15:13noncomi meant if a [] contains a particular element
15:13noncomi can only think of (some p [])
15:14seangrov`(some #{item} []), perhaps
15:14seangrov`I often bring in a ffilter function, which is (first (filter ...))
15:14noncomwon't that be much slower than (some #(= % item) [] )?
15:14Bronsa(some #{el} vec) or (not (neg? (.indexOf vec el)))
15:14noncomso the #{} solution seems nice
15:17noncomok what's the best way to remove an item from a []?
15:17noncomi think of composing (.indexOf) with take and drop
15:31Cust0diannoncom, removing random elements doesn't seem like a good idea when dealing with vectors: they are more like stacks, rather than arrays. Any chance you can use a map instead? Then you can remove just by key – clean and simple.
15:32Cust0diannoncom, if you really need to though, something like this might work: (defn vec-remove [vector position] (vec (concat (subvec vector 0 position) (subvec vector (inc position)))))
15:33andyf_With RRB-vectors, removing an arbitrary element should be possible in something like O((log n)^2) time, rather than linear time.
15:34andyf_https://github.com/clojure/core.rrb-vector
15:36noncomyeah, well, this concern is there... but in my case this cost will be very small, so i can afford it...
16:08rs0hey all, i'm hoping to get some feedback on a project I'm developing: https://github.com/rschmitt/collider
16:08rs0the goal is to bring Clojure's immutable persistent collections to Java development
16:08rs0(I'm aware of clj-ds, this is a different approach with different trade-offs)
16:20TEttingergood plan, rs0. is there any way to get uh syntax support in any way?
16:20rs0TEttinger: what do you mean?
16:20rs0TEttinger: collection literals?
16:20TEttingerI guess java doesn't have it for its own collections
16:21rs0TEttinger: the most recent plan i've seen is to keep working on value types and specialization, see what impact that has on collections, and then figure out how to retrofit collection literals into the language
16:21TEttingerthat stream work is nice!
16:21rs0TEttinger: they are reluctant to special-case HashSet and ArrayList and friends, they may end up doing something more extensible like C++11 did
16:22rs0TEttinger: oh thanks. i'm irrationally proud of the convenience methods, personally
16:23rs0TEttinger: I have a lot of experience doing Java 8 development. i absolutely love streams, but if i never have to write .stream().map().collect(Collectors.toList()) again it'll be too soon. which is fine--i'm glad they built something simple that i can then make more ergonomic
16:23TEttingerthat actually looks like it makes functional, immutable stuff usable in Java (!)
16:23rs0TEttinger: i see this project as a complement to dynamic-object https://github.com/rschmitt/dynamic-object
16:23rs0TEttinger: which I see as solving much harder problems
16:23TEttingertoo bad Android won't get lambdas... ever
16:24rs0gee, i wonder why i have no desire to work in "mobile"
16:25rs0is the javadoc for maven projects hosted anywhere?
16:26rs0can I just link to it? it's probably easier than "read the unit tests"
16:27ely-seTEttinger: you can use Go on Android and Go has lambdas :P
16:27rs0ely-se: is that only true as of Go 1.5? (the android part, not the anonymous functions)
16:27ely-se1.4 IIRC.
16:28rs0TEttinger: anyway, collection literals aren't the biggest problem, Java's type system is
16:29TEttingerDynamic Object looks nice, rs0
16:29rs0TEttinger: Java's type system isn't really able to support abstract type-safe persistent collections
16:29rs0TEttinger: DynamicObject has served me extremely well in production; it's a fairly mature library
16:31TEttingerI need to listen to some more Meshuggah. all I know about them is that the album Ziltoid the Omniscient by Devin Townsend (and ONLY Devin Townsend, the entire band is him) used samples of Meshuggah's heavy drumming instead of him learning the drums, like he did for every other instrument
16:31rs0you mean they used the DfH samples?
16:31TEttingeryes, probably
16:31clojurebotNo entiendo
16:34TEttinger(that approach is pretty amazing when it works... I've been doing all the art and code for my games myself, but also doing the fonts. I can't totally do a full-stack game because I have pretty much 0 musical skill)
16:35aztak /whois TEttinger
16:35TEttingerhehe
16:35oddcully:*)
16:36rs0TEttinger: anyway, java 8's return type inference makes java pretty tolerable, despite the lack of true collection literals. you can say say something like: List<Integer> list = clojureList(1, 2, 3);
16:36rs0maps are a bit more limited, but i did what i could there as well
16:36TEttingeryeah, DynamicObject looks like a good solution
16:38rs0i think it strikes a really good balance between static typing and the inherent dynamism of serialization/deserialization. i also think that the implementation strikes a really good balance between minimizing boilerplate and minimizing magic, since Java is very *very* limited when it comes to metaprogramming
16:39rs0DynamicObject used to be implemented purely as an ordinary InvocationHandler, but more recently i switched to invokedynamic-proxy which has allowed a lot of improvements (e.g. i can implement IPersistentMap etc without actually advertising those interfaces on the Java side)
17:20lvhDoes ISeqable imply immutable?
17:20gfredericksprolly not
17:21lvhI'm trying to figure out if FileList (a browser thing) should be iseqable
17:21gfredericksnot sure if there's a counterexample in clojure though
17:21gfredericksa quasi-counterexample are arrays
17:21gfredericksmight be an actual counterexample in CLJS
17:21amalloylvh: the problem is that if you create a seq wrapping a mutable object, it tends to break when you modify the underlying object
17:22lvhok, that makes sense
17:22amalloylike for example, transient vectors aren't seqable in clj-jvm
17:22gfredericksbut arrays are, and have that weakness
17:22lvhIs there a better option than (into [] my-thing)?
17:22amalloygfredericks: yes. it's not super consistent
17:22lvhIf I can promise that it won't mutate
17:22gfredericks~clojure is not super consistent
17:22clojurebotIn Ordnung
17:22lvhwell, hey, maybe it does
17:22rs0arrays have many weaknesses =\
17:23amalloybut i sorta guess that seqing arrays is something that was deemed necessary for convenient interop, whereas seqing transient vectors is a thing you can just tell people not to do
17:23gfrederickstotes
17:27jeffcarpcan a project.clj file reference values in itself?
17:40rs0does anyone here have experience using RRB vectors?
17:40rs0from https://github.com/clojure/core.rrb-vector ?
17:41rs0oh my god. this is a ton of clojure code
17:41rs0https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj
17:45creeseFor Stuart Sierra's component lib: Can a key in the system map point to a list?
17:46amalloycreese: why not? it points to any old object afaik
17:48creesecan you instantiate an object inside 'map'?
17:49amalloyit is pretty hard not to
17:50creeseI thought you couldn't have side effects
17:51arohnercreese: you *can* have side effects, it's just not recommended
17:51arohnerbecause laziness, and chunking
17:51arohnerbesides, object creation isn't really a side effect
17:52amalloyif creating objects counted as a side effect, you could never get anything done
18:28amalloycfleming: i restarted idea recently, and a clojure project that looked fine last time i touched it now has every symbol highlighted with "can't resolve symbol ____"
18:28cflemingamalloy: Does File->Invalidate caches and restart fix it?
18:42amalloycfleming: a restart yields this error message: https://gist.github.com/amalloy/1660138e310101fc7881 - running gpg from the command-line, or lein deploy clojars or whatever, successfully decrypts my credentials (using the stuff in my keychain, i think)
18:43amalloyand java -version prints 1.8.0_45, so i am a little confused as to why it is looking for tools.jar:1.7 inside a directory named 1.6.0.jdk
18:44justin_smithis taonsso on here by some other nick?
18:52cflemingamalloy: That is a very confusing message. I think the main fix would be to configure your gpg executable path (Settings->Other->Clojure->Leiningen).
18:52cflemingamalloy: I'm not sure what that tools error means - normally it gives that error when lein can't download a dep for some reason.
18:53cflemingamalloy: Re: 1.6 - I'm assuming you're on OSX here. By default IntelliJ runs under 1.6 on OSX due to a tragic series of bugs on later versions.
18:55cflemingamalloy: It's so bad that JetBrains are actually developing and bundling a custom JDK now - see https://cursiveclojure.com/archive/1189.html#1193
18:56cflemingamalloy: However I disagree with his conclusion - 1.6 is still a better solution unless you happen to hit bugs with it (which can happen under Yosemite)
18:56amalloycfleming: i've set my gpg to an absolute path and am restarting it again
18:57cflemingamalloy: Oh, sorry, you don't have to restart, just refresh lein from the lein toolwindow - but restarting should work too :-)
18:57amalloywell, i don't get the gpg error anymore, but still this tools.jar stuff and all symbols are unrecognized: https://gist.github.com/amalloy/9f06027734734a91b348
18:57cflemingThe JDK thing is really a pain, and can affect lein since Cursive runs lein in-process, so sometimes there are subtle differences.
18:58cflemingamalloy: That's bizarre. Are you able to share your project.clj - is it a public project?
18:59amalloycfleming: it's not public, but i can probably anonymize out the com.factual non-public dependencies
18:59TEttingeramalloy: cfleming: I know at least one person had issues with certain OpenJDK builds on mac, but they were fixed by using the Zulu builds
18:59TEttingerhttp://www.azulsystems.com/products/zulu
18:59TEttingernot sure if applicable to IDEA
19:00cflemingTEttinger: I haven't tried Zulu but the serious bugs relating to IntelliJ are all AWT/Swing bugs, which I'm assuming are not a priority for Azul
19:00TEttingeractually this was related to X not being installed with OpenJDK 7 by default
19:00cflemingamalloy: If you do a deps-tree on the command line, I'm assuming there's nothing tools related in there?
19:01TEttingerso I think they did fix some of it, since X is not a mess with zulu, similarly to Oracle JDK
19:01cflemingTEttinger: Thanks, I'll take a look and give it a go
19:01clojurebotNo entiendo
19:02TEttingerit makes a lot of sense for Mac in particular since they only do 64-bit builds right now, but Mac always can run 64-bit
19:02TEttinger(well recent OSX anyway)
19:02amalloycfleming: there's one, maybe: [org.apache.hbase/hbase-annotations "1.0.0-cdh5.4.0"] [jdk.tools "1.7" :scope "system"]
19:02TEttingerjdk.tools ?
19:02TEttingerwhat is that?
19:03amalloybeats me. apparently hbase-annotations depends on it
19:03cflemingamalloy: Ok, I bet that's it. I don't know what that :scope "system" means but I bet you it tries to get it from the current JDK, and that doesn't work under 1.6.
19:03amalloyprobably so
19:04cflemingtools.jar contains things like the JDI classes.
19:04TEttingerhttp://stackoverflow.com/a/3080695
19:04cflemingamalloy: Can you exclude that dependency?
19:05TEttingerthat stack overflow problem: The problem is that the path is not correct for Mac Os X (however it is correct for Windows and Linux).
19:05cflemingI'm actually not sure how that dep is supposed to work since tools.jar doesn't exist on OSX anyway
19:05cflemingRight
19:06TEttingerit's called classes.jar
19:06TEttinger ${java.home}/../Classes/classes.jar.
19:06cflemingYeah, the contents of tools.jar are in with all the other classes.
19:06TEttingerinteresting
19:06cflemingI'm not sure whether that still applies to non-Apple JDKs
19:06TEttingerI'll download a zip of mac zulu, see what it has
19:07cflemingI just checked on my machine, later JDKs do have it.
19:07amalloycfleming: i can't figure out how to exclude it, no. it comes in like five levels removed transitively
19:09cflemingamalloy: Can you use this? https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L65
19:09TEttingerzulu has a tools.jar in {root of JDK}/lib/
19:09amalloyno, that is the one thing i tried
19:09amalloybut it is still in deps :tree
19:09cflemingamalloy: sorry, I realise it's not ideal to have to do this to placate your editor, but the JDK story is a mess.
19:09amalloyi think because the "system" scope does weird stuff
19:09cflemingOk
19:10cflemingI'm going to ask in #leiningen
19:10TEttingerI'd maybe submit that as an issue to the hbase lib
19:10amalloyi imagine the answer would be, it works with maven
19:12TEttingerbut I think maven on Mac may still be borked with that
19:12cflemingOnly on Mac running 1.6
19:12cflemingWhich basically no-one but IntelliJ users does these days.
19:13cflemingamalloy: One solution is to run IntelliJ with the bundled JDK, but it can be flakey.
19:13cflemingamalloy: Unfortunately on OSX you end up choosing the JDK which annoys you the least
19:14cflemingJDK6 will get more and more buggy with future OSX releases, I'm pretty sure.
19:15amalloyi mean, i don't even want very badly to use cursive to edit clojure code. it's ust weird that it used to work, and stopped working only when i restarted my machine. i wonder what changes i made in the month between restarts
19:15cflemingYeah, that is strange. Is it possible that dep was added recently?
19:16cflemingI can't see how that dep would ever have worked under 1.6
19:19cflemingI actually can't find anything in the lein doc about :scope system at all - I suspect it gets passed right through to Aether.
19:19TEttingeroh maybe because it's "scope"
19:20TEttinger(makes me think you're right, it's java-like because it isn't a keyword)
19:20cflemingamalloy: If you're not using Cursive as your main editor but just for debugging or something, the simplest solution is to use a later JDK for IntelliJ. Otherwise the only thing I can think of would be to exclude the hbase annotations and hope they're not required by whatever you're doing.
19:21cflemingSorry I don't have a better solution.
19:21amalloyhow would i use a later jdk?
19:22cflemingProbably the best solution is to download IntelliJ with the bundled custom JDK. Are you on Community or Ultimate?
19:24cflemingUse https://download.jetbrains.com/idea/ideaIC-14.1.3-custom-jdk-bundled.dmg, and swap IC for IU if you're on Ultimate.
22:05nf7Is Clojure a good Lisp to start with?
22:06Faresure
22:06Fareto start what?
22:06Farepeople here are unlikely to strongly dislike clojure
22:06nf7To start learning about programming in Lisp, from the perspective of someone who's only experience of Lisp is Emacs Lisp.
22:07FareDepends what you call "Lisp", but Clojure is an overall very nice language.
22:07Fareand definitely a Lisp.
22:07Farebut not a traditional one — for the better and worse
22:07nf7Hmmm.
22:12Fareits data structure story is more modern than traditional lisps
22:13Fareits control structures are stunted by direct mapping to tehe JVM
22:15Fareso I'd say it's a wash here.
22:16Fareif you like the JVM ecosystem or are stuck on it, Clojure is a great choice.
22:16Fareif you yearn for speed, not so much.
22:17Fareclojure is GREAT for concurrency, too.
22:17Farealthough admittedly, Racket is quite good at that, too
22:19Farein other words, there is no perfect Lisp, but Clojure is one of the good ones, and in many circumstances, a great recommendation.
22:20Fareif you like modernity, concurrency, data structures, conciseness, the JVM, purity-by-default, Clojure is just great.
22:21Fareif you like tradition, raw speed, control structures, macro-defining-macros, anything-but-the-jvm, or side-effects-by-default, Clojure is not so great.
22:31Niacis it possible to work without java libs in clojure?
22:32NiacI find it hard to remember all the java libs
23:03echo-areaI have updated in project.clj the dependency to org.clojure/tools.nrepl 0.2.10, but lein deps :tree still shows a dependency to nrepl 0.2.6. Does anyone know a possible reason?
23:09echo-areahttp://www.codedisqus.com/CSVVPVqXgk/how-to-upgrade-nrepl-version-of-leiningen.html
23:09echo-areaI found this
23:09echo-areaAnd :replace worked. I need to look into it though
23:15echo-areahttp://stackoverflow.com/questions/28688721/how-to-upgrade-nrepl-version-of-leiningen (for a better source of info)
23:17justin_smithNiac: clojure is a java lib
23:18justin_smithNiac: especially with cljs becoming more popular it's viable to mostly use stuff that is 100% clojure on the api level, but clojure's better if you go ahead and use the platform where apropriate
23:22FareNiac: yes, you can work without Java libs in clojure, though you lose one of the strong points of Clojure, doing it
23:22FareWhen I debug clojure code in emacs, I don't get inspectable stack frames like I have with common lisp code.
23:22Fareis there a way to debug clojure code with stack information?
23:32cflemingFare: Cursive contains a full debugger implementation
23:32cflemingFare: Contains inspectable stack frames, and much more
23:33cflemingFare: (full disclosure - I develop Cursive)
23:35Farenice
23:35Fareis it working yet?
23:37Farehow do I get on the EAP?
23:37cflemingFare: Yup - https://cursiveclojure.com/userguide/
23:38cflemingFare: I spoke at Clojure/West this year about the debugger if you're keen to check it out: https://www.youtube.com/watch?v=ql77RwhcCK0
23:38cflemingFare: Talks about the functionality and some of the limitations
23:39gkoWill Cursive become a standalone product like RubyMine or PyCharm?
23:39Farethanks
23:39FareI'll put that on my todo list
23:39cfleminggko: That's my plan, yes, as well as being a plugin
23:40gkocfleming: nice. I'm on Ultimate, so I guess the plugin would work as the current EAP?
23:40cfleminggko: Right
23:41cfleminggko: The same licence will work for both, in case you want to switch for whatever reason.
23:42gkocfleming: what do you mean?
23:42seangroveWhat's a good way to read-string an entire clojure source file?
23:43seangroveIf I (read-string (slurp ...)) I (of course) only get the first form
23:43cfleminggko: If you pay for Cursive and start using the standalone version, then decide you want to buy IntelliJ Ultimate and keep using Cursive, your previous licence will continue to work for the plugin in IntelliJ
23:43cfleminggko: You could also switch the other way, although I'm not sure why you'd want to if you have Ultimate
23:44seangroveNevermind, found http://stackoverflow.com/questions/6840425/with-clojure-read-read-string-function-how-do-i-read-in-a-clj-file-to-a-list-o
23:46gkocfleming: you mean the plugin in Ultimate will have its own licence?
23:47cfleminggko: Yes, I don't work for JetBrains so it won't come with Ultimate like the Python or Ruby plugins do.
23:51gkocfleming: I see... But if there's a global Cursive licence, it means I could run just Cursive standalone instead of full blown IDEA, which can be slow...
23:53cfleminggko: Yes, that's true, although if you disable all the plugins in Ultimate it's pretty much the same thing.
23:57gkocfleming: yes... so, it will be like RubyMine/PyCharm but for Clojure? Will the licence be cross-platform? etc...
23:57cfleminggko: Yes and yes. The only difference is that it won't include JetBrains web technologies, unless I can come to an agreement with them.
23:59gkocfleming: great. what do JetBrains web technologies bring? HTML/CSS/JS...-related stuff?