#clojure logs

2015-05-12

00:46cddrSay you submit a PR to a clojure project that you want to use from your own project...
00:46cddrIt's been merged but not yet released
00:46cddrWhat's the best way to reference the "-SNAPSHOT" version in your own project?
00:48TEttingercddr: it depends if they're publishing snapshots to clojars I suppose
00:48cddrYeah they are not
00:48cddrI guess I could see if they would mind doing that
00:49TEttingermy approach, which is probably terrible, is to do a temporary unofficial fork and put it on clojars with a clearly unofficial name, like com.github.tommyettinger/whatever instead of the project whatever
00:50TEttingerthen your dependency is on the unofficial fork until it gets merged back
00:53cddrThat was the other thing I thought of. Doesn't sound too terrible
01:20escherizeanyone know the cure for uberjar woes?
01:22escherizeI successfully compiled an uberjar. When I run it with java -jar myuberjar.java I get a stack trace with: java.lang.ClassNotFoundException: clojure.tools.nrepl.transport.Transport
01:25lokeWhy is it that when I call "recur" it calles the outermost lambda function if the argument count matches? That seems just bizarre to me.
01:25lokeIn other words: (defn foo [x] ((fn [y] ... (recur A)) x))
01:26lokethe recur call in that example will call "foo"
01:26lokeBut...
01:26loke(defn foo [x z] ((fn [y] ... (recur A)) x))
01:26lokeIn the latter example, recur will call the inner lambda function. That can't be right. I'd expect it to always call the inner one.
01:30TEttingerloke, hm that is odd. recur is very rarely used outside of loop, in my experience
01:31lokeTEttinger: Well, I'm not experienced much in the clojure way of doing things, but it's quite natural for me to define a recursive algorithm using a lambda function. Perhaps it's because many other functional languages doesn't have explicit recursion.
01:31TEttingerescherize: how did you make the uberjar?
01:33TEttingerloke: mainly because just calling recur won't give you tail recursion optimization, IIRC -- it needs loop so it knows to compile down to similar code as a java while loop, reducing the chances of a stack overflow
01:34lokeTEttinger: Yes, of course. I know this. The thing that confuses me is that the compiler decides that the recur belongs to the _outer_ function if they both have the same argument count. The funny thing is that that gives the error "can't recurse here" when the more obvious inner function is a perfectly legal recur target, as evidenced by the fact that all works fine if I add an extra dummy argument to the outer function.
01:35TEttingeryeah, that is odd
01:35TEttingeralso, just so you know: fn can have a name, like defn
01:35lokeCan I specify an explicit target for the recur?
01:37TEttinger,(defn foo [x] ((fn bar [y] (if (> y 50) y (bar (+ y x)))) x))
01:37clojurebot#'sandbox/foo
01:37TEttinger,(foo 6)
01:37clojurebot54
01:37TEttingerI'm not sure what using recur even does outside of loop
01:41lokeSupposed to call the innermost lambda
01:41mbufis there a non-Oracle JVM for Clojure?
01:41lokeHowever, seems my initial assessment wasn't actually correct. I'm still trying to understand under eactly what circumstances it calls the outer one
01:41TEttingermbuf: OpenJDK works just fine.
01:42TEttingeravian might if you can compile it with openjdk's class library or the android one, but I doubt it
01:43TEttinger$google zulu openjdk
01:43lazybot[Zulu: 100% Open Source commercialized build of OpenJDK™ | Azul ...] http://www.azulsystems.com/products/zulu
01:44TEttingermbuf, if you're looking to distribute a JVM, that might be a good option. they should have 32-bit builds sometime soon, but otherwise if you only care about servers and 64-bit, they seem good
01:44TEttingerotherwise, alexkasko makes openjdk 7 builds available
01:44TEttinger$google alexkasko openjdk
01:44lazybot[alexkasko/openjdk-unofficial-builds · GitHub] https://github.com/alexkasko/openjdk-unofficial-builds
01:44mbufTEttinger, the openjdk site says it is copyright by Oracle
01:44TEttingerit's GPL IIRC
01:45TEttingerbut it isn't the same as oracle's JVM
01:45mbufTEttinger, okay
01:45TEttingerthe oracle jvm (the one you download when you go to java.com or the oracle site) has a bunch of bundled junk, but also performs a few optimizations the others don't
01:46TEttingerhowever!
01:46TEttingeropenjdk can be legally modified and rereleased
01:46TEttingeryou can take one of alexkasko's builds, remove all of the swing stuff if you don't need it, and have a smaller binary
01:47TEttingerthe one from oracle.com cannot be legally modified and rereleased, though I think you can rerelease it if you give their official installer only? in general, bundling should use an openjdl
01:47TEttingerjdk
01:47mbufTEttinger, okay
04:32borkdudeis there also a deep merge in clojure, that returns this: (merge {:a {:b 1}} {:a {:c 2}) ;;=> {:a {:b 1 :c 2}}
04:34Glenjamin(doc merge-with)
04:34clojurebot"([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
04:37borkdudeGlenjamin that doesn't merge an arbitrarily deep nested map, or does it?
04:37borkdude,(merge-with merge {:a {:b 1 :d {:a 1}}} {:a {:c 2} :d {:b 2}})
04:37clojurebot{:a {:b 1, :d {:a 1}, :c 2}, :d {:b 2}}
04:37Glenjaminit can, with a bit of fiddling around
04:38Glenjamini think you'd need to make it recursive
04:40opqdonutyep
04:40opqdonut,(merge-with merge {:a {:b {:c {:d 1}}} {:a {:b {:c {:e 2}}}})
04:40clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
04:41opqdonut,(merge-with merge {:a {:b {:c {:d 1}}}} {:a {:b {:c {:e 2}}}})
04:41clojurebot{:a {:b {:c {:e 2}}}}
04:44hyPiRion,((fn f [m1 m2] (merge-with f m1 m2)) {:a {:b {:c {:d 1}}}} {:a {:b {:c {:e 2}}}})
04:44clojurebot{:a {:b {:c {:d 1, :e 2}}}}
04:44opqdonutindeed
04:46borkdudehyPiRion Thanks :)
05:03borkdudeI recently built a ruby on rails app and while I was doing it, I was wondering the following evil thought: has someone tried to make a mutable domain model for persistence like you have with ActiveRecord in a clojure app?
05:05borkdudewhat was a bit annoying when I was testing a clojure application was, that I had to write my DDLs in a different SQL dialect just for testing. Usually those ORM libraries give you that for free.
05:38socksywhat do you mean by a mutable domain model?
05:55borkdudesocksy I mean mutable objects like you have with activerecord, hibernate, etc.
06:07socksylike atoms?
06:20Ricardo-ArgesHi
06:20Ricardo-ArgesI've got a bit of code blindness here, so I could use an extra set of eyes.
06:20Ricardo-Argeshttps://gist.github.com/ricardojmendez/a8460fe868c1ff6848c6#file-project-clj-L121-L122
06:21Ricardo-ArgesI can't get figwheel to actually call that handler on reload, even though reload _is_ properly taking place.
06:23Ricardo-ArgesI have a workaround so I don't need it, but it's bugging me.
06:25oddcullyisn't :builds a list?
06:25wasamasaI don't get how to insert an array of bytes into a database column that wants a blob
06:25oddcullye.g. https://github.com/bhauman/lein-figwheel/wiki/Quick-Start#third-option-on-jsload
06:25wasamasathe javadoc for blob tells me how to convert it back to the byte array
06:27oddcullyand by list i mean vector
06:31Ricardo-Argesoddcully: Going to check if it changed, the default luminus template created it as a map by default, and it's getting the other values correctly (like the externs I added).
06:34oddcullyRicardo-Arges: blind guesswork on my end. my last lein new figwheel and the wiki state this. also note, that the wiki states 0.3.1 is the version for this syntax
06:35Ricardo-Argesoddcully: Thanks, will review.
06:37oddcullyRicardo-Arges: you might also want to ask this question in #clojurescript
06:37Ricardo-ArgesWill do, going to tie some things up and run some tests first.
06:56wasamasahmm, it was some other SQL thing, inserting blobs works actually
07:47kaiyin,(into (sorted-map) [[:b ["hi"] [:a 1]]])
07:47clojurebot#error{:cause "Vector arg to map conj must be a pair", :via [{:type java.lang.IllegalArgumentException, :message "Vector arg to map conj must be a pair", :at [clojure.lang.APersistentMap cons "APersistentMap.java" 35]}], :trace [[clojure.lang.APersistentMap cons "APersistentMap.java" 35] [clojure.lang.RT conj "RT.java" 638] [clojure.core$conj__4095 invoke "core.clj" 85] [clojure.lang.PersistentVec...
07:47justin_smithI think you have a misplaced closed bracket
07:47kaiyinah, yes.
07:48justin_smith,(into (sorted-map) [[:b ["hi"]] [:a 1]])
07:48clojurebot{:a 1, :b ["hi"]}
07:48egliborkdude: doesn't korma shield you from sql dialects?
07:50borkdudeegli can you do ddl with korma?
07:50egliborkdude: uh, that i don't know
07:50borkdudeegli that's where I run into this, not with my normal queries, those are pretty standard
07:50egliic
07:51egliI agree
07:53borkdudeso maybe a better question would be: is there something that shields me from different sql dialects in clojure, especially when it comes to ddls?
07:54egliborkdude: looks like you have to fall back to raw, which defeats the purpose
07:56egliborkdude: Honey SQL lists "Create table" under TODO
07:56justin_smithborkdude: caribou abstracts over postgres, mysql, and h2
07:56bcn-florHow do I check if a vector contains a value from a list of values ? eg. I need to see if a vector v contains any element with the value :env, :tag or :meta ?
07:56justin_smithbut it also uses these all in a unique way, it is not just an sql frontend
07:57justin_smithbcn-flor: ##(some #{:value :tag :meta} [:a :b :c])
07:57lazybot⇒ nil
07:57justin_smithbcn-flor: ##(some #{:value :tag :meta} [:a :b :value :c])
07:57lazybot⇒ :value
07:57borkdudejustin_smith it would be nice if that could be used as an independent library?
07:57justin_smithborkdude: that's all caribou-core is
07:57justin_smithis the db abstraction
07:57justin_smiththe web stuff etc. is all other libs
07:57borkdudejustin_smith I'll check that out then
07:58justin_smithborkdude: but as I said it is not just a frontend for sql, it uses sql tables in its own manner
07:58justin_smithI am probably explaining that badly
07:58borkdudejustin_smith hmm, yeah ok. I might just write my own bare bones sql generation thingie probably then
07:59justin_smiththe difference with caribou's model is that the data model is modeled in the table, and all queries and results are presented as edn
08:00egliborkdude: have you looked at Lobos?
08:01egliLobos is a SQL database schema manipulation and migration library written in Clojure. It currently support supports H2, MySQL, PostgreSQL, SQLite and SQL Server
08:01bcn-florjustin_smith: thanks
08:01borkdudeegli that might do it. I've even used it in the past, but forgot about it
08:02egliit seems a bit stale but if you've used it before it should be ok
08:27powrtoc_`Does anyone know how to print an object defined by a deftype, in a way that's readable via the clojure reader?
08:28powrtoc_`e.g. (deftype Foo [arg]) has a readable implementation #user.Foo ["my arg"] -- but how do I ask such a thing to print itself?
08:28justin_smithpowrtoc_`: the easy way is to use a defrecord instead of a deftype
08:28powrtoc_`justin_smith: yeah I know that :-) just wondering how to do it with a deftype
08:28justin_smithpr-str
08:28justin_smithor pr rather than print (prn rather than println)
08:29powrtoc_`they don't work
08:29powrtoc_`they yield: #<Foo grafter_server.repl.Foo@74c6caac>
08:29justin_smithhow do you know (deftype Foo [arg]) has a readable implementation | #user.Foo ["my arg"]
08:29justin_smithif it never prints?
08:29kaiyinWhat's wrong with this macro? https://gist.github.com/kindlychung/dc979b308a4bbb800415
08:30powrtoc_`justin_smith: because I defined it, and I'm only putting readable arguments into it
08:30mpenetpowrtoc_`: you can define your own print-method
08:31powrtoc_`ok was wondering about that
08:31mpenet(doc print-method)
08:31mpenet,(doc print-method)
08:31clojurebot"; "
08:31mpenetbah
08:31clojurebot"; "
08:31mpenethttps://clojuredocs.org/clojure.core/print-method
08:33powrtoc_`mpenet: Thanks
08:34kaiyinah, should be aset instead of aget.
08:47kaiyinhow do you make sure that a macro inside a let form has access to local vars? for example: https://gist.github.com/kindlychung/10bd14ecc4349f818c30
09:00crocketWhere does it take 1-2 seconds to start a hello world program on clojure?
09:00Glenjaminthe clojure compiler likes to build up the suspense
09:01justin_smithcrocket: yeah, it's the compiler
09:01crocketjustin_smith, a jar file takes 1-2 seconds to load.
09:01justin_smithcrocket: the jar file isn't loading the clojure compiler, is it?
09:02justin_smithThere are other factors. Lein and nrepl are both also slow to start.
09:02justin_smithand most people, when they run clojure, start up lein, and nrepl
09:03crocketSomeone said it's as easy to shoot yourself in the foot with clojure as with C++.
09:03crocketWhat is the truth?
09:03justin_smithit's not easy, but it's possible
09:03crocketHe said I would need as much discipline as a C++ programmer to use clojure without shooting myself in the foot.
09:04crocketI personally think C++ requires the most discipline.
09:05wasamasacrocket: unless seeing java backtraces counts, I doubt that really
09:06hyPiRionI'm not sure what discipline means though – they are entirely different languages altogether, so it's hard to compare them.
09:06crocketwasamasa, Does your nickname come from japanese?
09:06wasamasacrocket: nope
09:07crocketI'm dangerously intelligent.
09:08justin_smithcrocket: one thing c++ and clojure share is that they provide abstractions over the lower level, but don't really prevent you from using it directly (along with all the risks of doing so)
09:08justin_smithin other ways c++ and clojure are very different though
09:09crocketjustin_smith, Can you give me specific examples of abstractions over the lower level that C++ and clojure share?
09:09justin_smithcrocket: they have different abstractions
09:10justin_smithbut they both let you ditch the abstractions and work at a lower level
09:10justin_smithclojure's primary abstractions are immutable datatypes and function closures
09:11crocketCan you call clojure functions in scala easily?
09:11crocketor in java?
09:11justin_smithyes, via clojure.lang.RT
09:13crocketVery good
09:13crocketjustin_smith, People say clojure is slow on android or on JVM.
09:13crocketWhy do they say that?
09:13crocketWhat is clojure slow for?
09:13wasamasabecause it is?
09:13crocket3D games?
09:14crocketandroid 3D games
09:14mpenetthey mean slow startup time, at least for android
09:14wasamasathe startup of the jvm is
09:14crocketAfter the startup, is it still slow?
09:14wasamasanah
09:14hyPiRiondefine slow
09:14mpenetas slow as a jvm can be, so I doubt it
09:14crocketI can't.
09:15drbobbeatycrocket: I've done quite a bit of performance tuning in clojure - and C++ - and clojure is very very good for a JVM-based language.
09:16drbobbeatycrocket: Is it going to compete with hand-tuned C++ code? Nope, but that's an extreme case, and it takes a long time to write that kind of C++ code.
09:16crocketdrbobbeaty, hand-tuned C++ code?
09:16drbobbeatycrocket: ...but I'm running on server boxes - not tablets or phones.
09:17crocketok
09:17crocketWhy would anyone want to use C++ instead of Rust or C?
09:17mpenetthere's always jni for these extreme cases
09:17crocketJVM is reasonably fast for extreme cases...
09:17crocketI mean java
09:17drbobbeatycrocket: Imagine you have an algorithm - easy to understand, but by jumping the loops in sets of three, you actually get a significant performance boost. Knowing these tricks makes a big difference in the right environments. And they are **not** obvious.
09:18mpenetI used clj + jni for some hardcore physics simulations, the bits that had to be fast were c++, rest clojure
09:18crocketdrbobbeaty, I would rather look for conceptual efficiency.
09:18crocketThat's a low-hanging fruit.
09:20justin_smithwhat is conceptual efficiency?
09:24crocketjustin_smith, Using a different kind of algorithm.
09:25mpenetcrocket: it is fast enough for most cases. In this example the c++ stuff was the result of years of work/tunning by people way smarter than me, no way I'd rewrite that. I guess the same can be said for 3d stuff on android: there are plenty of (fast) game engines out there already
09:26crocketmpenet, It's 'people' who are smarter than you. not a person.
09:27crocketA person can't become intelligent without intelligent groups.
09:46crocketYay
09:47crocketThe joy of clojure...
09:48wasamasasomehow I suspect I've not put the binary data into the database the proper way
09:48crocketHow many times is java as fast as clojure after loading?
09:48wasamasaas no matter what I do to retrieve them, I only get errors about the object already being closed
09:48TimMccrocket: Unfortunately, that's not a meaningful question.
09:49crocketWhy is clojure not suitable on android for now?
09:49wasamasamust be BLOBs being stream-like, meh
09:49TimMcIt depends on how you write your code. For the same task, you could write the Clojure to do exactly the same thing as you would in Java, or in more idiomatic Cloure style.
09:49crocketBecause clojure people care enough about android?
09:49crocketBecause clojure people don't care enough about android?
09:51wasamasacrocket: these questions start sounding trollish
09:51wasamasacrocket: or worse, gavino-like
09:52andrei222I just had a question "how about core.match performance?"
09:52crocketI just heard people in #android-dev say things in the line of 'you don't want to use clojure on android for now'.
09:52andrei222afaik there performence for core.match is not an issue. Anyone has a different opinion ?
09:52andrei222s/there/th
09:52andrei222*the
09:54TimMccrocket: Something about classloaders, I think.
09:54crocketThere is an android app written in clojure. https://play.google.com/store/apps/details?id=com.swiftkey.clarity.keyboard
09:55TimMccrocket: Anyway, read this over: http://clojure-android.info/
09:55TimMcmostly the second chunk of the Rationale section
11:12datazombiehello, I am new to clojure and I was wondering where can I start learning about making an rest api with clojure
11:13maio`datazombie: (no expert here) maybe http://clojure-liberator.github.io/liberator/
11:15Ricardo-Argesdatazombie: Liberator is a good library, but make sure you understand the decision graph.
11:16Ricardo-Argesdatazombie: In fact, if you're completely new to Clojure, you probably should start here: https://pragprog.com/book/dswdcloj/web-development-with-clojure
11:16datazombieI read the book already
11:17datazombiejust asking if the knowledge in it was still current
11:17Ricardo-ArgesShould have said that first then. :-)
11:17Ricardo-ArgesYes, for the most part. There's some APIs that have changed in minor ways, but if you've already gone through the book, I expect you've found them.
11:19datazombiethanks
11:34dysfunis there an equivalent to 'partial' but which returns puts received arguments *after* the args the returned function takes?
11:34wasamasawhat could possibly cause storing binary data in h2db (with the BINARY type) result in characters like ä being replaced with the codepoint 65533?
11:35dysfuni find myself writing a lot of #(foo % bar)
11:35wasamasaI'm uploading a file with enctype=multipart/form-data and retrieving gives me mangled data
11:39wasamasaprintln on the data as received when uploading indicates that it happens at this point, but no clue why
11:40wasamasacould it be because java bytes are signed?
11:40mnngfltgIs there a way to pretty-print a map with keys ordered?
11:41mnngfltg(pr-str {:a 1 :b 2}) => "{:b 2, :a 1}" <-- but I'd prefer alphabetic ordering
11:41dysfunhave you tried (sorted-map) ?
11:41dysfunthere are almost certainly some pretty-printers that do it too
11:42kaiyinhow come there isn't any difference in performance here? https://gist.github.com/kindlychung/c0568e86ffe6f6566077
11:43mnngfltgdysfun, yes but I couldn't find the option with `fipp` or `clojure.pprint/pprint`
11:56wasamasait's because the bytes were signed...
11:56wasamasaenough java idiocy for today
11:56pjstadigis there a way to get figwheel to listen on a secure websocket?
11:57justin_smithwasamasa: you silly, all bytes are signed in java-world
11:58justin_smithoh wait, you just said that
11:58wasamasawhy.jpg
11:58justin_smithbecause having signed and unsigned types is needless complexity, of course
11:59wasamasaI mean, everything else was using signed bytes
12:00justin_smithin the future java will have signed bits too
12:00justin_smithvalues are -0 and 0
12:01wasamasa*unsigned
12:02mnngfltgdysfun, using this to sort a map for pretty printing now: (defn sort-map [m] (if (map? m) (into (sorted-map) (map (fn [[k v]] [k (sort-map v)]) m)) m))
12:06dysfunmnngfltg: ah, nice
12:48phillordNow, how do I jump to the test namespace in Emacs these days?
12:53Glenjamin(update-in votes [name] #(inc (or % 0)) ; is there a nice way to nil-save increment a key in a map?
12:55oddcully,(merge-with + {:a 1 :b 2} {:c 1})
12:55clojurebot{:a 1, :b 2, :c 1}
13:11uris77what is the recommended way to test core.async in clojure? I have a "mult channel" with two taps. I'm trying to test what happens when different types of data are sent to the channel, but I can only have one test per file.
13:11uris77Even after adding a sleep
13:12uris77I'm just starting with core.async, so I know I'm doing it wrong.
13:18justin_smithuris77: why only one test per file?
13:21uris77okay, so I'm trying to test the following: when an item is saved, the data is pushed to two channels, and each channel transforms it and persists it into two separate databases.
13:22uris77when I have two tests that call this logic, test1 won't finish before test2 starts to push more data
13:23justin_smithuris77: I would wait on delivery of a promise, and make sure the promise is delivered after all conditions in the prior test have finalized
13:24uris77okay, thanks. Will try that.
13:24justin_smith(deftest foo-test (let [done (promise) ...] ... @done)
13:24justin_smiththat won't return until somebody either kills the thread, or delivers a value to done
13:27ecorrinGlenjamin: You can use: (update-in votes [name] (fnil inc 0))
13:27Glenjaminah, fnil!
13:28Glenjaminfinally, a chance to use it
13:29justin_smith(inc fnil)
13:29lazybot⇒ 4
13:29justin_smithGlenjamin: the great part is trying to explain fnil to the coworkers, which involves saying it out loud over and over until it sounds like something from doctor seuss
13:29justin_smithI pronounce it with one syllable, the fn being a single sound
13:59timvisherclojure classpaths are left-most wins?
14:07Zhadnif I'm writing a function that takes a sequence as an argument, would it just be something like: (fn my-fun [x] ,,,) or is there a way to restrict input so the variable has to be a sequence?
14:10timvisher ,((fn [x] {:pre [(sequence? x)]} (first x)) [1 2 3])
14:10clojurebot#error{:cause "Unable to resolve symbol: sequence? in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: sequence? in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: sequence? in this contex...
14:10timvisher ,((fn [x] {:pre [(sequential? x)]} (first x)) [1 2 3])
14:10clojurebot1
14:10timvisher ,((fn [x] {:pre [(sequential? x)]} (first x)) #{1 2 3})
14:10clojurebot#error{:cause "Assert failed: (sequential? x)", :via [{:type java.lang.AssertionError, :message "Assert failed: (sequential? x)", :at [sandbox$eval75$fn__76 invoke "NO_SOURCE_FILE" 0]}], :trace [[sandbox$eval75$fn__76 invoke "NO_SOURCE_FILE" 0] [sandbox$eval75 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.java" 6792] [clojure.lang.Compiler eval "Compiler.java" 6755] [clojure.cor...
14:10timvisherZhadn: ↑
14:11timvisheras far as core is concerned
14:11timvisheri think at that point you could also type hint
14:11timvisher ,((fn [^ISequential x] {:pre [(sequential? x)]} (first x)) #{1 2 3})
14:11clojurebot#error{:cause "Unable to resolve classname: ISequential", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalArgumentException: Unable to resolve classname: ISequential, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]} {:type java.lang.IllegalArgumentException, :message "Unable to resolve classname: ISequential", :at [cloju...
14:11timvisherhrm...
14:11timvisher,(doc sequential?)
14:11clojurebot"([coll]); Returns true if coll implements Sequential"
14:11timvisher ,((fn [^Sequential x] {:pre [(sequential? x)]} (first x)) #{1 2 3})
14:11clojurebot#error{:cause "Unable to resolve classname: Sequential", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalArgumentException: Unable to resolve classname: Sequential, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]} {:type java.lang.IllegalArgumentException, :message "Unable to resolve classname: Sequential", :at [clojure....
14:12timvisherhuh... line?
14:12timvisher:)
14:12ZhadnI just started learning, :pre and :post were exactly what I was looking for
14:12Zhadnthank you!
14:13timvisher ,((fn [^clojure.lang.Sequential x] {:pre [(sequential? x)]} (first x)) #{1 2 3})
14:13clojurebot#error{:cause "Assert failed: (sequential? x)", :via [{:type java.lang.AssertionError, :message "Assert failed: (sequential? x)", :at [sandbox$eval171$fn__172 invoke "NO_SOURCE_FILE" 0]}], :trace [[sandbox$eval171$fn__172 invoke "NO_SOURCE_FILE" 0] [sandbox$eval171 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.java" 6792] [clojure.lang.Compiler eval "Compiler.java" 6755] [clojur...
14:13timvisher ,((fn [^clojure.lang.Sequential x] {:pre [(sequential? x)]} (first x)) '(1 2 3))
14:13clojurebot1
14:13timvisherthere we go
14:13timvisherdidn't know clojure.lang.* wasn't imported
14:14timvisherZhadn: if you run into the edges of what :pre and :post can do, be sure to check out core.typed and prismatic's schema
14:14timvisher:pre and :post are really bare bones, and don't provide the clearest errors
14:15Zhadnso what do you recommend?
14:22timvisherZhadn: i'd stick with :pre and :post until you realize they don't do everything :)
14:22timvisherand then i'd go with schema until you realize you actually wan types
14:23timvishers/wan/want
14:23timvisherand then i'd with core.typed :)
14:23timvisherand then i'd go to Haskell ;)
14:26Zhadnhaha thank you
14:31timvisherspeaking of :pre and :post, is there any way to declare exception handling in situ with those?
14:31timvisheror are you forced to push that logic out to clients?
14:39justin_smithtimvisher: pre / post will create assertionerrors
14:42timvisherjustin_smith: yes. but can you decaler a handler for said error in situ with them?
14:42timvisherdeclare*
14:42justin_smiththe point of assertionerrors is they are not exceptional runtime conditions, but erronious state
14:43justin_smitheg. they are meant to be fixed by fixing your code, not handled by a try/catch
14:43justin_smitherr, I think I meant ie.
14:43timvisheryes. my thought would be that they would be logged somewhere, but yes, i mostly agree with you
14:44justin_smithwhich is another reason pre/post don't really do what people usually want - we actually want runtime conditions we can handle
14:44justin_smiththough of course we can do the "wrong" thing and catch AssertionError
14:45timvisherbut that's just as easily done with a centralized catch
14:45justin_smithbut that has to be in the caller, in the case of :pre or :post, not in the function with the condition
14:45timvisherjustin_smith: indeed. :)
14:45justin_smithwhich brings us back to way, etc.
14:46justin_smith*why
14:46justin_smithis "common lisp condition system" a faq for clojure yet?
14:47justin_smithsomething clojure will likely never have http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html
14:48timvisherjustin_smith: i worked with a guy who had done common lisp and he would at least 2 or 3 times a week pine for conditions and restarts :)
14:48timvisherbut sadly i think it's impossible on the jvm?
14:48timvisheri don't know all the reasons though
14:48timvisheror even if that's accurate
14:48justin_smithnot surprised -- very difficult at the least
14:49timvisheri think it was something about finally blocks
14:49justin_smithwe could of course reify our own call stack over the jvm, but then the tradeoff would be that everything would be slow
14:49noncomin emacs package-list i see many packages marked 'obsolete'. what do i do with them? pressing U x does not do anything. It updated some packages, but there still remain some marked 'obsolete' ....
14:49justin_smithbut the bonus would be automatic tail call optimization, conditions, and call/cc
14:50justin_smith"optimization" since we already massively de-optimized things by replacing the native stack
14:50timvishernoncom: #emacs might be a better place to ask but so long as you don't have two versions of the same package installed i wouldn't worry about it
14:51noncomyeah, sorry, i asked on #emacs, they just ignored the question although there are many ppl. trying to learn emacs for clojure so i thought one little question i ask.. :)
14:51timvishernoncom: no worries. it's not wrong to ask here. just figured you might not know about it
14:51timvisherdoes what i said make sense?
14:52timvishernoncom: also, do you happen to be trying to learn clojure and emacs at the same time?
14:53camdeznoncom: I replied to you over in #emacs.
14:53noncomwell, i know clojure pretty well, using it in production for long time, using eclipse... but emacs is a mystery i find myself repeatedly returning to... :)
14:53timvishernoncom: ok. so long as you're not doing both at once. :)
14:57noncomtimvisher: hmm idk about two versions.. looks like it is the case.. but versioning is different.. so i switched to #emacs then
15:22Zhadnso I'm working through 4Clojure, and I'm on problem 57, which is about recursion: (= __ ((fn foo [x] (when (> x 0) (conj (foo (dec x)) x))) 5))
15:22Zhadnbut I don't think you can apply Conj to numbers?
15:23Zhadni'm sort of confused
15:26Zhadnthe way I read it, if I had x, where x is 2. it would be conjoining 0 and 1 at the lowest level
15:27angusiguessThere's something a little tricky going on here:
15:27confusedAnybody know the best way to parse large xml files? I've tried using clojure.data.zip.xml with clojure.data.xml but I keep getting heap exception?
15:27Zhadnbut (conj 0 1) or (conj x y) where x and y are numbers isn't valid?
15:27angusiguessZhadn: You see the when clause in that function?
15:27Zhadnis the trick making the where not evaulate to true
15:27Zhadnand to nil?
15:27angusiguess,(when false)
15:28clojurebotnil
15:28Zhadnbut then nil != 5
15:28angusiguess(conj nil 5)
15:28angusiguess,(conj nil 5)
15:28clojurebot(5)
15:30TimMcZhadn: conj'ing onto nil is not idiomatic, just to be clear.
15:30angusiguessBut it does form the base case for that function.
15:30TimMcOr at least, debateably.
15:32angusiguessThe function could be made explicit with (if (> x 0) (conj (foo (dec x)) x) '())
15:33confusedhttp://pastebin.com/dswWZq6k Here's a paste of what I have so far for parsing large xml files.
15:37amalloyangusiguess: of course, that would change the behavior ever so slightly (although not for the test cases on the actual problem)
15:41angusiguessamalloy: Ah, how?
15:41amalloywell, (foo 0) is now () instead of nil
15:41angusiguessoh ofc!
15:42bensucflemming: I'm writing on the pros and cons of having the JVM as a target platfrom. I'd love to get your input on writing tooling and debuggers
15:42bensuis it easier, harder, or there are a number of factors?
15:46tomaz_bhi guys
15:48tomaz_bi am more and more interested into Clojure. Can you tell me is there any web site listing bigger projects, products, used by, best for ... or something similar. I would like to draw a picture about Clojure. I don't like Java, I do belive JVM is great, i am interested into learning functional language... and i am focused into big data, high end backends, etc.
15:51jtmarmontomaz_b: http://www.quora.com/Whos-using-Clojure-in-production
16:00tomaz_bjtmarmon: thanks for this... i took a look... and is quite nice. i appreciate it
16:13mlb-This may be a better question for #emacs, but is/was there a keybinding for switching the current buffer to the "-test" suffixed namespace?
16:15dnolentomaz_b: http://www.cognitect.com/clojure#successstories
16:17aaelony_Is a long explanation string as metadata on a namespace recommended? a bad idea? Suppose a namespace needs a rationale, shouldn't that be metadata?
16:18mgaareaaelony_: a docstring should suffice. that's fairly common
16:19aaelony_actually just found this: http://stackoverflow.com/questions/11610678/clojure-documentation-for-libraries-namespaces
16:20aaelony_I'll go the docstring route
16:27borkdudeIs there something in clojure that behaves like a typesafe hashmap + exception when you get something under a key that isn't there?
16:29borkdudelike: a hashmap that behaves according to a prismatic/validation spec
16:30borkdudevalidation -> schema I mean
17:14danielcomptonamalloy: what's the status of 4clojure development?
17:15amalloythere isn't any, really. i just keep it running
17:18danielcomptonare you looking to accept improvements or is it just staying mostly the same?
17:20amalloyi'd rather just leave it alone
17:20danielcomptonsure
17:20danielcomptonwell done on it, I really like it.
18:10crack_userhello guys
18:16crack_useri'm trying to getting into clojure, but when I find a case where my application can take differents paths a always found my self between many nested cond functions, how can I improve that?
18:32danielcomptoncrack_user: Clojure has several ways to dispatch on different conditions, multimethods is probably your best bet in the general case, but it sounds like that's not going to fix your specific case. Can you post some sample code for us to take a look at?
18:34kaiyinHas anyone used this? http://neanderthal.uncomplicate.org/
18:36crack_userdanielcompton: sorry I think I'm begin clear
18:36crack_userdanielcompton I will formulate a quick example
18:37crack_userdanielcompton: https://gist.github.com/anonymous/0c5c74a5ae03a0c3c024 well here is
18:38crack_userdanielcompton: if I add a client validation even using a lib I have to add more conditions to different ring responses
18:49danielcomptoncrack_user: if you're looking to handle HTTP requests cleanly, you could look at Liberator http://clojure-liberator.github.io/liberator/ I think it could be what you're after
18:51dirtymikeAre there any good guides on using weavejester/environ
18:53justin_smithdirtymike: the readme on github is decent, it's pretty simple and doesn't do much
18:54dirtymikeI might be thinking too hard about it. It's just when you run `lein test` and `lein repl`? And if you do `lein run` or `lein ring ...` it'll use environment variables?
18:56justin_smithdirtymike: or you can specify the values it should find via profiles in project.clj
18:56justin_smiththe environment variables part is mostly for production, during dev you are probably specifying things in the project file
18:58dirtymikeIs it customary to use environment variables in production?
18:59_alejandrodirtymike: pretty common: http://12factor.net/config
19:02justin_smithdirtymike: part of the idea is you don't want production credentials in your repo if possible.
19:02justin_smithdirtymike: otherwise you implicitly trust anyone who can read your code to full access to your production credentials
19:03dirtymikeSure, so we might have a compojure app running on a couple developer computers with their own postgres databases. Then a staging. Then a production. I imagined a profiles.clj (added to gitignore) for each of those environments. But now I'm thinking that might not play well in jenkins.
19:04justin_smithyou shouldn't even have lein on production, or git, or profiles.clj
19:04justin_smithyou should compile an uberjar, that uses environ to look up the credentials (environ will get the creds from the environment variables on production)
19:06dirtymikeok that makes sense, just trying to picture these pieces fitting together, thanks
19:06justin_smithnp - the lein in production / git in production things that a lot of people do wrong IMHO
19:07justin_smithsorry, the grammar in that statement was terrible
19:07dirtymikeyea, I'm not a fan of git/lein on production. I'm trying to see if I can use jenkins or some other automation tool so I'm not `scp`-ing every day.
19:10justin_smithyeah, that makes sense
19:10justin_smithwhen I used jenkins, we had a script that would git pull, lein uberjar, scp
19:11crocketIs clojure a good language to use on android now?
19:25oddcullycrocket: is god a good deity to believe in
19:35escherize`so, lein run is giving me a stack trace, Caused by: java.lang.ClassNotFoundException: clojure.tools.nrepl.transport.Transport
19:36escherize`what does that mean?
19:39escherize`Also, this behavior persists - even on old versions of my project that worked.
19:40crack_userdanielcompton: thx man I wil take a look, but it is not just cleanly http request is about how to write applications that require different branchs of execution in a clojure way
19:42danielcomptoncrack_user: well between cond, case, condp, multimethods, and records there are lots of ways to handle different branches of execution. The Clojure way is often to look at a problem and try to reduce it to its most basic, from there you can often eliminate several branches
19:43danielcomptoncrack_user: i.e. you don't need to explicitly branch on if a collection is empty, you can use the fact that some operations will return nil (falsey) and work from that
19:43danielcomptoncrack_user: I'm not explaining it very well, perhaps someone else can say it better
19:55TEttingerescherize: what leiningen version?
19:56escherize2.5.0
19:56escherizewait, actually its:
19:56escherizeLeiningen 2.5.1 on Java 1.8.0_20 Java HotSpot(TM) 64-Bit Server VM
19:57TEttingerhave you changed the .m2 maven cache at all?
19:58escherizeNot that I know of.
19:59TEttingerI'd try reinstalling leiningen by renaming the jars that it uses from a self-install, then running the start script with self-install (might be selfinstall, can't remember) as an argument
20:01escherizeI don't exactly follow "renaming the jars that it uses
20:01escherize from a self-install"
20:04escherizeI think i see: I ran lein self-install and it wants me to move the jar and rerun lein self-install
20:10escherizeIt looks like that fixed it. Thanks TEttinger! (inc TEttinger)
20:10escherize(inc TEttinger)
20:10lazybot⇒ 53
20:24TEttingerwoo!
20:28escherizeI'm actually still getting the exact same error when running the uberjar (made with lein uberjar), though lein run does work. I moved .m2 and am redownloading everything in the off chance something there broke it.
20:55crocketWhere is clojure the most strongly supported?
20:55crocketJVM?
20:55crocketCLR?
20:55crocketmono?
21:11dominiclobuecrocket: JVM
21:11crocketDoes clojureCLR run well on mono?
21:12dominiclobueno idea. never used it before.
21:12dominiclobuesorry :(
21:12dominiclobuegotta head out. good luck!
21:47lvhcrocket: FWIW the people I know running CLR are running it on OSX, and, I think, Mono
21:49lvhcrocket: Various pieces of clojure-clr's source code are consciously about supporting mono
21:49lvhcrocket: basically I think it's probably fine; it'll be a bit experimental at times but it's unlikely given clojure's strong interop support by default that you'll find something totalyl gross
22:54crocketYo, clojurians...
22:54devn_yo
22:58escherizeYo crocket
22:58escherize,(-> "crocket" reverse reverse (#(apply str %)))
22:58clojurebot"crocket"
22:59crocketflip flip
23:03escherizeare you running windows day to day?
23:09crocketParenthesized to death.
23:10crocketRich hickey's obituary says "parenthesized to death".