2016-01-25
| 02:06 | amalloy | domokato: you need a function like (include-range existing-range-list new-range), and then you just reduce that over the input sequence like justin_smith was saying |
| 02:07 | amalloy | wow apparently that was several hours ago though. i bet you figured it out by now |
| 02:56 | MONODA | Found out what the issue was |
| 02:57 | MONODA | I had some weirdness in my emacs init |
| 02:57 | MONODA | That was causing the cider-refresh function to be remapped |
| 02:57 | MONODA | I dont know why the issue didnt appear before though |
| 03:43 | lxsameer | Is it logical to store the current leader of cluster in an atom ? |
| 04:15 | vkngpmhc | 1 |
| 04:27 | arcatan | 1 |
| 04:49 | loophole | 2? |
| 05:01 | qsys | well, 3? |
| 05:02 | algernon | 42, clearly |
| 05:03 | ridcully | no the next number is 5 |
| 05:05 | algernon | but 42 is the ultimate answer |
| 05:33 | lxsameer | how can i add a java package to my project ? |
| 05:33 | MasseR | Add it to project.clj? |
| 05:34 | lxsameer | how ? |
| 05:34 | lxsameer | MasseR, same as clojure packages? |
| 05:34 | MasseR | Yes |
| 05:34 | MasseR | lein is just a wrapper over maven |
| 05:35 | powered | lxsameer, does this answer your question: http://stackoverflow.com/q/2404426 |
| 05:35 | MasseR | http://search.maven.org/#artifactdetails|org.apache.commons|commons-jci|1.1|jar lxsameer for example |
| 05:35 | MasseR | Check the 'leiningen' tab |
| 05:35 | lxsameer | thanks folks |
| 06:14 | noncom | is there any core function to transform values of a {}? i know i can use reduce, but just wonder if there's anything inbuilt.. or if there's none, then how would you do that? |
| 06:14 | noncom | for examply, i do a (group-by) and want to transorm the []s in the values into their counts |
| 06:15 | luma | (defn map-values [f m] (into (empty m) (for [[k v] m] [k (f v)))) |
| 06:15 | luma | this what you mean? |
| 06:15 | noncom | yeah, like that |
| 06:16 | noncom | as i see, your solution is a bit different, but much of the similar idea |
| 06:17 | noncom | ofcourse, there's probably no other way to even organize that, but no inbuilt function there is |
| 06:18 | luma | no, nothing inbuilt |
| 06:18 | lxsameer | guys, my app would have a web interface using ring/compojure and and other daemon like process to do lots of background jobs, how can i handle both in one project ? |
| 06:24 | schmir | lxsameer: I'm using chime to run background jobs in a cron-like fashion |
| 06:26 | schmir | I just call chime/chime-at before starting the HTTP server |
| 06:26 | lxsameer | schmir, hmmm I kinda have a event loop, and the web section should be a side thread |
| 06:26 | lxsameer | schmir, can i see your code ? is it opensource ? |
| 06:30 | schmir | it's really just (do (chime/chime-at ...) (httpkit/run-server ...)) |
| 06:31 | schmir | do you need to know how to start that "side thread"? |
| 06:38 | lxsameer | schmir, hmm so you use httpkit directly , but what if i use something like nginx |
| 06:39 | yunfan | schmir: interesting, i just met the author at 2013 |
| 06:41 | schmir | lxsameer: what does use nginx mean here? nginx like in nginx-clojure? nginx as proxy? |
| 06:56 | lxsameer | schmir, nginx it self |
| 06:59 | loophole | lxsameer: build rpm/deb packages with dependencies to nginx? |
| 07:00 | lxsameer | loophole, no, I'm using nginx in my server and what if i want to use clojure to server my web section |
| 07:03 | schmir | lxsameer: I guess you need to configure nginx as a HTTP proxy then. I'm not even sure what you're problem is. that now looks quite different from your original question. |
| 07:06 | lxsameer | schmir, thanks man |
| 07:10 | yunfan | lxsameer: or configure a haproxy which use your clojure service as the backend |
| 07:21 | lxsameer | yunfan, that seems fun |
| 07:29 | yunfan | lxsameer: why its fun? |
| 07:32 | lxsameer | yunfan, by fun i meant interesting |
| 07:33 | yunfan | lxsameer: okay, sorry for misunderstanding, english is not my native |
| 07:33 | lxsameer | yunfan, me to buddy |
| 07:34 | yunfan | lxsameer: where are you from? |
| 07:34 | lxsameer | yunfan, unfortunately Iran |
| 07:34 | yunfan | lxsameer: lol i come from china. we are all in the same hell |
| 07:35 | lxsameer | yunfan, exactly |
| 07:35 | yunfan | lxsameer: but iran recently just release the banning for youtube, this made us the last country |
| 07:36 | lxsameer | yunfan, no that was temporary buddy, our filternet is the worst |
| 07:37 | yunfan | lxsameer: really? i thought we are the worst, can you reach google/facebook/twitter or even linode? |
| 07:38 | lxsameer | yunfan, only google, but they do man in middle to sniff traffic with fake ssl cert |
| 07:38 | qsys | well, have visited both Iran and China, and I though China was worse... |
| 07:39 | yunfan | lxsameer: then you are better than us |
| 07:39 | yunfan | lxsameer: and sorry that chinese goverment has export that filternet to your goverment |
| 07:39 | lxsameer | yunfan, :)) thanks man, i hope i can run away from my country |
| 07:39 | qsys | although that might've been that is was easier in Iran to get around it |
| 07:39 | yunfan | lxsameer: if you are looking for another proxy other than vpn, you could check shadowsocks, its opensource in github |
| 07:39 | lxsameer | qsys, really ? |
| 07:40 | lxsameer | yunfan, yeah i'm using it right now |
| 07:40 | yunfan | qsys: yep, but we chinese are different look than iran if we go to westen country |
| 07:41 | yunfan | lxsameer: also a chinese tool. we are the center of evil :D |
| 07:41 | lxsameer | yunfan, :)) |
| 07:41 | qsys | :) |
| 07:42 | yunfan | maybe one day i should go to au, where i can still do business with my chinese fellows and enjoy the freedom at the sametime (though its not much free than usa) |
| 11:59 | lokien | what is an idiomatic way of getting this value out? [:keyword {:key value}] |
| 12:05 | gfredericks | ,(get-in [:keyword {:key "VALUE"}] [1 :key]) |
| 12:05 | clojurebot | "VALUE" |
| 12:05 | gfredericks | ,(-> [:keyword {:key "VALUE"}] second :key) |
| 12:05 | clojurebot | "VALUE" |
| 12:05 | gfredericks | ,(-> [:keyword {:key "VALUE"}] (get 1) :key) |
| 12:05 | clojurebot | "VALUE" |
| 12:06 | lokien | can I destructure it? |
| 12:07 | lokien | I don't get map destructuring at all |
| 12:08 | tolstoy | ,(let [[_ {:keys [key]}] [:keyword {:key "value"}]] key] |
| 12:08 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> |
| 12:08 | tolstoy | ,(let [[_ {:keys [key]}] [:keyword {:key "value"}]] key) |
| 12:08 | clojurebot | "value" |
| 12:09 | lokien | thanks tolstoy, I'll try it |
| 12:10 | tolstoy | I use the [:key {:a 1 :b 2}] pattern a lot. |
| 12:11 | tolstoy | Usually, I destructure it as (let [[topic data] msg] ... ) |
| 12:11 | tolstoy | Then (case topic :this-msg (do-something data) ...). |
| 12:11 | tolstoy | do-something is a function that destructures: |
| 12:12 | tolstoy | (defn do-something [{:keys [a b] :as msg}] ...) |
| 12:12 | lokien | welp, it works. key in {:keys [key]} is just a name I give to the value, right? |
| 12:13 | lokien | yeah, it is |
| 12:13 | ridcully | key there will fetch you :key from that map |
| 12:14 | tolstoy | The names in :keys has to match up with actual keys in the map. |
| 12:14 | ridcully | same like (let [key {:key map}]) basically |
| 12:14 | tolstoy | If you want new names, there's a different destructuring form. |
| 12:16 | lokien | ,(let [[_ {:keys [something]}] [:keyword {:key "value"}]] something) |
| 12:16 | clojurebot | nil |
| 12:16 | lokien | uh |
| 12:17 | ridcully | there is no :something in that map |
| 12:17 | lokien | yeah, I just wanted to check |
| 12:17 | tolstoy | ,(let [[_ {foo :key}] [:keyword {:key "value"}]] foo) |
| 12:17 | clojurebot | "value" |
| 12:18 | tolstoy | In the above, you can bind the value of :key to the name "foo". That's how you extract out new names rather than just the keys. |
| 12:19 | lokien | that's what I wanted it to be like, thank you tolstoy |
| 12:47 | Kamuela | Is the do operator kind of like data with a side effect of running it? |
| 12:57 | mavbozo | ,(do (inc 1) (inc 2))) |
| 12:57 | clojurebot | 3 |
| 12:58 | mavbozo | Kamuela, above do contains no side-effect |
| 12:58 | mavbozo | it just returns the result of the last expression |
| 13:02 | Kamuela | mavbozo: I am trying to understand do within an if, function? Form? |
| 13:03 | tolstoy | do evaluates its parameters, returning the value of the last one. |
| 13:04 | Kamuela | So it's almost almost the equivalent of just throwing in another pair of parentheses |
| 13:04 | Kamuela | if that were valid |
| 13:04 | tolstoy | Yeah, like { ... } in other languages. |
| 13:04 | loophole | Kamuela: yep |
| 13:04 | loophole | (if (= 1 2) (do (println "WHAT?!?") :its_true) (do (println "ok") :everything_normal)) |
| 13:05 | Kamuela | Thank you all |
| 13:13 | mavbozo | i just recently found out that the body of a let form is implicitly wrapped in do block |
| 13:13 | mavbozo | so i could do this (let [a 1] (println a) a) instead of (let [a 1] (do (println a) a)) |
| 13:13 | tolstoy | So is `when`. |
| 13:14 | pilne | isn't when just a macro for "if - do" |
| 13:15 | tolstoy | Yep: https://github.com/clojure/clojure/blob/010864f8ed828f8d261807b7345f1a539c5b20df/src/clj/clojure/core.clj#L493 |
| 13:17 | ridcully | ,(macroexpand '(when true :x)) |
| 13:17 | clojurebot | (if true (do :x)) |
| 13:17 | mavbozo | ,(doc when) |
| 13:17 | clojurebot | "([test & body]); Evaluates test. If logical true, evaluates body in an implicit do." |
| 13:17 | mavbozo | ,(doc let) |
| 13:17 | clojurebot | "([bindings & body]); binding => binding-form init-expr Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein." |
| 13:19 | mavbozo | when's doc states the "implicit do" while let's doc does not. that what makes me used do in let's body |
| 13:20 | pilne | i can see that, i just figured that for what let does, it makes sense that it is implied (and the tutorials i've read never used do inside let). |
| 13:21 | mavbozo | wow great!, now http://clojure.org/reference/special_forms#let states the "implicit do" |
| 13:23 | WorldsEndless | I need a java.lang.String[] and my clojure.lang.PersistentVector isn't cutting it. How should I get the string array? |
| 13:23 | mavbozo | fn docs also states the "implicit do" http://clojure.org/reference/special_forms#fn |
| 13:24 | loophole | WorldsEndless: (byte-array (map byte "foo bar baz")) |
| 13:24 | tolstoy | WorldsEndless: Maybe into-array? |
| 13:25 | WorldsEndless | So what I'm starting with is the result of string split command, but I need it a string[] for interop purposes. Reading on into-array now |
| 13:25 | tolstoy | ,(type ["a" "b"]) |
| 13:25 | clojurebot | clojure.lang.PersistentVector |
| 13:25 | loophole | WorldsEndless: uhh i shot to fast :) you need a string |
| 13:25 | tolstoy | ,(type (into-array ["a" "b"])) |
| 13:25 | clojurebot | [Ljava.lang.String; |
| 13:26 | Kamuela | Interesting about all these macros. Is there a list of only baser forms? Ones that form the indivisible parts of other combos? |
| 13:27 | WorldsEndless | Ah! into-array seems to do it . Thanks! |
| 13:29 | pilne | Kamuela:: at the bottom here there is a list (partial?) of the built-in macros, and i'm pretty sure a macro can contain any valid function, but i'm still learning about them. |
| 13:30 | justin_smith | Kamuela: the closest thing we have to "baser forms" is special forms, which are defined in java and not clojure itself |
| 13:30 | justin_smith | everything else is defined in clojure |
| 13:30 | justin_smith | ,(special-form? if) |
| 13:30 | clojurebot | #error {\n :cause "Unable to resolve symbol: special-form? in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: special-form? in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbo... |
| 13:31 | justin_smith | ,(special-symbol? 'if) |
| 13:31 | clojurebot | true |
| 13:31 | justin_smith | it fibs a bit |
| 13:31 | justin_smith | ,(special-symbol? 'let) |
| 13:31 | clojurebot | false |
| 13:31 | justin_smith | ,(special-symbol? 'let*) |
| 13:31 | clojurebot | true |
| 13:31 | justin_smith | oh! it's more accurate than I remembered |
| 13:31 | justin_smith | ,(special-symbol? 'fn) |
| 13:31 | clojurebot | false |
| 13:32 | justin_smith | ,(special-symbol? 'fn*) |
| 13:32 | clojurebot | true |
| 13:33 | Howling | ,(+ 2 3) |
| 13:33 | clojurebot | 5 |
| 13:33 | loophole | Kamuela: everytime I think I need a macro I think again ;) |
| 13:33 | mavbozo | ,(special-symbol? '+) |
| 13:33 | clojurebot | false |
| 13:33 | mavbozo | ,(special-symbol? 'ns) |
| 13:33 | clojurebot | false |
| 13:35 | justin_smith | mavbozo: ever look at the source of ns? it's kind of crazy |
| 13:35 | loophole | justin_smith: looks like he's gone |
| 13:36 | justin_smith | loophole: huh, was here when the name tab-completed I guess |
| 13:36 | rcassidy | doesn't clojure's let function like let* anyway? coming from scheme |
| 13:36 | rcassidy | or does the splat take a different meaning? |
| 13:37 | rcassidy | ,(let [a 5 b a] b) |
| 13:37 | clojurebot | 5 |
| 13:37 | justin_smith | rcassidy: in clojure the trailing splat usually means "this is an implementation detail of the one without the splat" |
| 13:37 | rcassidy | ah. |
| 13:37 | justin_smith | rcassidy: eg fn* for fn, let* for let, in both cases the difference is that the one without the splat has destructuring of its bindings |
| 13:38 | rcassidy | so it's basically like, "you probably won't need to call this version" |
| 13:38 | justin_smith | and the one with the splat is a special form from the java side of the code |
| 13:38 | justin_smith | right |
| 13:38 | rcassidy | cool, thanks. |
| 13:38 | justin_smith | rcassidy: but... |
| 13:38 | justin_smith | ,'#() |
| 13:38 | clojurebot | (fn* [] ()) |
| 13:38 | rcassidy | ,(fn* [] ()) |
| 13:38 | clojurebot | #object[sandbox$eval288$fn__289 0x4b418dd0 "sandbox$eval288$fn__289@4b418dd0"] |
| 13:38 | justin_smith | they can make a decent macro expansion if you know you won't be using destructuring due to the macro |
| 13:38 | rcassidy | makes sense! |
| 13:39 | rcassidy | thanks :) |
| 13:41 | rcassidy | in scheme, bindings in a single let statement aren't bound in sequence, so you can't do (let ([a 5] [b a]) ...) |
| 13:41 | rcassidy | that's what let* is for :p |
| 13:41 | rcassidy | and letrec for recursive bindings. |
| 13:41 | justin_smith | right |
| 13:41 | justin_smith | similar in common lisp as well |
| 13:45 | m1dnight_ | How can I wait in my main method for all my threads to finish? |
| 13:45 | m1dnight_ | My main method ends instantly but in the meanwhile it fires a few threads that are actually my main program. |
| 13:45 | loophole | justin_smith: this did supris me however: (let [x 2 x 3] x) |
| 13:45 | justin_smith | loophole: that's just shadowing though |
| 13:46 | justin_smith | ,(let [x 2 y x x 3] [x y]) |
| 13:46 | clojurebot | [3 2] |
| 13:46 | justin_smith | see, the original value is still there |
| 13:46 | loophole | justin_smith: ahh that makes sense |
| 13:46 | tolstoy | m1dnight_: You can use a promise. (let [p (promise)] (start-threads) @p) |
| 13:46 | tolstoy | m1dnight_: One of those threads could "deliver" to the promise to end the app. |
| 13:46 | m1dnight_ | The thing is, the threads are a few fucntion calls away |
| 13:47 | justin_smith | m1dnight_: if you use futures or agents, clojure will already wait to shut down (you need (shutdown-agents) or System/exit to force actual shutdown) |
| 13:47 | m1dnight_ | Im using bear threads :< |
| 13:47 | rcassidy | roar |
| 13:47 | m1dnight_ | bare? Just java threads. |
| 13:47 | justin_smith | m1dnight_: then don't set them daemon |
| 13:47 | justin_smith | if they are not set as daemon, your main will wait for them |
| 13:48 | tolstoy | Is this a long running process, or a run it and die when done process? |
| 13:48 | m1dnight_ | Odd, they are not explicitly set as daemon threads. |
| 13:48 | m1dnight_ | Yes, it is a process that will run for years if all goes well :p |
| 13:48 | m1dnight_ | Its my irc bot. I have a loop that listens for messages from the irc/slack server. |
| 13:48 | m1dnight_ | I dont know why it worked in my previous version. Im rebuilding it and I just noticed this. |
| 13:48 | tolstoy | In that case, I use the "promise" in the main method, then use a shutdown hook to deliver the message to break the promise. |
| 13:48 | justin_smith | m1dnight_: you can use the .isDaemon method to see if they have daemon status |
| 13:50 | Guest44358 | i was at the clojure conj 2013 - and remember a talk that was about bringing systems together by using schemas. Anyone happen to know who the speaker was? |
| 13:50 | justin_smith | m1dnight_: anyway, if you call the .join method on the thread, that won't return until that thread finishes |
| 13:50 | Guest44358 | it wasn't the _prismatic_ schema talk though |
| 13:50 | tolstoy | (.addShtudownHook (Runtime/getRuntime) (Thread. #(deliver p :release))) |
| 13:51 | tolstoy | when you kill the process, that hook gets invoked. |
| 13:51 | m1dnight_ | Daemon thread? false |
| 13:51 | m1dnight_ | Oddly enough they are not set as daemons. |
| 13:52 | m1dnight_ | Okay I will hold off on fixing this issue then. thread/sleep $supermanyalot will do the trick for dev atm |
| 13:52 | justin_smith | and they are erroneously being stopped when main exits? |
| 13:52 | justin_smith | m1dnight_: (.join t) |
| 13:52 | Guest44358 | ah Jen Smith! thanks Google :) |
| 13:53 | tolstoy | m1dnight_: Using the promise is the cleanest, but you could also start a do-nothing thread and use that machinery justin_smith is talking about. |
| 13:53 | justin_smith | tolstoy: I am talking about calling .join as the last line of -main, so that -main does not exit until that thread does |
| 13:54 | justin_smith | no need for a do-nothing thread |
| 13:54 | tolstoy | justin_smith: I still like my little promise method better. Just seems so much cleaner, or at least clearer. |
| 13:55 | justin_smith | tolstoy: .join is very clear - it means "wait for this thread to exit" |
| 13:55 | tolstoy | justin_smith: I used to solve this prob using Object.wait() and .notify(). |
| 13:55 | justin_smith | which is exactly the thing we want |
| 13:56 | tolstoy | How do you clean things up when you send a die signal via the OS? |
| 13:56 | tolstoy | Anyway, nevermind. I don't care. ;) |
| 13:57 | loophole | rcassidy: bear threads... Now I have this picture of a rasta bear in my head |
| 13:58 | justin_smith | tolstoy: to be honest, I never use an OS where anything I am doing in my clojure code matters after the shutdown signal |
| 13:59 | justin_smith | I mean I guess if I was doing something fancier than I do now with the db or ipc, I might have to clean that up, but right now it's zookeeper, which assumes "you are gone and irrelevant" if you miss a ping, so no cleanup needed |
| 13:59 | justin_smith | tolstoy: but I guess I'd have to go into that rabbit hole if I ever used a resource that wouldn't cleanly be disposed of on vm death |
| 13:59 | tolstoy | I like the idea of starting up components (or whatever), then registering a shutdown hook that calls "stop" on them when the JVM goes down under normal circumstances. |
| 13:59 | justin_smith | but that seems an entirely separate question |
| 14:00 | justin_smith | tolstoy: but what component actually needs that if the whole vm is going down? |
| 14:00 | tolstoy | Most of the time, all stop does is print out a message. |
| 14:01 | justin_smith | frankly, if I had something that needed cleaned up on vm shutdown, I wouldn't trust any aspect of the vm itself to do it (I guess this might be overly cynical) |
| 14:01 | loophole | justin_smith: finally :) |
| 14:02 | tolstoy | So you just (.join (Thread/currentThread)) at the end of your main? |
| 14:02 | justin_smith | tolstoy: absolutely not - he was talking about waiting for another thread - his vm was exiting too early |
| 14:03 | justin_smith | so I am saying if what you want is to wait for thread t to finish before normal exit, then call (.join t) |
| 14:03 | justin_smith | which is precisely what the .join method is for |
| 14:03 | tolstoy | But he also said he wanted a long-running process, so I figured that what he really wanted was a way to keep the JVM from terminating. The fact that there are threads in the background was incidental. |
| 14:04 | loophole | is there an advantage in using java threads vs futures? |
| 14:04 | tolstoy | (while try (Thread/sleep 100000)) works too, I guess (which he said he's doing). |
| 14:05 | justin_smith | loophole: they are slightly simpler? not much of one that I know of. |
| 14:05 | loophole | I try to get by with the clojure abstractions. and so far it suites me well |
| 14:07 | loophole | justin_smith: I mean there's a reason I use clojure and not java... :) |
| 14:24 | TimMc | justin_smith: cassandra in particular is a DB designed to be shutdown with kill -9 -- I like that philosophy |
| 14:24 | justin_smith | heh, nice |
| 14:24 | justin_smith | TimMc: this relies on things like not running cassandra on Windows I assume... |
| 14:24 | TimMc | Maybe. |
| 14:24 | loophole | TimMc: isn't cassandra a pure in memory database? |
| 14:25 | TimMc | no |
| 14:25 | TimMc | justin_smith: Does Windows not have a reliable flush command? |
| 14:25 | TimMc | because i think that's the one essential thing |
| 14:27 | justin_smith | TimMc: I have heard tell of resource leaks on unclean shutdowns, but this could be old info about outdated versions |
| 14:28 | TimMc | loophole: Maybe you're thinking of HSQLDB? But that one also can be disk-backed. |
| 14:28 | tolstoy | Well, and we were talking at cross purposes. 1) how do you keep the JVM up for long-running servers? 2) how do you make a thread block shutdown? |
| 14:29 | TimMc | justin_smith: On Cassandra? Wouldn't surprise me too much. There are some pretty bad bugs in old versions. |
| 14:29 | justin_smith | for 1) I use jsvc |
| 14:30 | justin_smith | TimMc: with various programs on windows - where a *nix would reclaim all process resources reliably, but like I said this could be out of date info |
| 14:30 | loophole | TimMc: how do they manage to catch sigkill? just curious |
| 14:30 | justin_smith | and I guess there are things like shm that even on a *nix you can't reliably reclaim automatically |
| 14:30 | justin_smith | loophole: I think the point is they don't catch it - the app is written so that an unclean kill won't hurt anything |
| 14:33 | TimMc | Yeah, you can just *remove* the Cassandra process, and when you start it next time, it recovers from journals. |
| 14:33 | tolstoy | loophole: java.lang.Runtime/addShutdownHook lets you invoke methods on JVM shutdown. |
| 14:34 | TimMc | I regard this sort of thing as baseline functionality. My laptop runs out of battery all the time -- *everything* should work this way. |
| 14:34 | loophole | justin_smith: ahh thats interesting. that makes it quite challenging to perform a write on disk. the only possible way i can think of is to write it in a temporary file and then perform a copy operation |
| 14:34 | TimMc | tolstoy: Won't help with kill -9 :-) |
| 14:34 | tolstoy | loophole: Works for sigs outside of kill -9, anyway. |
| 14:34 | loophole | tolstoy: not a sigkill. sigkill |
| 14:34 | loophole | tolstoy: :) |
| 14:34 | tolstoy | No, that's right. |
| 14:34 | TimMc | https://www.youtube.com/watch?v=Fow7iUaKrq4 |
| 14:35 | tolstoy | I figure if you're using kill -9 to kill something, it's stuck anyway. |
| 14:35 | TimMc | (content warning: overly nerdy rap) |
| 14:35 | loophole | tolstoy: or a script hacked by an admin that just wants to be sure... |
| 14:35 | justin_smith | tolstoy: it could be using too much ram, it could be trying to use a disk that is full... |
| 14:36 | TimMc | If you kill Cassandra it a normal way it does a little cleanup so that startup can be fast. |
| 14:36 | justin_smith | or that even |
| 14:39 | tolstoy | Yeah. In other words, under normal circumstances (re-starting after an upgrade), you can run a hook to clean things up (if you want), but under circumstances where kill -9 is necessary, you already have bigger problems. |
| 14:41 | tolstoy | Anyway, I like to call "stop" on all my components, necessary or not. It just feels good. ;) |
| 14:41 | loophole | tolstoy: jep I was just curious how its done since TimMc wrote < TimMc> justin_smith: cassandra in particular is a DB designed to be shutdown with kill -9 |
| 14:41 | justin_smith | loophole: multi-step writes |
| 14:42 | justin_smith | loophole: any reliable db needs to be doing multi-step writes anyway |
| 14:43 | loophole | justin_smith: so my guess "write to a temporary file" was not to far off |
| 14:43 | justin_smith | loophole: idea being that you don't commit until the full transaction is done, and any state that isn't fully transacted is still a valid state |
| 14:43 | justin_smith | loophole: it's a very fancy version of that, yes :) |
| 14:44 | loophole | justin_smith: :) |
| 14:45 | loophole | justin_smith: who needs fancy anyway |
| 14:45 | loophole | :) |
| 14:47 | loophole | justin_smith: but this means that it is not an extraordinary feature when it comes to databases. that's what every mature database should do anyways |
| 14:47 | justin_smith | loophole: https://en.wikipedia.org/wiki/Two-phase_commit_protocol |
| 14:47 | loophole | justin_smith: thx |
| 14:48 | justin_smith | loophole: well, you'd be surprised about mongo (or not) |
| 14:48 | loophole | justin_smith: i played around with it. so... no ;) |
| 14:48 | justin_smith | it's the old CAP thing |
| 14:49 | justin_smith | cassandra seems to go for C while mongo for A |
| 14:49 | justin_smith | wait, does mongo even do A? it might just be P and throw hands in the air about AC, I forget. |
| 14:50 | matthavener | afaik, mongo does leader election for single writer (some C, no A), and cassandra can do A since its a dynamo style DB |
| 14:51 | TimMc | "some C", yes... |
| 14:51 | justin_smith | haha |
| 14:51 | matthavener | for a given definition of 'consistent' :) |
| 14:52 | matthavener | as usual, aphyr has some interesting writings on all those definitions. this pic is a rabbit hole in itself https://aphyr.com/data/posts/313/family-tree.jpg |
| 14:52 | loophole | justin_smith: any ideas regarding orientdb? I want to use it as a basis for my next OS project. |
| 14:52 | justin_smith | loophole: I looked into it very briefly, didn't use it in anger |
| 14:52 | justin_smith | matthavener: nice! |
| 14:54 | loophole | justin_smith: ok. needs a (working) clojure binding. maybe I will do it |
| 14:55 | loophole | justin_smith: just want to know if it's worth the hassle |
| 14:55 | justin_smith | loophole: cool, I still have some open questions about databases due to the demands of the project I am working on |
| 14:55 | justin_smith | loophole: sorry I don't have more info |
| 14:58 | loophole | justin_smith: It was worth a try :) |
| 15:41 | loophole | justin_smith: still around? |
| 15:45 | loophole | i need an opinion. i'm playing around with a graphdb that uses an sql dialect. my aproach to it looks like this: |
| 15:45 | justin_smith | yo |
| 15:45 | loophole | (select [:name :birthday] ($from :persons) ($where ($= :name "hans"))) |
| 15:46 | loophole | which then is converted to a string "select name,birthday from persons where name = 'hans'" |
| 15:46 | loophole | quite straight forward |
| 15:46 | loophole | every operator ($x... ) is by itself a funktion |
| 15:47 | justin_smith | OK |
| 15:48 | justin_smith | so is this your own DSL over sql? |
| 15:48 | loophole | justin yes. its not really sql its the orientdb dialect |
| 15:48 | justin_smith | aha |
| 15:49 | justin_smith | loophole: I'd do two layers - one that is a straightforward adaptor, then another layer that does the dsl |
| 15:49 | justin_smith | I think syntax magic should be a thing one can opt out of |
| 15:51 | loophole | there is no magic at all; you just do (query (select ....)) or (query "select ...") |
| 15:51 | loophole | justin_smith: there is no magic at all; you just do (query (select ....)) or (query "select ...") |
| 15:51 | justin_smith | OK - so it will just be a string generating function? |
| 15:52 | loophole | justin_smith: yes. to easy term building and prevent type errors |
| 15:52 | loophole | justin_smith: s/easy/ease/ |
| 15:53 | justin_smith | s/easy/ease/ is my favorite sed based gansta rapper |
| 15:53 | loophole | justin_smith: a very thin layer |
| 15:54 | loophole | (select [:name :birthday] |
| 15:54 | loophole | ($let [:$foo (select [:foo] ($from :baz)) |
| 15:55 | loophole | ($from :persons) |
| 15:55 | loophole | ($where ($= :$foo "hans")))) |
| 15:55 | loophole | turns to "select name,birthday let $foo =( select foo from baz ) from persons where $foo = 'hans'" |
| 15:57 | loophole | justin_smith: this way it's super easy to unit-test. however the sql-like abstractions i've seen for clojre are much more complicated. so I don't know if my approach is 'right' |
| 15:57 | loophole | maybe its to basic |
| 15:59 | CStorm | Guys i have a problem. When i boot emacs, load cider-jack and open my project it always fails when i compile it the first time (the error is Unable to resolve symbol). Its a super simpel project with only 5ish functions. The solution is then to oucomment the functions, recompile, enable functions again and everything works. How come? |
| 16:01 | justin_smith | CStorm: do you define any functions out of order? |
| 16:01 | justin_smith | CStorm: if you run "lein check" do you get the same error? |
| 16:01 | CStorm | lemme check. |
| 16:02 | justin_smith | CStorm: clojure doesn't support using functions before their definition (even in the same file) unless you use declare |
| 16:02 | loophole | justin_smith: do you think my approach is to simplicistic? |
| 16:03 | justin_smith | loophole: I'm really not sure - if the syntax the db uses and what you can do in clojure match that nicely, maybe it will just work? but I don't know that db |
| 16:04 | loophole | justin_smith: i just lispify all sql statements. so ($+ 1 2 3) -> (1 + 2 + 3) |
| 16:04 | CStorm | hm, ok let me show you the code, justin_smith. |
| 16:04 | CStorm | justin_smith: http://pastebin.com/KjeZKByQ |
| 16:04 | CStorm | just simplified everything, and still does the same thing. |
| 16:05 | CStorm | so its because i use it before its defined? |
| 16:05 | loophole | justin_smith: and the dollar in front of each sql operator is to distinguish it from clojure |
| 16:06 | justin_smith | CStorm: yes, clojure does not support using things before their definition |
| 16:06 | justin_smith | CStorm: as I said before |
| 16:07 | loophole | CStorm either declare trakt-pin-auth or put it above -main |
| 16:07 | CStorm | thank you both, that was a headache my "newbie-clojure" book havnt touched yet |
| 16:07 | CStorm | so had problems understanding it :) |
| 16:08 | justin_smith | CStorm: it's actually simple - what works in a file is what would work if you were running the definitions one by one in a repl |
| 16:08 | justin_smith | CStorm: if you ran (defn -main ...) first, of course the compiler would complain if you used anything that was not defined yet |
| 16:08 | CStorm | make sense |
| 16:08 | CStorm | so when should i define and when should i move it up? |
| 16:09 | justin_smith | CStorm: like many things in clojure, it's simpler as a behavior than other languages are, but there is the "complexity" of doing it a different way than you are used to |
| 16:09 | justin_smith | CStorm: I don't ever use declare, but some people like using declare for style reasons - if they want to show definitions in a specific order |
| 16:09 | justin_smith | CStorm: it's a style question really |
| 16:09 | CStorm | thanks guys |
| 16:10 | loophole | CStorm: i only declare things when two function call each other. that happens very rarely |
| 16:10 | CStorm | ok. |
| 16:11 | justin_smith | loophole: in that sort of case I usually look for a way to make them one recursive question (though perhaps there would be more elegant two function versions I am missing) |
| 16:11 | justin_smith | what I really want is to get a good idea of when to use trampoline |
| 16:14 | loophole | justin_smith: I think trampoline is for recursive functions that are not tail recursive and can not be written with loop. afaik tramplone prevents in this case a stack overflow |
| 16:14 | loophole | justin_smith: or so I read, played around with it just once |
| 16:14 | justin_smith | loophole: indeed it does, I know what it does but I haven't mastered the coding style where using it comes naturally |
| 16:15 | justin_smith | perhaps it's just a toy, or perhaps I need an a-ha moment that shows me how it is useful |
| 16:15 | justin_smith | I'm betting on the latter, since it's in clojure.core |
| 16:18 | loophole | justin_smith: i still need to find a reason to use it. but I'm happy it's there just in case |
| 16:18 | amalloy | i think trampoline is just useful pretty rarely |
| 16:18 | justin_smith | like maybe for a state machine? |
| 16:18 | amalloy | that is a classic case, yeah |
| 16:19 | amalloy | also to simulate continuations |
| 16:19 | amalloy | or rather, TCO, i guess |
| 16:19 | justin_smith | right, of non-self-calls |
| 16:27 | rcassidy | yeah, trampoline is one of those things you don't really use much unless you're pretty deep into recreating lisp, from my experience :p |
| 16:37 | amalloy | dang, i just got a NPE from `lein deps tree`. that's a new one. i must have a really exciting set of dependencies |
| 16:37 | justin_smith | wow |
| 16:38 | amalloy | [clj-aws-s3 "0.3.9"] overrides [clj-aws-s3 "0.3.9" :exclusions [joda-time]] Consider using these exclusions: java.lang.NullPointerException |
| 16:38 | amalloy | if i could exclude NPE from my programs i would be all for it |
| 16:38 | justin_smith | haha |
| 16:40 | loophole | amalloy: ) |
| 16:44 | bja_ | any ideas what would cause leiningen to build an uberjar jar that java -jar considers to be an "invalid or corrupt jarfile", but `java -cp myjar my.ns.core` works (which is what `java -jar myjar` is supposed to do) |
| 16:45 | bja_ | and by works, I mean, loads, passes all integration tests, I can nrepl into it, require/move into all namespaces, etc |
| 16:45 | justin_smith | bja_: perhaps you aot-compile your namespace but don't set it as :main-ns ? |
| 16:45 | tolstoy | Improper :main setting in lein? |
| 16:45 | bja_ | :main-ns ? |
| 16:45 | bja_ | I thought it was :main |
| 16:46 | justin_smith | bja_: you are right, I misremembered |
| 16:46 | bja_ | oh, was just scrambling to the leiningen docs |
| 16:47 | amalloy | bja_: lein help sample |
| 16:47 | amalloy | is a useful command to remember |
| 16:47 | justin_smith | if you set your :main properly, and java -cp myjar main works, then lein is making a mistake |
| 16:47 | justin_smith | amalloy: in this case it was me that needed to go look at the docs again |
| 16:47 | amalloy | sure, but there's no need to scramble to find the docs anyway |
| 16:49 | bja_ | amalloy, thanks |
| 17:08 | Glenjamin | lein help sample is going to change my life |
| 17:08 | Glenjamin | i've been going to github every damn time |
| 17:09 | amalloy | i think most md files in lein's github are available via lein help |
| 17:09 | bja_ | hmm |
| 17:09 | amalloy | see `lein help help` for details on that |
| 17:10 | bja_ | so, `lein uberjar` under jdk7 creates jars that jdk7's java -jar cannot read. jdk8 creates uberjars that jdk8 can read. |
| 17:10 | justin_smith | amalloy: I'm not finding one for "faster", maybe using the wrong term |
| 17:10 | justin_smith | bja_: that does not reflect my experience at all |
| 17:10 | amalloy | well, i did say "most". i don't know that they're all there, i just know a lot are |
| 17:11 | bja_ | justicefries, oh I mean. in this case. that's not my usual experience. |
| 17:11 | justin_smith | amalloy: yeah, I just thought it would have been cool to be able to direct people to a lein command instead of find that wiki page when they talk about clojure starting slow |
| 17:11 | amalloy | i like justin_smith's new nick, bja_ |
| 17:12 | amalloy | maybe i should just kickban everyone whose nick interferes with the tab-completion on people i often talk to. there's an idea |
| 17:12 | bja_ | `lein uberjar` under my jdk8 creates a jar file that none of my jdk7 jvms can use via java -jar, but my jdk8 can use that uberjar via java -jar |
| 17:13 | bja_ | oops, sorry justin_smith and justicefries |
| 17:14 | bja_ | which, would be fine if I was just using some random jdk8 api. but jdk7 creating the uberjar, cannot execute said uberjar using java -jar. |
| 17:14 | bja_ | in all instances `java -cp jarfile main` works like I expect it to |
| 17:15 | bja_ | I think my solution for now involves just using java -cp to run things, but I'd like to know why this happens |
| 17:15 | bja_ | since I feel like I broke something somehow |
| 17:15 | justin_smith | bja_: are you compiling java as part of the build? |
| 17:16 | bja_ | no. unless one of my dependencies is. |
| 17:16 | bja_ | my codebase here is all clojure |
| 17:16 | justin_smith | no, a dep should be compiling for you, just trying to think of something that would cause that incompatibility |
| 17:17 | tolstoy | Have your main print out the java version, then "lein run" to see what's going on? |
| 17:18 | bja_ | I know the java version from `java -version` |
| 17:19 | tolstoy | Yeah, it's a sketchy suggestion. Is lein using the same version? Etc, etc. |
| 17:25 | bja_ | afaict, lein is using the same version. I'm using arch linux's tool to globally set the java version |
| 17:25 | hyPiRion | Lein uses the same version unless you explicitly set some environment variables, which very few people do |
| 17:26 | tolstoy | Trust but verify! ;) |
| 17:35 | csd_ | What's the correct pattern for catching the potential parsing error in (let [json (json/read-str json-str)] ...), given I don't want to wrap the let in a try as other actions in the function might fail as well, for different reasons |
| 17:36 | amalloy | something wrong with (let [json (try ..)] ...)? |
| 17:37 | amalloy | if you need to make decisions based on whether that happened, you can instead write (if-let [json (try ...)] (worked) (broken)) |
| 17:37 | csd_ | but won't it also bind the return value from the Catch if there's an exception? |
| 17:38 | bja_ | not it you return nil |
| 17:38 | csd_ | I was hoping to have the Catch return an error that I could pass to a Ring response |
| 17:39 | bja_ | I normally handle that with a namespaced exception using slingshot |
| 17:39 | bja_ | and then let a middleware deal with custom ring responses |
| 17:40 | bja_ | do you need to complete the rest of the function? |
| 17:40 | csd_ | yeah |
| 17:40 | csd_ | well not if it fails |
| 17:40 | bja_ | i.e. are you hoping to return a message, and then process some more stuff before returning the error message + other stuff |
| 17:40 | tolstoy | Put the json/parse stuff in a "decode" function and trap the error there? decode returns [:sucess doc] or [:error msg]? |
| 17:41 | csd_ | bja_: the function deserializes the json and attempts to make a rest call. if the parse fails it will return immediately |
| 17:42 | bja_ | in that case, I would do something like (throw+ {:type ::json-parse-fail :message "something" :other-keys :that-are-useful}) |
| 17:42 | csd_ | i'll have to look at the slingshot docs, i'm not familiar with it |
| 17:43 | bja_ | tolstoy's solution is more generic |
| 17:43 | bja_ | returning a vector of [status result] |
| 17:43 | clojurebot | Cool story bro. |
| 17:43 | csd_ | tolstoy: oh i missed that. i like that idea |
| 17:44 | bja_ | why did clojurebot CSB me? |
| 17:44 | tolstoy | I generally throw to a middleware handler using (ex-info ..) and (ex-data ..), but destructure return values works okay. |
| 17:44 | tolstoy | I also do all kinds of things until it all works, then refactor (when I don't have to worry about code review nags, that is). |
| 17:48 | amalloy | bja_: he's got a few behaviors that are just for fun. in particular, he interprets some random subset of messages (like 1%?) as if they were directed to him specifically |
| 17:48 | amalloy | he didn't understand why you were telling him "returning a vector of [status result]" |
| 17:49 | amalloy | clojurebot: returning a vector of [status result] |
| 17:49 | clojurebot | I don't understand. |
| 17:59 | csd_ | what is this error i get if i do (ex-info "" {}) outside of a throw statement |
| 17:59 | amalloy | ,(ex-info "" {}) |
| 17:59 | clojurebot | #error {\n :cause ""\n :data {}\n :via\n [{:type clojure.lang.ExceptionInfo\n :message ""\n :data {}\n :at [clojure.core$ex_info invokeStatic "core.clj" 4617]}]\n :trace\n [[clojure.core$ex_info invokeStatic "core.clj" 4617]\n [clojure.core$ex_info invoke "core.clj" 4617]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Comp... |
| 17:59 | csd_ | i've never seen an error message like this from cider |
| 17:59 | amalloy | doesn't look like an error to me. you created an exception, and there it is |
| 18:00 | amalloy | that's just how clojure prints exceptions |
| 18:00 | csd_ | ah |
| 18:13 | pilne | i like this: βIn Lisp, you have the power to shoot off your foot, not just shoot your foot! But don't worry β with Lisp, you can easily make a new foot! Or a tentacle.β |
| 18:16 | loophole | pilne: https://xkcd.com/224/ |
| 18:16 | loophole | ;) |
| 18:18 | pilne | LMAO |
| 18:18 | pilne | ahh perl... |
| 18:18 | pilne | perhaps the only syntax that is maligned to the extent as lisp |
| 18:18 | montanstercat | "bless this mess" OO is still my favorite part of perl |
| 18:19 | montanstercat | this data structure may or may not work out as an object, let's incant a ritual on it |
| 18:19 | loophole | montanstercat: bless you! |
| 18:21 | loophole | pilne: perl is a lisp with a funny syntax |
| 18:21 | pilne | i can see that |
| 18:23 | pilne | i find comfort in the regularity of s-expressions |
| 18:24 | loophole | pilne: i used perl a lot. I tend to think that one often solves problems in perl that you don't have in other languages |
| 18:24 | pilne | i was more of a python guy when it cames to perl/python/ruby |
| 18:24 | pilne | and now i futz around with "hy" when i use python lol |
| 18:27 | loophole | pilne: python has its use. its fairly easy to read and fast enough |
| 18:28 | loophole | pilne: i still use perl but not for big projects |
| 18:28 | pilne | yep, not knocking it whatsoever, i really don't "hate" any programming language, there are ones i dislike more, and ones i like more, but hate is just too strong for things like that |
| 18:29 | loophole | pilne shakespear is a funny language :) |
| 18:29 | pilne | true! |
| 18:30 | pilne | esolangs are fun, and lisp is probably the easiest way to "write" a simple goofy one too (: |
| 18:33 | loophole | pilne: maybe I will write a metal language one time. it will only contain words that are in manowar lyrics :D exceptions are thrown with HAIL AND KILL! and so forth |
| 18:34 | pilne | and i'll have to write the scripting language that works with it using GWAR vocabulary (: |
| 18:35 | loophole | pilne: :) |
| 18:35 | loophole | pilne: i'm off to bed now |
| 18:35 | loophole | cu |
| 18:35 | highclasshole | Playing devil's advocate here, but why do people like emacs so much for clojure? I use vim and fireplace never ever have issues -- guy today try to work on the project with emacs and literally could not get CIDER to work with nREPL -- I added the handler he added the cider-nrepl to his lein user profile and still just would not work |
| 18:35 | loophole | highclasshole: because... vim :) |
| 18:36 | justin_smith | highclasshole: I use emacs but I don't use CIDER, fwiw |
| 18:36 | loophole | highclasshole: I had to... ;) |
| 18:36 | highclasshole | How do you connect to the nrepl? |
| 18:36 | pilne | i've never had trouble getting either to work, and i've actually taken quite a fancy to spacemacs lately being that it combines the emacs base, with a very well-thought out modal system and a better package management (IMHO) system. |
| 18:36 | justin_smith | highclasshole: emacs has historically been a friendly environment for lispy programming |
| 18:36 | montanstercat | highclasshole: the years of elisp radiation makes us predisposed to clojure |
| 18:36 | justin_smith | highclasshole: I don't |
| 18:36 | highclasshole | oh |
| 18:37 | justin_smith | highclasshole: I used to use inferior-lisp now I just use a repl in a terminal |
| 18:37 | pilne | i also use ligttable because it's just kinda neat for quick one-off futzing, and atom with a repl in a terminal for things too, just depends on my mood really. |
| 18:37 | justin_smith | (require 'some.ns :reload) is simple enough, I don't need editor integration for that |
| 18:38 | highclasshole | Yeah that seems like the better approach, cider made us want to put a fist through the monitor |
| 18:39 | pilne | my quick and dirty setup is the zip from "clojure for the brave and true" tutorial |
| 18:39 | pilne | for emacs |
| 18:39 | highclasshole | Yeah thats what he used |
| 18:39 | tolstoy | Yeah, I've not had problems with Cider in years, |
| 18:39 | pilne | did he replace his .emacs.d folder or try and merge them? |
| 18:39 | highclasshole | replaced it |
| 18:40 | pilne | also, emacs can have issues launching from the gui (gnome 3 etc) if the path to lein is in your .bashrc |
| 18:40 | highclasshole | it works ok if you launch the repl from within emacs but connecting to a remote nrepl (even on localhost) would not work |
| 18:40 | highclasshole | and I did add the handler for the nrepl |
| 18:40 | highclasshole | nah its not that |
| 18:40 | pilne | k |
| 18:40 | pilne | just iterating over my "facepalm" moments |
| 18:41 | pilne | well... my emacs-cider related ones... all of them would be several encyclopedias... |
| 18:41 | justin_smith | highclasshole: nrepl is local only for security reasons by default |
| 18:41 | highclasshole | right |
| 18:42 | highclasshole | so ssh tunnel on a remote box and running locally on localhost |
| 18:42 | justin_smith | sure, yeah |
| 18:42 | highclasshole | the stupidest thing is it said "CANNOT CONNECT" yet would establish a TCP connection to the port |
| 18:42 | highclasshole | but sending anything to it would not work |
| 18:43 | highclasshole | it was probably one of the most annoying things i've dealt with -- it defied all logic and reason |
| 18:43 | justin_smith | highclasshole: so you were running cider-connect, and had the right port, and it was failing with CANNOT CONNECT but it was hitting the port? |
| 18:43 | highclasshole | yep |
| 18:44 | justin_smith | wow |
| 18:44 | highclasshole | we tried 0.8.1 and 0.10.1 same behaviour |
| 18:44 | highclasshole | of cider-nrepl |
| 18:44 | justin_smith | highclasshole: if you get a chance try "lein repl :connect <port>" to verify that works |
| 18:44 | justin_smith | (with a running repl on that port, of course) |
| 18:45 | highclasshole | that works fine |
| 18:45 | highclasshole | it also worked fine in fireplace, atom, telnet, intellij |
| 18:45 | justin_smith | haha |
| 18:45 | highclasshole | so it was like |
| 18:45 | highclasshole | whats the point of emacs? |
| 18:46 | highclasshole | have to add an additional dep to support the nrepl (which didn't even work) no other editors require any special handlers or additional dependencies to connect to the nrepl |
| 18:46 | highclasshole | it was like, this is seriously the "ppreferred" editor? |
| 18:46 | justin_smith | highclasshole: don't judge emacs by cider - emacs is a bit weird and crufty but I mean what do you expect from the oldest living editor?, cider on the other hand is often a mess |
| 18:46 | cap10morgan | highclasshole: please file an issue on cider's GitHub page. If we find a fix, I can most likely get it into an 0.10.x point release. |
| 18:47 | highclasshole | not on my work machine at the moment but I'll try to file an issue tomorrow |
| 18:47 | cap10morgan | highclasshole: thanks! |
| 18:47 | pilne | emacs (in this day and age) has a lot of lisp nostalgia, a lot of the syntax tools that other editors use for a lisp were originally made with emacs, and a lot of the common lisp/scheme tools are kept most up to date with it, clojure is a different beast of a lisp though due to its jvm parentage |
| 18:48 | tolstoy | Cider's sometimes a mess if you live on unstable. |
| 18:48 | highclasshole | Well I was a sysadmin for the better part of a decade, so I've been a vim user as long as I can remember |
| 18:48 | justin_smith | tolstoy: my coworkers who use cider are living with missing features and bugs for fear of everything breaking if they ever try to upgrade. |
| 18:49 | highclasshole | sysadmin / C developer |
| 18:49 | cap10morgan | I definitely recommend melpa-stable for cider, but even then some of the other clojure-emacs tools are incompatible w/ 0.10.x, which is :( |
| 18:50 | justin_smith | cap10morgan: my fear is that will always be the story with cider - you chose between the known brokenness of the past, or the unknown brokenness of the future, along with the breakages caused by upgrading. There's seemingly never a good stable point. |
| 18:50 | pilne | to be fair, clojure/lein/jvm are a much faster moving target than common lisp and scheme :p |
| 18:50 | cap10morgan | justin_smith: I agree, it hasn't been great. That's why I've been volunteering some release engineering time to try to improve it. |
| 18:51 | justin_smith | cap10morgan: and thank you for that, I just got frustrated it wasn't there already and walked away, which is definitely much less helpful :P |
| 18:51 | cap10morgan | justin_smith: my goal is to get 0.10.x to a stable, integrated, consistent point and then backport bugfixes and no-brainer improvements from master to it for awhile. |
| 18:51 | highclasshole | cap10morgan: thanks for that, didn't mean to be negative I really appreciate the work you are doijng |
| 18:52 | cap10morgan | justin_smith: Yeah, I know how that goes. My typical response too. Only so many things you can contribute to in a day! |
| 18:52 | cap10morgan | highclasshole: no worries; good motivation to keep working at making it better! |
| 18:52 | pilne | so with typed clojure, i can annotate where i want, and leave dynamic where i want... like... freedom? |
| 18:52 | pilne | clojure really just keeps blowing my mind... |
| 19:16 | tos9 | Hi. Only about <10 hours into clojure, so still very much learning the ropes. Why does (str :a) not raise a type error of some sort |
| 19:16 | tos9 | I come from Python, and I'm fairly sure if we had keywords, our str() would have the same behavior, but I'm trying to decide if my intuition for whose "fault" it is that this library that I handed a symbol to in the wrong place didn't raise an error carries over |
| 19:17 | tos9 | er s/symbol/keyword in that second message |
| 19:18 | justin_smith | tos9: str works on literally *anything* |
| 19:18 | justin_smith | tos9: it gives you the string of its value |
| 19:19 | tos9 | OK, so same as Python then. |
| 19:19 | justin_smith | tos9: or most OO languages really - if it's a value you can print it |
| 19:19 | tos9 | justin_smith: So, it's basically up to the library to use "better" mechanisms for ensuring it gets the right type there and not splatting random things into strings? |
| 19:19 | justin_smith | and to print it you need a string |
| 19:19 | TEttinger | str is a string-ify-ing function |
| 19:20 | TEttinger | ,(str {:a 1 :b "hey guys"}) |
| 19:20 | clojurebot | "{:a 1, :b \"hey guys\"}" |
| 19:20 | justin_smith | tos9: well, if you expect to turn something into a string, anything will do - if you need something more specific that's up to you, sure |
| 19:20 | TEttinger | pr-str is sometimes what you may want in place of str |
| 19:21 | TEttinger | ,(pr-str {:a 1 :b "hey guys"}) |
| 19:21 | clojurebot | "{:a 1, :b \"hey guys\"}" |
| 19:21 | TEttinger | same there |
| 19:21 | TEttinger | uhhh |
| 19:21 | tos9 | TEttinger: well basically you need a separate protocol |
| 19:21 | tos9 | (Does clojure have one?) |
| 19:21 | TEttinger | ,(str '(1 2 3)) |
| 19:21 | clojurebot | "(1 2 3)" |
| 19:21 | TEttinger | ,(pr-str '(1 2 3)) |
| 19:21 | clojurebot | "(1 2 3)" |
| 19:21 | tos9 | For objects that claim "my str representation is a thing that is actually sane, and not just debugging noise" |
| 19:21 | TEttinger | dammit come up with an example Ettinger! |
| 19:21 | justin_smith | tos9: pr-str / print-method |
| 19:22 | tos9 | justin_smith: well pr-str looks like it just worked on a list |
| 19:22 | justin_smith | tos9: for any given object you should be able to use str to get the default toString, and pr-str to get the readable version, if possible |
| 19:22 | TEttinger | ,(str #"[abc]$") |
| 19:22 | clojurebot | "[abc]$" |
| 19:22 | TEttinger | a ha |
| 19:22 | TEttinger | ,(pr-str #"[abc]$") |
| 19:22 | clojurebot | "#\"[abc]$\"" |
| 19:22 | TEttinger | the string representation of a regex is not directly readable as a regex |
| 19:23 | TEttinger | but its pr-str is |
| 19:23 | justin_smith | ,(type (read-string (pr-str #"[abc]$"))) ; TEttinger |
| 19:23 | clojurebot | java.util.regex.Pattern |
| 19:23 | justin_smith | TEttinger: d'oh, that's what you said |
| 19:23 | TEttinger | ,(re-find (read-string (pr-str #"[abc]$")) "balaclava") |
| 19:23 | clojurebot | "a" |
| 19:24 | TEttinger | ,(re-find (read-string (str #"[abc]$")) "balaclava") ; shouldn't work |
| 19:24 | clojurebot | #error {\n :cause "clojure.lang.PersistentVector cannot be cast to java.util.regex.Pattern"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentVector cannot be cast to java.util.regex.Pattern"\n :at [clojure.core$re_matcher invokeStatic "core.clj" 4667]}]\n :trace\n [[clojure.core$re_matcher invokeStatic "core.clj" 4667]\n [clojure.core$re_find invokeStatic "core... |
| 19:32 | justin_smith | any idea what's going on with clj-time coercion here? https://gist.github.com/noisesmith/ede8248dadd6bc81d77d |
| 19:33 | justin_smith | I feel like I must be missing something, I'm getting the same instant for year 0, and a year from year 0 |
| 19:33 | justin_smith | but only in the converted version, the clj-time value looks fine |
| 19:34 | TEttinger | a year from year 0, justin_smith? |
| 19:35 | justin_smith | right |
| 19:35 | TEttinger | do you mean a day from year 0? |
| 19:35 | justin_smith | I added a year |
| 19:35 | TEttinger | or a year after year 0? |
| 19:35 | TEttinger | oh ok |
| 19:36 | justin_smith | bbl |
| 19:41 | pilne | oh holy batballs |
| 19:41 | pilne | the arcadia project, unifying clojureCLR and unity |
| 19:41 | pilne | thank the makers |
| 19:51 | pilne | gf is now getting big into unity, so i feel i'll be helping with the js/c# side of things, and having clojure as an alternative in both cases makes me a happy lisper |
| 19:51 | pilne | although i'm kinda hoping to get her over to jme3 at some point |
| 19:54 | Kamuela | pilne: interesting but what's jme3 and how big is Arcadia |
| 20:03 | LucidTortoise | Hi, is there anyone here who has read through Clojure for the Brave and True? |
| 20:04 | LucidTortoise | I have come across what I think is errata, and I don't know how to solve it. |
| 20:04 | domgetter | LucidTortoise: the printed version or the online version? |
| 20:04 | LucidTortoise | Online. I have also read the printed version on Safari Books. Nothing is changed |
| 20:05 | domgetter | LucidTortoise: link to error? |
| 20:05 | LucidTortoise | http://pastebin.com/fyDqvtm7 |
| 20:05 | LucidTortoise | http://www.braveclojure.com/core-functions-in-depth/ |
| 20:05 | LucidTortoise | The Vampire Database section |
| 20:05 | TEttinger | Kamuela: JMonkey Engine version 3, which IIRC is not terrifically well-maintained |
| 20:06 | TEttinger | arcadia looks good |
| 20:06 | domgetter | LucidTortoise: pg 85 in the printed? |
| 20:06 | LucidTortoise | Maybe? Nothing I have read has page numbers. |
| 20:06 | domgetter | LucidTortoise: ah okay. What's the error? |
| 20:07 | LucidTortoise | (time (vampire-related-detials 0)) |
| 20:07 | LucidTortoise | CompilerException java.lang.RuntimeException: Unable to resolve symbol: vampire-related-detials in this context, compiling:(C:\Users\spint\AppData\Local\Temp\form-init64976743713428325.clj:1:7 |
| 20:08 | LucidTortoise | 2. Unhandled clojure.lang.Compiler$CompilerException |
| 20:08 | LucidTortoise | Error compiling: |
| 20:08 | LucidTortoise | C:\Users\spint\AppData\Local\Temp\form-init64976743713428325.clj:1:7 |
| 20:08 | LucidTortoise | Compiler.java: 6543 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 6485 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 3737 clojure.lang.Compiler$InvokeExpr/parse |
| 20:08 | LucidTortoise | Compiler.java: 6725 clojure.lang.Compiler/analyzeSeq |
| 20:08 | LucidTortoise | Compiler.java: 6524 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 38 clojure.lang.Compiler/access$300 |
| 20:08 | LucidTortoise | Compiler.java: 6129 clojure.lang.Compiler$LetExpr$Parser/parse |
| 20:08 | LucidTortoise | Compiler.java: 6723 clojure.lang.Compiler/analyzeSeq |
| 20:08 | LucidTortoise | Compiler.java: 6524 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 6485 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 5861 clojure.lang.Compiler$BodyExpr$Parser/parse |
| 20:08 | LucidTortoise | Compiler.java: 5296 clojure.lang.Compiler$FnMethod/parse |
| 20:08 | LucidTortoise | Compiler.java: 3925 clojure.lang.Compiler$FnExpr/parse |
| 20:08 | LucidTortoise | Compiler.java: 6721 clojure.lang.Compiler/analyzeSeq |
| 20:08 | LucidTortoise | Compiler.java: 6524 clojure.lang.Compiler/analyze |
| 20:08 | LucidTortoise | Compiler.java: 6779 clojure.lang.Compiler/eval |
| 20:08 | LucidTortoise | Compiler.java: 6745 clojure.lang.Compiler/eval |
| 20:08 | LucidTortoise | core.clj: 3081 clojure.core/eval |
| 20:08 | LucidTortoise | main.clj: 240 clojure.main/repl/read-eval-print/fn |
| 20:08 | LucidTortoise | main.clj: 240 clojure.main/repl/read-eval-print |
| 20:08 | LucidTortoise | main.clj: 258 clojure.main/repl/fn |
| 20:08 | LucidTortoise | main.clj: 258 clojure.main/repl |
| 20:09 | LucidTortoise | RestFn.java: 1523 clojure.lang.RestFn/invoke |
| 20:09 | LucidTortoise | interruptible_eval.clj: 58 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn |
| 20:09 | LucidTortoise | AFn.java: 152 clojure.lang.AFn/applyToHelper |
| 20:09 | LucidTortoise | AFn.java: 144 clojure.lang.AFn/applyTo |
| 20:09 | LucidTortoise | core.clj: 630 clojure.core/apply |
| 20:09 | LucidTortoise | core.clj: 1868 clojure.core/with-bindings* |
| 20:09 | LucidTortoise | RestFn.java: 425 clojure.lang.RestFn/invoke |
| 20:09 | LucidTortoise | interruptible_eval.clj: 56 clojure.tools.nrepl.middleware.interruptible-eval/evaluate |
| 20:09 | LucidTortoise | interruptible_eval.clj: 191 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn |
| 20:09 | domgetter | LucidTortoise: for future reference, don't paste > 2 or 3 lines into this chatroom |
| 20:09 | LucidTortoise | interruptible_eval.clj: 159 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn |
| 20:09 | LucidTortoise | AFn.java: 22 clojure.lang.AFn/run |
| 20:09 | LucidTortoise | ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker |
| 20:09 | LucidTortoise | ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run |
| 20:09 | LucidTortoise | Thread.java: 745 java.lang.Thread/run |
| 20:09 | LucidTortoise | 1. Caused by java.lang.RuntimeException |
| 20:09 | LucidTortoise | Unable to resolve symbol: vampire-related-detials in this context |
| 20:09 | LucidTortoise | Oops |
| 20:09 | LucidTortoise | Sorry Channel |
| 20:09 | LucidTortoise | This is why we use Pastebin |
| 20:09 | LucidTortoise | domgetter: I will definetly avoid that. |
| 20:10 | domgetter | You spelled details wrong |
| 20:10 | domgetter | "Unable to resolve symbol: vampire-related-detials in this context" |
| 20:10 | LucidTortoise | No way. I mean, okay. Wow. |
| 20:10 | LucidTortoise | Thanks. |
| 20:11 | domgetter | The printed version and the online version spell it "details" correctly both times |
| 20:11 | domgetter | no problem :) |
| 20:14 | LucidTortoise | I am going to kill and reload the repl buffer. I realized that typing things yourself gets overrated, so I copy and pasted the boook text and I still got the error |
| 20:16 | LucidTortoise | Yups. Be wary of blaming errata, even when the book doesn't have a section for them online! |
| 20:23 | pilne | Kamuela:: jme is jmonkeyengine (version 3 now) http://jmonkeyengine.org/ a java-based game engine/library. and arcadia is a clojurescript to unity bridging project. http://arcadia-unity.tumblr.com/post/100257212548/arcadia-01a-launched |
| 20:31 | adicto | gfredericks: will write a seperate keys function. |
| 21:30 | neoncontrails | pilne: fascinating. Have you used it? (Arcadia?) I've futzed around with some javascript interfaces to WebGL, and they all rely deeply on mutation and inheritance |
| 21:31 | pilne | i have not yet, i just started looking at it today since the gf crash-coursed unity for like 8 hours and is really smitten with it, but... i can't stand c# and f# still is a second class citizen in that world. |
| 21:33 | neoncontrails | It's really remarkable. I'm just trying to wrap my head around how a functional semantics could even really work in that environment, esp. with immutability |
| 21:33 | pilne | for what she wants to use it for (for now) the javascript level scripting is fine, and i can always help with the marvel that is clojurescript (: (i can also tolerate some plain javascript, just smitten with lisps) |
| 21:34 | pilne | i found a slide of tutorials for handling state in a couple different ways, one is the tutorial "caves of clojure" which seems to be left somewhat unfinished, and the other was from the perspective of a voxel-game in scala. |
| 21:35 | pilne | and from what i've gathered, immutable is default, but not forced at all times. |
| 21:36 | neoncontrails | I could see there being some definite advantages though for the expression of movement. I found movement very difficult to express in JS |
| 21:37 | neoncontrails | Which makes sense. Movement is a function, so it will be a little more natural to express in a functional style |
| 21:38 | neoncontrails | But if I change the color of a cube's face to red, I don't really want to get a brand new cube |
| 21:41 | justin_smith | neoncontrails: if you change the color of the cube's face to red, you don't really want it to be a series of sequential storage locations in a turing machine |
| 21:41 | justin_smith | neoncontrails: these are all abstractions |
| 21:45 | neoncontrails | justin_smith: heh. Touche. That's true |
| 21:45 | clojurebot | Pardon? |
| 21:58 | princeso | is it normal that criterium.core/bench lasts hours working? (4 hours and counting) |
| 21:59 | justin_smith | how big a function did you give to it? is it a function call that would normally return? |
| 21:59 | justin_smith | princeso: no, I've never had bench take that long |
| 21:59 | stapler | ,(rand-nth [1 2 3 4 5]) |
| 21:59 | clojurebot | 3 |
| 21:59 | princeso | its just an eval some data |
| 22:00 | justin_smith | you mean literally calling eval? |
| 22:01 | princeso | yes, one eval |
| 22:02 | justin_smith | eval is very slow, but still that shouldn't take hours to benchmark |
| 22:02 | princeso | justin_smith: classes loaded before 1205701 iterations |
| 22:03 | TEttinger | sounds like the data is large |
| 22:03 | TEttinger | which isn't eval's fault |
| 22:04 | princeso | itst just a (defn f [x] (+ 1 x)) |
| 22:04 | princeso | im going to stop it. |
| 22:11 | justin_smith | princeso: what clojure version did you do that with? |
| 22:14 | justin_smith | princeso: I'm running (crit/bench (eval '(defn f [x] (+ 1 x)))), maybe it will return eventually |
| 22:14 | justin_smith | clojure 1.8.0 |
| 22:14 | princeso | justin_smith . 1.7.0 . well the thin being benchmarked is some assoc an prewalk-replace to get that func (defn f [x] (+ 1 x)). Nothing exorbitant |
| 22:14 | justin_smith | princeso: liar! |
| 22:15 | princeso | haha |
| 22:16 | princeso | justin_smith: i suppose it does a real benchmark |
| 22:16 | princeso | justin_smith: sorry mate |
| 22:16 | justin_smith | heh, I guess I'll find out how long an eval defn takes in the raw, but it probably won't have much to do with your case... |
| 22:17 | princeso | please show results |
| 22:18 | justin_smith | this is now officially the longest crit/bench I have ever run, and it's still chugging along |
| 22:37 | backnforth | Newbie question: When I run "lein run" I get a clojure could not transfer artifact error. Here's my project.clj: http://pastebin.com/rCRUweb1 |
| 22:41 | backnforth | Why do I get this error? There's are also error messages saying im getting a "java.lang.runtimeexception: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty |
| 22:57 | princeso | justin_smith: how did that end? |
| 23:01 | highclasshole | backnforth: lein run issue sounds like lein is having trouble downloading remote artifacts |
| 23:02 | highclasshole | you behind a proxy or something |
| 23:02 | justin_smith | princeso: still going |
| 23:02 | justin_smith | backnforth: are you using ubuntu? |
| 23:03 | backnforth | I am running ubuntu, and no I'm not using a proxy. |
| 23:03 | justin_smith | backnforth: known ubuntu issue http://askubuntu.com/questions/627426/minecraft-with-openjdk-7-i-get-the-trustanchors-parameter-must-be-non-empty |
| 23:05 | backnforth | Sweet |
| 23:24 | justin_smith | princeso: no more computer for tonight, but I'll leave that benchmark running, and I typed in a (java.util.Date.) after, so I should see what time it finally finished |
| 23:51 | princeso | justin_smith: good. good night |