2016-04-04
| 00:00 | TEttinger | two nested vectors since you used conj to add a new element instead of concat to append a collection |
| 00:00 | user_ | ah |
| 00:00 | user_ | makes sense |
| 00:00 | TEttinger | ,(let [listInput [{:paths [[:node 1, :cost 1], [:node 2, :cost 2]]},{:paths [[:node 2, :cost 1], [:node 3, :cost 2]]},{:paths [[:node 0 :cost 1], [:node 1, :cost 2]]}] ] listInput) ; this is what gave 2 |
| 00:00 | clojurebot | [{:paths [[:node 1 :cost 1] [:node 2 :cost 2]]} {:paths [[:node 2 :cost 1] [:node 3 :cost 2]]} {:paths [[:node 0 :cost 1] [:node 1 :cost 2]]}] |
| 00:01 | TEttinger | ,(let [listInput [] listInput (concat listInput [{:paths [[:node 1, :cost 1], [:node 2, :cost 2]]},{:paths [[:node 2, :cost 1], [:node 3, :cost 2]]},{:paths [[:node 0 :cost 1], [:node 1, :cost 2]]}])] (print (count (:paths(nth listInput 1))))) |
| 00:01 | clojurebot | 2 |
| 00:01 | TEttinger | conj to concat works in your existing code |
| 00:01 | TEttinger | you were 3 characters off, that's all! |
| 00:07 | user_ | TEttinger, lol |
| 00:07 | user_ | Any good Clojure games worthwhile to play? |
| 00:08 | user_ | Even ones written in Clojurescript |
| 00:23 | libertytrader | I have two collection of maps of the same type... i want to merge them. Do I have to convert one to a seq and then I can use conj? |
| 00:23 | libertytrader | or do i have to map conj over the seq or something? |
| 00:27 | libertytrader | oh concat sweet |
| 00:31 | tolstoy | Is there a handy function to remove a matching element from a vector? |
| 00:33 | dpzmick | tolstoy: https://clojuredocs.org/clojure.core/filterv |
| 00:34 | tolstoy | Alas. Nothing as clean is disj, eh? ;) |
| 00:34 | tolstoy | Anyway, thanks! |
| 02:08 | tolstoy | Oh, my: https://www.youtube.com/watch?v=pTArJBycP4Y (Beethoven Sympony 3 graphically presented.) |
| 02:09 | libertytrader | I have a problem... when I type "lein run" my app works |
| 02:09 | libertytrader | but the standalone uberjar does not work |
| 02:09 | libertytrader | no printf output |
| 02:09 | libertytrader | anyone have any ideas |
| 02:10 | cwgem|mac | Any good way to get the Clojure source with the various stdlib packages included? It seems like I have to download almost the entire clojure GitHub org repos to achieve that |
| 02:10 | tolstoy | In project.clj, make sure :main is set to the namespace of your project. |
| 02:44 | libertytrader | tolstoy cwgem|mac the problem was i needed to call flush |
| 03:24 | slester_ | quick question, is there any reason jdbc's query function would require a lazyseq? |
| 03:25 | hiredman | what do you mean by require? |
| 03:25 | slester_ | err, return. sorry. late. |
| 03:26 | hiredman | query's return value isn't actually lazy by default, query calls doall on it |
| 03:26 | slester_ | I'm doing a (str (j/query db ["select * from table"])) thing and it prints out LazySeq |
| 03:26 | hiredman | the type is LazySeq, but by default the seq is entirely realized |
| 03:28 | hiredman | seqs are sort like an iterator in java in that they represent a traversal of something |
| 03:28 | hiredman | so query is return a traversal over the results of the query |
| 03:28 | slester_ | sorry, there's also a :row-fn :name in there |
| 03:28 | hiredman | which makes so much sense that I bet whoever wrote it didn't even think about it |
| 03:29 | hiredman | (if your question is "what is the |
| 03:30 | hiredman | so if your question is literally "what is the reason it returns a seq" the answer is basically "that is the default stance of a clojure programmer" |
| 03:32 | hiredman | if you question is "how do I get a readable printing of a seq" the answer is actually "str doesn't always return readable things, it just calls .toString, if you want to get readable things use the pr and prn family of functions" |
| 03:33 | slester_ | the latter was it, thanks, I expected str to do the same thing as print |
| 03:33 | hiredman | not print, pr |
| 03:34 | slester_ | well, in my function I had (let [x (j/query..)] (print x) x) and it printed out things |
| 03:34 | slester_ | but I was doing (str "stuff:" (the-fn)) and it did not do what I thought it would do |
| 08:09 | Lewix | morning |
| 08:36 | irctc | Hi There |
| 08:37 | irctc | I am new to clojure and need some help in writing a clojure code to get data from json payload and send an email to interested parties |
| 08:38 | faxmodem | irctc: what did you try? |
| 08:38 | irctc | Need help in converting json payload which is non repeating into data structure |
| 08:38 | faxmodem | irctc: there's a lib for that I've used some time ago |
| 08:38 | faxmodem | cheshire or something |
| 08:38 | ridcully | irctc: do you have any specific problems to share? e.g. some code snippet + errors on some paste-site? |
| 08:38 | MJB47_ | cheshire is the json goto i think |
| 08:39 | irctc | ya I have |
| 08:39 | irctc | { "apiVersion": "1.0", "messageId": "305536b9-36cf-4781-91d3-0a0600b30101", "timestamp": 1459082055277, "testEvent": false, "projectId": "vof_pratima-hello-world", "events": [ { "eventId": "REVIEW", "projectId": "vof_pratima-hello-world", "timestamp": 1459082038, "data": { "review": { "id": 27, "title": "test", "created": 1459082037700, "modified": |
| 08:39 | ridcully | please don't paste into irc. a) it cuts off your text, b) if you paste much the server might kill you because of flooding |
| 08:39 | irctc | I want to send email to the to email value |
| 08:40 | irctc | { "apiVersion": "1.0", "messageId": "305536b9-36cf-4781-91d3-0a0600b30101", "timestamp": 1459082055277, "testEvent": false, "projectId": "vof_pratima-hello-world", "events": [ { "eventId": "REVIEW", "projectId": "vof_pratima-hello-world", "timestamp": 1459082038, "data": { "review": { "id": 27, "title": "test", "created": 1459082037700, "modified": |
| 08:41 | irctc | The code I wrote for this is |
| 08:42 | irctc | (defn make-commit-msg [reviewevent] (get-in env ["review" 0 "id"]) ) (defn make-commit-email [event] (apply str (mapv make-commit-msg (get event "events"))) ) (deforch "Generic hook to send email when Merge request is created" (defstart :from :mergehook :when [ (event=? "REVIEW" ["events" 0 "eventId"]) ] :then (let [event (:event context)] (email "pratima.mangena@oracle.com" "[Generic webhook from webho |
| 08:42 | ridcully | well maybe i'm /ignored... |
| 08:42 | irctc | as of now I have hard coded the target email address however I should pull from the json payload |
| 08:43 | Empperi | irctc: do NOT paste stuff like that to IRC |
| 08:43 | Empperi | use pastebin, refheap or similar |
| 08:43 | Empperi | no one wants to read that from IRC |
| 08:43 | clojurebot | Cool story bro. |
| 08:43 | Empperi | clojurebot: ain't it? |
| 08:43 | clojurebot | Excuse me? |
| 08:44 | Empperi | clojurebot: you are a moron, but that's not your fault but your creators so it's cool |
| 08:44 | clojurebot | Huh? |
| 08:44 | faxmodem | clojurebot: consider yourself excused |
| 08:44 | clojurebot | Titim gan éirí ort. |
| 08:44 | irctc | where is paste bin |
| 08:44 | Empperi | |
| 08:44 | Empperi | first hit in google I'd gather |
| 08:47 | irctc | http://pastebin.com/9XEsvL93 |
| 08:48 | irctc | is this accessible |
| 09:13 | irctc | Reposting my code |
| 09:13 | irctc | http://pastebin.com/9XEsvL93 |
| 09:13 | irctc | Any clojure experts good at decoding the json payload for me |
| 09:14 | irctc | please respond |
| 09:17 | kwladyka | irctc do you have json and want convert it to edn? |
| 09:17 | kwladyka | (clojure data structure) |
| 09:30 | irctc | here is the json |
| 09:30 | irctc | http://pastebin.com/9M4EdN84 |
| 09:33 | kwladyka | irctc what did you do to find a solution? It is in the first position on google. Or i don't understand your problem. |
| 09:33 | irctc | my json payload is http://pastebin.com/9M4EdN84 |
| 09:34 | irctc | the code I wrote to pull the json payload is http://pastebin.com/9XEsvL93 |
| 09:34 | irctc | I need help in traversing the payload using clojure code |
| 09:35 | irctc | I got a blank email with no body |
| 09:35 | kwladyka | you need conver json to end (clojure format) yes? if you use ring you can use wrapper, if you don't use ring you can use for example https://github.com/clojure/data.json (first position after write in google "clojure json") |
| 09:35 | irctc | where I expect review ID in the json payload |
| 09:35 | kwladyka | *end = edn |
| 09:37 | kwladyka | i don't know what you pass as parameter to this functions, i can only guess you don't paste edn data, but for example string |
| 09:50 | kwladyka | irctc please don't write to me on priv. It doesn't work like i will write code for you. I can give hints, fishing rod, sometimes fish, but i wouldn't do job for your. |
| 09:52 | RedNifre | Hey there. I'm currently reading JoC and the part about lists sharing their immutable data demonstrates this via "it's not only equal (= l1 l2) but also identical (identical? l1 l2)". This looks to me like "=" means "equal", but I vaguely remember somebody in this channel saying "use == for numbers" a while ago. So what's up with identical? vs = vs == ? |
| 09:54 | justin_smith | RedNifre: = uses structural equality for data structures, == is only for numbers and does value equality. = doesn't work across exact/inexact |
| 09:54 | ridcully | RedNifre: identical? is basically == from java (same "pointer"). = is basically equals from java. and == is == for numbers |
| 09:54 | justin_smith | ,(= 1 1.0) |
| 09:54 | clojurebot | false |
| 09:55 | justin_smith | ,(= '(1 2) [1 2]) |
| 09:55 | clojurebot | true |
| 09:56 | justin_smith | ,(== 1.0 1) |
| 09:56 | clojurebot | true |
| 10:00 | RedNifre | ,(identical? 1 1) |
| 10:00 | clojurebot | true |
| 10:01 | RedNifre | I find the behaviour of = very strange. |
| 10:01 | RedNifre | ,(== '(1 2) [1 2]) |
| 10:01 | clojurebot | #error {\n :cause "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentList cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers equiv "Numbers.java" 208]}]\n :trace\n [[clojure.lang.Numbers equiv "Numbers.java" 208]\n [sandbox$eval121 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval121 in... |
| 10:01 | justin_smith | ,(let [a '(1 2) b (cons 0 a) c (rest b)] (identical? a c)) |
| 10:01 | clojurebot | true |
| 10:02 | justin_smith | == is only for numbers, the above demonstrates what JoC was saying - the fact that it's the same data |
| 10:02 | RedNifre | Would this be a good rule of thumb?: "Use == for numbers and = for everything else. You rarely need 'identical?'" |
| 10:02 | justin_smith | sounds right |
| 10:02 | justin_smith | also use = for numbers if you care about the precision |
| 10:03 | RedNifre | I find this strange because 1 and 1.0 seem more equal to me than '(1 2) and [1 2] |
| 10:03 | sdegutis | back |
| 10:03 | justin_smith | RedNifre: '(1 2) contains all the information [1 2] does, (float n) can lose information compared to n |
| 10:04 | RedNifre | I thought that '(1 2) was a different type than [1 2] and that 1 and 1.0 are precisely identical, even on the bit level in this case. |
| 10:04 | sdegutis | RedNifre: |
| 10:04 | justin_smith | RedNifre: that may be the case for 1.0 / 1, I forget, but definitely not the case generally for n / (float n) |
| 10:05 | sdegutis | ,(map type [1 1.0]) |
| 10:05 | clojurebot | (java.lang.Long java.lang.Double) |
| 10:05 | justin_smith | RedNifre: clojure's equality cares about shape more than type |
| 10:05 | sdegutis | ,(map type [1 (float 1.0)]) |
| 10:05 | clojurebot | (java.lang.Long java.lang.Float) |
| 10:05 | sdegutis | ,(map type [(int 1) (float 1.0)]) |
| 10:05 | clojurebot | (java.lang.Integer java.lang.Float) |
| 10:05 | sdegutis | Hi |
| 10:05 | sdegutis | whatd i miss |
| 10:06 | sdegutis | good evening |
| 10:11 | RedNifre | WHat's shape? Is it "potential data"? |
| 10:11 | justin_smith | RedNifre: no, it is the layout (sequential, the count of the sequence, vs. lookup, the keys and vals of the lookup) |
| 10:12 | justin_smith | in general if (into (empty x) y) is the same as x, then x = y, if they agree regarding sequential or associative |
| 10:12 | justin_smith | wait that's bad and not always right |
| 10:18 | justin_smith | RedNifre: any two sequential things that are immutable (list, lazy-seq, vector) are = if their contents are all = in the same order |
| 10:19 | justin_smith | RedNifre: any two hash-maps (PersistentArrayMap, PersistentHashMap) are = if their key / val pairs are = |
| 10:20 | sdegutis | RedNifre: kinda like (= [1 2] '(1 2)) are "the same" |
| 10:20 | sdegutis | RedNifre: because all the things inside are considered equal in value |
| 10:20 | justin_smith | sdegutis: his question started with that |
| 10:20 | sdegutis | haha |
| 10:20 | sdegutis | oops |
| 10:22 | sdegutis | Well, this is not going well. |
| 10:22 | sdegutis | I had an idea to create a macro, but it's causing an infinite redirect-loop. |
| 10:25 | shafire | hi |
| 10:26 | shafire | is someone using clojure with gradle? |
| 10:26 | sdegutis | hi |
| 10:26 | sdegutis | probably not. |
| 10:26 | shafire | more leiningen? |
| 10:27 | wink | lein or boot, yeah |
| 10:28 | Guest31160 | is there a way to use everything in a ns except a certain function? |
| 10:31 | xemdetia | Guest31160, if you look on http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns there seems to be an :exclude directive that sounds like what you want |
| 10:32 | hamid | curiously asking.. why not dynamically specify size of the thread-pool? https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj |
| 10:33 | hamid | or does that crosses some sort of philosophy in clojure's land? |
| 10:34 | xemdetia | https://github.com/clojure/core.async/commit/7b64bd8a22c2b6df69c23dce34eb66d705f5bf1a |
| 10:34 | xemdetia | looks like it was a deliberate change |
| 10:40 | sdegutis | i dont know many people who use boot yet |
| 10:41 | sdegutis | leiningen is still king and for good reason |
| 10:41 | sdegutis | boot may be good but it came in far too late to have a fair chance |
| 10:42 | phillord | I think you need to look at new projects -- if you're environment is already running in lein, why would you change? |
| 10:42 | phillord | but that's not a good predictor of the future |
| 10:42 | shafire | cursive don't support boot either |
| 10:56 | sdegutis | phillord: support is the main thing; more ides support lein than boot |
| 10:57 | sdegutis | phillord: also lein covers more cases since its older |
| 11:00 | phillord | sdegutis: true, but then boot is, I think, more easily extensible than lein, certainly in place |
| 11:01 | sdegutis | phillord: that may be true, but for 99% of cases, lein doesn't need to be extended because it already covers most use-cases |
| 11:02 | phillord | sdegutis: also true for Java. And,yet, we have clojure. |
| 11:08 | Glenjamin | are you including plugins in that sdegutis ? |
| 11:08 | sdegutis | Glenjamin: nope |
| 11:08 | sdegutis | but probably |
| 11:09 | Glenjamin | i suspect almost all clojure apps have at least one lein plugin |
| 11:09 | Glenjamin | i dunno who's point that helps |
| 11:34 | sdegutis | Glenjamin: if our project at work has any, it's brought in by Cider |
| 11:35 | sdegutis | yep, that brings in exactly one plugin: [cider/cider-nrepl "0.11.0"] |
| 11:41 | sdegutis | so yeah, we could probably easily switch to boot |
| 11:41 | sdegutis | but the last time I tried, it had a bug when used with Cider: |
| 11:42 | sdegutis | if you jumped to the definition of a symbol within your project, instead of bringing you to your own file in that project, it brought you to a copy of it somewhere in ~/.boot or something |
| 11:42 | sdegutis | that made it pretty useless for me. |
| 11:42 | sdegutis | the boot folks said it might be fixed soon, and that was like a year ago, so maybe it is fixed now |
| 11:42 | sdegutis | Fin. |
| 11:42 | schmir | sdegutis: it's fixed |
| 11:43 | sdegutis | schmir: was it you i talked to about it? |
| 11:43 | arrdem | sdegutis: that's fantastically rude dude |
| 11:43 | arrdem | be nice |
| 11:43 | schmir | sdegutis: no |
| 11:43 | arrdem | this is a public channel. Take it to pms if you don't want replies |
| 11:43 | sdegutis | arrdem: ... i cant even imagine what anything i said could be rude |
| 11:44 | sdegutis | schmir: oh, thought it might have been |
| 11:44 | sdegutis | schmir: i dont remember who it was i talked to in the boot chan about it |
| 11:44 | sdegutis | arrdem: oh, i see now.. you misinterpreted my reply to schmir in the most negative possible way |
| 11:45 | schmir | sdegutis: I did so too for a second :) |
| 11:45 | sdegutis | arrdem: look, i get that you have a grudge against me for a single thing i said years ago that you misinterpreted.. but stop being a prick to me every few months please, its getting really annoying |
| 11:45 | sdegutis | schmir: noted, sorry about that, ill be more careful |
| 11:45 | schmir | no problem |
| 11:56 | sdegutis | it's snowing. |
| 11:57 | kenbolton | sdegutis: northeast corridor? |
| 11:57 | sdegutis | chicago |
| 11:57 | kenbolton | snowing here 60 miles north of new york city. |
| 11:58 | sdegutis | i guess winter just doesnt want to leave this year |
| 11:59 | kenbolton | it only just arrived this weekend. |
| 12:34 | sdegutis | Fixed! Woo! |
| 12:53 | sdegutis | ,(update {} :foo (fn [foo] (-> foo (update-in [:bar :quux] (fnil inc 0)) (assoc-in [:string] "string!")))) |
| 12:53 | sdegutis | phew! |
| 12:53 | clojurebot | {:foo {:bar {:quux 1}, :string "string!"}} |
| 12:54 | kenrestivo | ugh https://www.refheap.com/116881 cider now refuses to work at all |
| 13:01 | sdegutis | kenbolton: you dont use cider? |
| 13:02 | wutf | anyone popping a ClojureScript repl from within emacs using C-c M-J as per here under Super Advanced? https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl |
| 13:18 | justin_smith | kenrestivo: monroe or inf-clojure might be better options than nrepl.el these days - worth checking out at least |
| 13:24 | justin_smith | kenrestivo: also, the error you posted reminds me of the weirdness I have seen when updating cider.el in place - it works more cleanly if you nuke it and do a fresh install of another version |
| 13:24 | justin_smith | nuke and re-install clojure mode too, just for voodoo sake |
| 13:26 | sdegutis | kenbolton: I've had a lot of success with Cider fwiw, but ymmv |
| 13:27 | kenbolton | sdegutis: i appreciate that, but it was kenrestivo who was asking. |
| 13:27 | sdegutis | oh sorry kenbolton |
| 13:27 | kenbolton | no worries |
| 13:28 | sdegutis | kenrestivo: I've had a lot of success with Cider fwiw, but ymmv |
| 13:28 | sdegutis | ill just blame tab completion and hope it sticks |
| 13:28 | kenbolton | good enough |
| 13:31 | sdegutis | kenbolton: that said, cider is pretty cool |
| 13:32 | sdegutis | im constantly amazed by how good a clojure ide it is |
| 13:32 | sdegutis | plus i like that it integrates so nicely with emacs |
| 13:32 | sdegutis | phew, fixed like 4 major bugs this morning |
| 13:32 | kenbolton | i need to play with it. i know it was recently dropped into the jupyter clojure integration. |
| 13:42 | kenrestivo | it's very slick, but finicky |
| 13:42 | kenrestivo | and not that stable, it seems |
| 14:28 | j-pb | I found a WAT |
| 14:29 | j-pb | ,(= Double/NaN Double/NaN) |
| 14:29 | clojurebot | false |
| 14:29 | j-pb | ,(= '(Double/NaN) '(Double/NaN)) |
| 14:29 | clojurebot | true |
| 14:29 | j-pb | WAT! |
| 14:30 | arrdem | j-pb: that's per the IEEE float spec |
| 14:30 | arrdem | no wat at all |
| 14:30 | j-pb | arrdem: the IEEE float spec says that they are not equal UNLESS in a list? |
| 14:30 | arrdem | j-pb: oh. No. That's a WAT. |
| 14:30 | tavoris | What's the reason for them not being equal? |
| 14:30 | arrdem | Bug in CLJ equality probably. |
| 14:31 | j-pb | yeah |
| 14:31 | arrdem | tavoris: because NaN could be the result of arbitrary computation. There's no way to tell if two NaN results are from the same source, so NaNs can't be eqaul. |
| 14:31 | j-pb | test.check ftw this is breaking my code |
| 14:32 | ystael | ,(= [Double/NaN] [Double/NaN]) |
| 14:32 | arrdem | yeah test.check is one of my favorite libraries |
| 14:32 | clojurebot | false |
| 14:32 | ystael | ... |
| 14:32 | arrdem | ystael: OH. I know what this is. |
| 14:32 | arrdem | j-pb: not a bug! |
| 14:32 | luma | in the second case, you're comparing the symbols |
| 14:32 | arrdem | j-pb: it's the result of quoting. Right. |
| 14:32 | arrdem | luma got it. |
| 14:32 | ane | ,(= '(a) '(a)) |
| 14:32 | clojurebot | true |
| 14:33 | j-pb | arrdem: aaar yeah true |
| 14:34 | j-pb | this thing is really hard to debug I can't copy paste stuff into the repl because it contains lists and NaNs :( |
| 14:35 | sdegutis | Today I replaced two inc with (fnil inc 0). It is a good day. |
| 14:35 | justin_smith | ,(pr-str (/ 1.0 0.0)) |
| 14:35 | clojurebot | "Infinity" |
| 14:36 | justin_smith | ,(pr-str (/ 0.0 0.0)) |
| 14:36 | clojurebot | "NaN" |
| 14:36 | justin_smith | yeah, those are not readable |
| 14:36 | arrdem | For no apparent reason. |
| 14:36 | j-pb | yeah |
| 14:37 | ptisnovs | ,(Double/parseDouble "Infinity") |
| 14:37 | clojurebot | Infinity |
| 14:38 | ptisnovs | ,(Double/parseDouble "NaN") |
| 14:38 | clojurebot | NaN |
| 14:38 | ptisnovs | strange... |
| 14:39 | arrdem | tools.reader supports them, it's just that Clojure's built in reader doesn't. |
| 14:39 | sdegutis | ,(get {Double/NaN 3} Double/NaN) |
| 14:39 | clojurebot | nil |
| 14:39 | sdegutis | heheheheheh |
| 14:40 | ptisnovs | ,(Double/parseDouble "-NaN") |
| 14:40 | clojurebot | NaN |
| 14:43 | Bronsa | j-pb: '(Double/NaN) is a list with the *symbol* Double/NaN, not the NaN value |
| 14:43 | Bronsa | try comparing (list Double/NaN) |
| 14:44 | j-pb | Bronsa: yeah arrdem figured it out already ^^ |
| 14:44 | j-pb | by bad |
| 14:44 | Bronsa | now if you want a real WAT: |
| 14:44 | Bronsa | ,(let [x (identity Double/NaN)] (= x x)) |
| 14:44 | clojurebot | true |
| 14:44 | Bronsa | ,(let [x Double/NaN] (= x x)) |
| 14:44 | clojurebot | false |
| 14:45 | arrdem | Bronsa: I'm listening :P |
| 14:45 | j-pb | 0o |
| 14:45 | Bronsa | arrdem: where's the fun if I tell you? :) try decompiling the two |
| 14:45 | arrdem | Bronsa: my guess is downcast to object and then pointer equality. |
| 14:45 | Bronsa | almost correct |
| 14:45 | arrdem | I'll disassemble it inna bit. |
| 14:46 | Bronsa | well, let's not nitpick -- that was correct |
| 14:46 | Bronsa | two Double NaN *objects* can compare identical? but not equal |
| 14:47 | arrdem | Right, of course they are identical?, I guess I'm surprised that's what's being reached here tho. |
| 14:47 | Bronsa | = on double literals will use `lcmp` on the doubleValue, (identity) makes that a Util/equiv comparison |
| 14:47 | arrdem | Right. |
| 14:48 | ystael | ,(let [^double x (identity Double/NaN)] (= x x)) |
| 14:48 | clojurebot | false |
| 14:48 | octe | if they are identitical they should be equal as well? |
| 14:48 | arrdem | octe: by the IEEE float spec they can't be. |
| 14:48 | octe | oh, for things like nan? |
| 14:48 | arrdem | yeah |
| 14:48 | octe | ah, gotcha |
| 14:49 | octe | thats why you have the isnan functions, etc |
| 14:49 | arrdem | Bronsa: I guess I'm surprised that Util/equiv doesn't handle this case... |
| 14:49 | arrdem | octe: right. |
| 14:50 | Bronsa | arrdem: eh, I think it's reasonable to short circuit equality on positive pointer checks |
| 14:51 | Bronsa | arrdem: fun thing is that this leats to difference in NaN handling between array-map and hash-map since they use different comparators |
| 14:51 | j-pb | *grabs a bucket* |
| 14:51 | arrdem | aha |
| 14:51 | arrdem | Whenever I want to find yaks I just grep my logs for whenever Bronsa talks about "fun" |
| 14:51 | Bronsa | heh |
| 14:52 | j-pb | I hate floating point with a passion... |
| 14:52 | Bronsa | btw I wouldn't say that behaviour is inconsistent with the IEEE spec. |
| 14:52 | sdegutis | meh |
| 14:52 | arrdem | I'm surprised that CLJ-1074 Nan/Infinity reader support is the only open NaN ticket |
| 14:52 | Bronsa | the java spec guarantess that primitive doubles will be IEE 754 |
| 14:53 | Bronsa | and that Double objects wrap a double primitive |
| 14:53 | Bronsa | but making (Double. NaN) === (Double NaN) is about jvm object semantics, not double semantics |
| 14:54 | ptisnovs | Bronsa: yeah, otoh the spec defines, that Double is object and == on objects compares pointers (err references) |
| 14:54 | Bronsa | ptisnovs: right, which is consistent with what we're observing |
| 14:54 | Bronsa | a comparing identical? but not equal |
| 14:54 | Bronsa | possibly surprising, sure, but not incorrect or inconsistent |
| 14:55 | TimMc | How do you feel about that part of the IEEE 754 spec? :-) |
| 14:55 | arrdem | TimMc: a yak beyond shaving :P |
| 14:55 | Bronsa | arrdem: http://dev.clojure.org/jira/browse/CLJ-1792 |
| 14:56 | arrdem | Bronsa: huh you've found a bug in my JIRA -> org exporter. |
| 14:56 | Bronsa | this behaviour has nothing to do with NaN btw. any (reify Object (equals [_ _] false)) would work |
| 14:57 | arrdem | Yeah. JVM object equality is fundamentally hosed. |
| 14:57 | Bronsa | arrdem: is it one beer per bug? :P |
| 14:57 | TimMc | Sure, but .equals does declare some expectations of how it will behave. |
| 14:58 | TimMc | (if you override it) |
| 14:58 | arrdem | Bronsa: if you ever make it to the states to collect :P |
| 14:58 | arrdem | I should be keeping a scoreboard... |
| 14:58 | octe | TimMc, which is a great source of bugs, when people override it |
| 14:58 | octe | :) |
| 15:00 | Bronsa | TimMc: it doesn't say anything about two values having to compare .equal if they are identical though |
| 15:01 | j-pb | arrdem: I just realized that this also occurs somewhere with the values generated by test.check |
| 15:01 | j-pb | (gen/such-that #(= % %) (gen/vector gen/any-printable)) |
| 15:01 | Bronsa | oh, it actually does I guess |
| 15:01 | Bronsa | `It is reflexive: for any non-null reference value x, x.equals(x) should return true.` |
| 15:02 | Bronsa | well, I guess the thing is it says it *should*, not it *must*? :P |
| 15:02 | j-pb | arrdem: this means that the NaN's slip past the such-that only to blow up my test (which checks if values serialize correctly to disk and deserialize correctly to memory) |
| 15:03 | j-pb | Bronsa: lol, that's just pure evil |
| 15:03 | Bronsa | arrdem: seriously considering next clojure/conj btw |
| 15:06 | octe | ,(let [d (Double/parseDouble "NaN")] (.equals d d)) |
| 15:06 | clojurebot | true |
| 15:06 | octe | was that not what you meant? |
| 15:09 | Bronsa | yeah of course, no inconsistency there. I was just referring to my prior example of (reify Object (equals [_ _] false)), which after reading the contract for Object.equals is probably wrong |
| 15:09 | Bronsa | s/wrong/invalid |
| 15:10 | octe | when I need to override equals i usually use lombok's @EqualsAndHashCode |
| 15:10 | j-pb | Bronsa: any tips on a workaround for that NaN object thing? |
| 15:10 | Bronsa | j-pb: what issue in particular? |
| 15:10 | j-pb | NaN sometimes being equal and sometimes not :/ |
| 15:11 | Bronsa | avoid boxed NaN I guess? |
| 15:11 | j-pb | Yeah, but it seems that test.check/any already generates those ^^ |
| 15:12 | tavoris | ,(identical? Double/NaN Double/NaN) |
| 15:12 | clojurebot | false |
| 15:12 | tavoris | ^ why? |
| 15:12 | j-pb | IEEE float spec |
| 15:12 | Bronsa | tavoris: that NaN gets boxed twice, resulting in two different objects |
| 15:12 | j-pb | ah really so this is already an autoboxed value? |
| 15:12 | j-pb | crazy |
| 15:14 | Bronsa | actually that's probably comparing two unboxed NaNs in this case. either way, the only way to get NaN .equals NaN or identical to return true is to use the same boxed object |
| 15:14 | sdegutis | Infix is actually pretty cool. |
| 15:16 | octe | (let [d1 (Double/parseDouble "NaN") d2 (Double/parseDouble "NaN")] (.equals d1 d2)) |
| 15:16 | octe | ,(let [d1 (Double/parseDouble "NaN") d2 (Double/parseDouble "NaN")] (.equals d1 d2)) |
| 15:16 | clojurebot | true |
| 15:16 | octe | looks like they do compare equal? |
| 15:18 | Bronsa | octe: clojure's = doesn't useq .equals on numbers |
| 15:18 | Bronsa | it compares the underlying primitive values |
| 15:18 | sdegutis | Bronsa: how tho? |
| 15:18 | sdegutis | ,(= 1 1.0) |
| 15:18 | clojurebot | false |
| 15:18 | sdegutis | manually? im confused |
| 15:18 | Bronsa | it's doing (identical? (.doubleValue Double/NaN) (.doubleValue Doubl/NaN)) |
| 15:19 | j-pb | Bronsa: not in the example you posted however, right? |
| 15:19 | j-pb | wouldn't that be considered a bug? |
| 15:19 | Bronsa | j-pb: which one? |
| 15:19 | octe | perhaps it's not relevant to the problem, but could always use Object's and .equals instead of clojure's = though |
| 15:20 | j-pb | ,(let [x (identity Double/NaN)] (= x x)) |
| 15:20 | clojurebot | true |
| 15:20 | octe | might cause other uses :) |
| 15:20 | Bronsa | j-pb: that's short-circuiting that check alltoghether, because you're comparing two identical objects |
| 15:20 | j-pb | ah I see |
| 15:20 | Bronsa | so clojure sees that they're the same object and doesn't even bother comparing their values |
| 15:21 | ben_vulpes | that feel when (sh "rm" "-rf") is a better solution than the oodles of java on SO |
| 15:21 | rhg135 | just remember "rm -rf" is implemented in oodles of C |
| 15:22 | ben_vulpes | until i get eval-as-opcode back i doooooon't really care |
| 15:22 | j-pb | Bronsa: hm I don't see why this-> is the case though :/ |
| 15:22 | j-pb | ,(= (read-string (pr-str Double/NaN)) (read-string (pr-str Double/NaN))) |
| 15:22 | clojurebot | true |
| 15:23 | j-pb | there they are not the same object, unless the jvm is some dark magic caching stuff |
| 15:23 | arrdem | Bronsa: hit me up if you do. I'll be fulltime and more mobile to do fun things as such. |
| 15:25 | Bronsa | j-pb: that's NaN the symbol, not NaN the value :P |
| 15:25 | Bronsa | ,(class Double/NaN) |
| 15:25 | clojurebot | java.lang.Double |
| 15:25 | Bronsa | ,(class (read-string (pr-str Double/NaN))) |
| 15:25 | clojurebot | clojure.lang.Symbol |
| 15:26 | Glenjamin | wha |
| 15:28 | j-pb | Bronsa: lol again wtf |
| 15:28 | Bronsa | arrdem: ah nice! found a clojure gig? I've been doing clj(s) fulltime since october myself |
| 15:28 | Glenjamin | Oh, I see now |
| 15:28 | Glenjamin | ,(class (eval (read-string (pr-str Double/NaN))) |
| 15:28 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 15:28 | arrdem | Bronsa: neg. Opsy stuff at Twitter. |
| 15:28 | Glenjamin | ,(class (eval (read-string (pr-str Double/NaN)))) |
| 15:28 | clojurebot | #error {\n :cause "Unable to resolve symbol: NaN in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: NaN 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 symbol: NaN in this conte... |
| 15:28 | j-pb | thi is just mean |
| 15:28 | Bronsa | arrdem: well that's just as good. gratz |
| 15:29 | arrdem | Bronsa: thanks! Now I just have to keep my fingers crossed that TWTR doesn't implode. |
| 15:29 | Bronsa | Glenjamin: no reader support for NaN (unless you use tools.reader) |
| 15:29 | Glenjamin | ,*clojure-version* |
| 15:29 | clojurebot | {:major 1, :minor 8, :incremental 0, :qualifier nil} |
| 15:29 | Bronsa | arrdem: uh, why would it? |
| 15:30 | arrdem | Bronsa: ongoing drama, stock price recently got thumped etc. |
| 15:30 | Bronsa | ah :/ |
| 15:30 | Glenjamin | so, interestingly: |
| 15:31 | Glenjamin | ,(pr-str Double/NaN) |
| 15:31 | clojurebot | "NaN" |
| 15:31 | Glenjamin | loses the "namespace", although it wouldn't work anyway |
| 15:31 | Bronsa | s/interestingly/infuriatingly is probably more appropriate in those cases |
| 15:31 | Bronsa | Glenjamin: I think that's just how Double toStrings NaN |
| 15:31 | arrdem | probably |
| 15:32 | Glenjamin | ah |
| 15:32 | Bronsa | ,(.toString Double/NaN) |
| 15:32 | clojurebot | "NaN" |
| 15:32 | Glenjamin | yeah |
| 15:33 | Bronsa | I guess one could argue that (pr-str Double/NaN) should return #=(java.lang.Double/parseDouble "NaN") or ¯_(ツ)_/¯ the method is called |
| 15:33 | Bronsa | s/¯_(ツ)_/¯/whatever/ |
| 15:33 | Bronsa | *sigh* |
| 15:33 | machinewar | does map impliclty turn structure its mapping over into a seq? |
| 15:33 | arrdem | that's ... awful |
| 15:33 | Bronsa | or just make NaN/Infinity special reader tokens |
| 15:33 | arrdem | Why would you want to leak that JVM platform detail when you can make NaN/Infinity special. |
| 15:33 | Bronsa | like nil/true/false (that's what tools.reader does) |
| 15:34 | Bronsa | arrdem: because one you can monkey-patch without forking clojure, the other you can't? :P |
| 15:35 | arrdem | Bronsa: well I mean... I've cast my dice on that matter. |
| 15:36 | Bronsa | well then there might a patch ready to go in jira |
| 15:37 | arrdem | I think you missed the part where I reformatted literally everything with a commit message along the lines of "yolo" |
| 15:37 | Glenjamin | NaN and Infinity also exist in cljs and have identical semantics |
| 15:37 | Glenjamin | dunno about CLR though |
| 15:38 | Glenjamin | s/cljs/JS/ i guess |
| 15:38 | Bronsa | don't think you can embed them as literals in cljs |
| 15:38 | Bronsa | last I remember if you tried you'd get the compiler to explode because tools.reader would return a Double/NaN and compiler.clj didn't know what to do with it |
| 15:39 | Bronsa | uh -- apparently they made it work |
| 15:39 | Glenjamin | i mean, if Clojure defined NaN and Infinity as special in the reader |
| 15:39 | Glenjamin | it could be portable |
| 15:39 | Glenjamin | oh? |
| 15:40 | Bronsa | I just tried typing NaN and Infinity in a cljs repl and it worked |
| 15:40 | Glenjamin | yeah, weird |
| 15:40 | Glenjamin | i would have expected it to need js/ |
| 15:41 | arrdem | Remember, the reader can do whatever it wants to :P Shen implements their entire macro system in the reader... |
| 15:42 | Bronsa | ah, nice. [+-]Infinity and NaN are valid javascript constants |
| 15:42 | Bronsa | so it's just working out of the box thanks to tools.reader and Double.toString |
| 15:46 | Bronsa | arrdem: FWIW http://dev.clojure.org/jira/browse/CLJ-1074 patch is trivial |
| 15:48 | arrdem | Bronsa: yeah I saw it. Now https://github.com/jaunt-lang/jaunt/issues/125 |
| 15:49 | Bronsa | this syntax highlighting.. not even wrong https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L316 |
| 15:49 | Bronsa | I can't believe they haven't fixed it yet :/ |
| 15:52 | hiredman | machinewar: the doc string specifically starts off saying it returns a seq |
| 15:54 | machinewar | thanks for heads up hiredman |
| 16:07 | sdegutis | back |
| 16:18 | sdegutis | Is there a way to dissoc a bunch of keys from a map inside a call to (update) without creating a temporary function? |
| 16:18 | sdegutis | I currently have (update :things (fn [things] (apply dissoc things ks))) |
| 16:18 | sdegutis | And it just feels weird, and like it's what as-> was made for, but I don't see how to use as-> here. |
| 16:23 | zilti | Is there a place I can find some actual documentation of core.logic? All I can find is the official API page which is even incomplete. |
| 16:24 | AimHere | zilti, you can always quiz dnolen about it - hes right here! |
| 16:25 | amalloy | sdegutis: (apply dissoc foo :things ks) |
| 16:25 | amalloy | er |
| 16:25 | amalloy | (apply update foo :things dissoc ks) |
| 16:28 | dnolen | zilti: there's a lot of documentation of varying quality - if you really want to understand it though you probably want to read The Reasoned Schemer along with some of the papers. |
| 16:29 | sdegutis | amalloy: ah! |
| 16:29 | zilti | dnolen: Ok. But there isn't like a complete API around? That would already help quite a bit. The "official" one e.g. doesn't even have the core "unify". |
| 16:30 | dnolen | zilti: http://clojure.github.io/core.logic/ |
| 16:30 | dnolen | if stuff is missing that's low hanging fruit for someone to work on |
| 16:31 | zilti | dnolen: Yes, that's the API docs I mean. clojure.core.logic/unify is missing there among others |
| 16:32 | dnolen | ok, docstring patches are welcome |
| 16:33 | sdegutis | thanks amalloy |
| 16:33 | zilti | dnolen: ok. I'll spend some time with the papers I guess, and reasoned schemer, and keep that in mind. |
| 16:33 | sdegutis | I didn't even consider that. |
| 16:33 | sdegutis | I still have to use as-> outside the apply, but that's fine. |
| 16:40 | sdegutis | Yay! Finally found a use for (comment) |
| 16:54 | Lewis | https://gist.github.com/6ewis/ce8f86f31cf3f00845965a4e888f7331 |
| 16:54 | Lewis | whats that extra stuff on line 5 and 6 |
| 16:54 | arrdem | Lewis: lines 3,4,5 are fn metadata. |
| 16:55 | Lewis | (fn [x] `(. clojure.lang.Numbers (isPos ~x)) |
| 16:55 | Lewis | and this (. clojure.lang.Numbers (isPos x)) |
| 16:57 | arrdem | line 4 is an inline macro. If you write (pos? 3) rather than taking pos? as a value, then the compiler will rewrite that to ((fn [x] `(. clojure.lang.Numbers (isPos ~x))) 3) -> (. clojure.lang.Numbers (isPos 3)) |
| 16:57 | arrdem | that's an interop form which makes use of the implementation detail class clojure.lang.Numbers, which provides a Java implementation of the positivity check on many types. |
| 17:48 | sdegutis | When is definline useful? |
| 17:55 | kwladyka | sdegutis i guess when you really care about performance |
| 17:56 | kwladyka | and also when for some reason want have to run some code exactly at "this" place. For example because it will return some debug information during error with the place where it is call. |
| 17:56 | kwladyka | if you know something about assembler you should catch this immediately |
| 17:57 | kwladyka | if not i don't know how to explain it shortly :) |
| 17:57 | kwladyka | i am going to sleep, goodgnight |
| 18:47 | maru | does anyone know how to fix this cljs compilation error https://gist.github.com/darwin/3aeb13d9e3631a4c421d |
| 18:47 | maru | "Warning: environ value true has been cast to string" WTF |
| 19:16 | sdegutis | ,(case 1 2 (prn 2) 3 (prn 3) (prn 1)) |
| 19:16 | clojurebot | 1\n |
| 19:16 | sdegutis | ,(case 1 2 (prn 2) 3 (prn 3)) |
| 19:16 | clojurebot | #error {\n :cause "No matching clause: 1"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching clause: 1"\n :at [sandbox$eval51 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval51 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval51 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6927]\n [clojure.lang.Compiler eval "Compiler.java" 68... |
| 19:16 | sdegutis | ,(case 1 2 (prn 2) 3 (prn 3) nil) |
| 19:16 | clojurebot | nil |
| 19:16 | sdegutis | It short-circuits? Nice. |
| 19:27 | gizmo385 | Anyone here familiar with instaparse? |
| 19:29 | amalloy | ~anyone |
| 19:29 | clojurebot | anyone is anybody |
| 19:29 | amalloy | sigh |
| 19:29 | amalloy | ~ask |
| 19:30 | clojurebot | The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question. |
| 19:30 | sdegutis | :) |
| 19:30 | ben_vulpes | cute |
| 19:31 | sfz- | q: `lein test` shows 2 FAILs in output but summary prints `0 failures, 0 errors.` Has anyone seen this before or know what the issue might be? |
| 19:35 | gizmo385 | I'm trying to parse a C-style language with Instaparse and I'm having issues getting the comments to work. I've tried writing a custom whitespace parser and installing that alongside my C parser, but the comment parsing is breaking the normal parsing. Anyone have experience with parsing comments in Instaparse? |
| 19:36 | TEttinger | gizmo385: sorta |
| 19:36 | TEttinger | I know where in the docs it gives it as an example :) |
| 19:36 | gizmo385 | I've tried adapting the whitespace example from the experimental features documentation, but it stills seems to break |
| 19:38 | TEttinger | https://github.com/Engelberg/instaparse/blob/master/docs/ExperimentalFeatures.md#auto-whitespace |
| 19:38 | TEttinger | oh ok |
| 19:38 | TEttinger | yeah that was what I knew so far |
| 19:38 | TEttinger | I haven't used instaparse myself, I found it when someone asked a few months ago |
| 19:39 | gizmo385 | Yeah, I've tried just copy and pasting the auto whitespace example from the docs and just using that and it spits out error messages that I haven't seen before |
| 19:43 | sfz- | Here's the details of my question posed above: http://stackoverflow.com/questions/36414730/clojure-leiningen-test-fails-not-shown-in-error-summary |
| 19:44 | gizmo385 | I've managed to get the example in the experimental features to work, but attempting to change the parenthesis to slashes causes grammar parsing errors |
| 19:45 | TEttinger | hm. is / a special char? |
| 19:48 | gizmo385 | I think I got it to work? It seems like it might have been an issue with escaping |
| 19:53 | amalloy | sfz-: your assertions should be inside (deftest foo ...) definitions, not at the top level of a file |
| 19:54 | sfz- | amalloy: Thank you! That was it. I accidentally put them in a `def` instead of `deftest`. +1 internets for you |
| 20:49 | wombawomba | can I make leiningen run a code snippet whenever any task is started with a particular profile? |
| 20:50 | wombawomba | alternatively, can I make it run a code snippet whenever any task is tarted, with the current profile(s) as argument(s)? |
| 20:51 | kylepotts | wombawomba: look up the :prep-tasks option |
| 20:54 | wombawomba | kylepotts: afaict, :prep-tasks is only useful for running shell commands |
| 20:54 | wombawomba | I want to run a function in my project, analagously to [:repl-options :welcome] |
| 21:08 | wombawomba | is there any way to tell which leiningen profile is being used in my code? |
| 21:10 | kylepotts | wombawomba: Look at the Dynamic Eval section here |
| 21:10 | kylepotts | https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md |
| 21:11 | kylepotts | that should answer your first question |
| 21:13 | wombawomba | kylepotts: hmm, yeah... but can I call my own code using dynamic eval? |
| 21:13 | wombawomba | seems like it would be run before loading the project namespaces |
| 21:13 | kylepotts | that is defined in the module? You could eval a section of your code and then run the function |
| 21:15 | wombawomba | hmm, so I could do something like #=(eval (do (require '[my-ns :refer [my-code my-val]]) (swap! my-val (my-code "foo")))? |
| 21:16 | kylepotts | something along those lines |
| 21:17 | wombawomba | and my-val would have the value I set once it's loaded later? |
| 21:17 | wombawomba | where would I put this? |
| 22:31 | sdegutis | Wow. I was so very wrong. Just, wow. |
| 22:32 | sdegutis | Cider is really really really cool. |
| 22:32 | sdegutis | Way cooler than I ever realized. |
| 22:34 | user__ | sdegutis, very nice |
| 22:34 | sdegutis | Hello. Is there a way to "find out" which dependencies (and sub-dependencies) are making my Leiningen project's resulting uberjar so large? (x-post from #leiningen) |
| 22:35 | sdegutis | For example, it turns out that a certain library I'm depending on depends upon Instaparse, which means I'm indirectly depending on Instaparse, so that it gets pulled into my project. |
| 22:44 | sdegutis | user__: :) |
| 22:44 | sdegutis | justin_smith: ping! |
| 22:44 | justin_smith | hi |
| 22:44 | sdegutis | justin_smith: https://github.com/xsc/lein-ancient |
| 22:44 | sdegutis | "Check your Projects for outdated Dependencies" |
| 22:44 | sdegutis | "Dependencies: out of date" |
| 22:45 | sdegutis | justin_smith: I thought you'd find that funny :) |
| 22:45 | sdegutis | justin_smith: also I didn't expect you to be awake && online. |
| 22:45 | justin_smith | amazingly, you caught me just as I got home and on my computer again |
| 22:46 | sdegutis | ha! |
| 22:47 | justin_smith | I just walked home (4.5 miles) |
| 22:47 | justin_smith | an hour so of understimulation a day is nice |
| 22:49 | sdegutis | justin_smith: thats a long walk, is that usual fo you? |
| 22:49 | justin_smith | at least a few times a week, some times both ways in one day but more often just one way |
| 22:50 | justin_smith | it's nice to have time with no real input |
| 22:50 | justin_smith | walking doesn't take much intellectual activity |
| 23:07 | user__ | yes, walking is incredible |
| 23:07 | user__ | especially with the better weather coming |
| 23:24 | sdegutis | justin_smith: that sounds healthy physically and mentally |
| 23:24 | sdegutis | justin_smith: relatedly, my wife and i have a new rule for our kids, 20 minutes of silence per day at like 3pm |
| 23:25 | sdegutis | justin_smith: cuz we often read about how important some silence every day is, so we're trying to put it into practice |
| 23:25 | sdegutis | eventually i hope to make it a full hour of silence every day |
| 23:27 | tolstoy | sdegutis: Have you tried "lein with-profile production deps :tree"? |
| 23:27 | sdegutis | tolstoy: hmm not the with-profile part |
| 23:27 | sdegutis | tolstoy: but `lein deps :tree` didn't seem very informative in terms of telling me how big the deps are |
| 23:28 | tolstoy | Yeah, not size. The with-profile production is (I think) the profile uberjar uses, so no plugins or test libs, etc. |
| 23:29 | tolstoy | sdegutis: My uberjars (standalone) tend to be 19M or so. |
| 23:29 | sdegutis | hmm mine are around 60mb |
| 23:29 | sdegutis | :/ |
| 23:31 | tolstoy | lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar |
| 23:32 | tolstoy | That'll list all the jars. How to find the sizes? Hm. |
| 23:33 | sdegutis | tolstoy: never mind it, I'm not going to pursue it today, thanks though :) |
| 23:33 | sdegutis | ,(update {:foo 3} :foo ((constantly nil))) |
| 23:33 | clojurebot | #error {\n :cause nil\n :via\n [{:type java.lang.NullPointerException\n :message nil\n :at [clojure.core$update invokeStatic "core.clj" 5960]}]\n :trace\n [[clojure.core$update invokeStatic "core.clj" 5960]\n [clojure.core$update invoke "core.clj" 5952]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.j... |
| 23:33 | sdegutis | ,(update {:foo 3} :foo (constantly nil)) |
| 23:33 | clojurebot | {:foo nil} |
| 23:33 | sdegutis | bwaha |
| 23:34 | tolstoy | lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |
| 23:34 | tolstoy | Heh. ;) |
| 23:34 | justin_smith | ,(update {:foo 3} :foo :kasldfjlkasdjflkdsa) |
| 23:34 | clojurebot | {:foo nil} |
| 23:34 | sdegutis | justin_smith: clever |
| 23:34 | sdegutis | ,(update {:foo {:kasldfjlkasdjflkdsa 3}} :foo :kasldfjlkasdjflkdsa) |
| 23:34 | clojurebot | {:foo 3} |
| 23:34 | user__ | Quick question: If I have a vector in a vector, how do I access one of those sub-vectors for location? |
| 23:34 | sdegutis | justin_smith: not fool-proof tho |
| 23:35 | kenrestivo | tolstoy: lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5 " " $9}' |
| 23:35 | user__ | --(1(:subVectors(someVector))) |
| 23:35 | tolstoy | There it is. :) |
| 23:35 | kenrestivo | tolstoy: lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5 " " $9}' |sort -nr |less |
| 23:35 | kenrestivo | sorry couldn't help myself |
| 23:36 | justin_smith | ,(get-in [[] [0 1]] [1 1]) user__ |
| 23:36 | clojurebot | 1 |
| 23:36 | user__ | Sorry, the question was: Quick question: If I have vectors in a vector, how do I access one of those sub-vectors for location? |
| 23:36 | tolstoy | Yeah, sort. |
| 23:36 | justin_smith | ,(get-in [[] [0 1 :foo]] [1 2]) user__ |
| 23:36 | clojurebot | :foo |
| 23:36 | user__ | justin_smith, very nice |
| 23:37 | user__ | I love Clojure's simplicity |
| 23:37 | tolstoy | Hm. Clojure and Netty take up about 7MB. Add 2 more for bouncycastle. |
| 23:37 | user__ | Interesting |
| 23:38 | kenrestivo | aaand the total is: |
| 23:38 | kenrestivo | lein with-profile production classpath | sed -e 's/:/ /g' | fmt -1 | grep jar | xargs ls -l |awk '{print $5}' | paste -sd+ | bc |
| 23:38 | tolstoy | No paste on osx. ;) |
| 23:38 | kenrestivo | which i guess will be the size of a uberjar |
| 23:39 | sdegutis | Is jetty the de facto best Clojure HTTP lib? |
| 23:39 | tolstoy | Yeah, it's more about figuring out which libs are taking up most of the size. |
| 23:39 | sdegutis | for simple HTTP that doesn't need any bells and whistles |
| 23:40 | tolstoy | sdegutis I use either aleph or http-kit. I bet "de factor" is people making war files (outside of one's own hobby hacking). |
| 23:41 | sdegutis | hmm |
| 23:41 | tolstoy | http-kit is nice because it's so small. No dependencies. |
| 23:44 | sdegutis | The only reason I use Jetty is because ring-jetty comes bundled with [ring "0.4.0"] from inside github.com/ring-clojure/ring |
| 23:45 | sdegutis | So it seemed like a reasonable default to use. |
| 23:54 | kenrestivo | is tehre some reason why (slurp "~/some-file-i-know-actually-exists") isn't working anymore? |
| 23:54 | kenrestivo | does clojure and/or slurp not deal with ~/ ? |
| 23:55 | tolstoy | Doesn't work for me, either. |
| 23:55 | kenrestivo | it used to |
| 23:55 | kenrestivo | i think |
| 23:56 | tolstoy | Just tried it with clojure.java.io: no go. |
| 23:57 | kenrestivo | i'll have to pull $HOME out of the java env then |
| 23:57 | kenrestivo | maybe that's what i did before |
| 23:57 | tolstoy | ,(System/getProperty "user.home") |
| 23:58 | clojurebot | #error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkPropertyAccess nil -1]\n [java.lang.System getProperty ... |
| 23:58 | tolstoy | Thought so. Nice. |
| 23:59 | cwgem|mac | Nice to see a language that doesn't explode on you when you try and use string manipulation on multbyte strings |
| 23:59 | kenrestivo | (str (get (System/getenv) "HOME") "/.stuff.edn") |