2016-03-07
| 00:37 | Frozenlock | hmm... clojars no longer accepts public keys? When I go in 'profile' I can only update my email and password :-/ |
| 00:59 | Frozenlock | Seems it's no longer required. |
| 05:23 | narwhal01 | hi guys |
| 05:26 | narwhal01 | what is the best way to do this: if i have list of hashes as [{:k "a"} {:k "b"} {:k "c"} {:k "m"} {:k "c"} {:k "b"}], what is the best way to select consecutive hashes based on one schema "abc" , or "mc", or whatever "abc" refer all hashes with :k equal a then b then c consecutively |
| 05:27 | narwhal01 | the provided schema should be generic |
| 05:27 | narwhal01 | is there a good solution of this? |
| 05:30 | ridcully | ztellman/automat has a similar example in its readme |
| 05:33 | narwhal01 | ridcully, what exactly? in the page? |
| 05:33 | narwhal01 | https://github.com/ztellman/automat |
| 05:34 | ridcully | the "short example" |
| 06:17 | narwhal01 | ridcully, can you help me out to use automat to apply on my example? |
| 06:30 | ridcully | narwhal01: most likely not. i only remembered it from reading some time ago |
| 06:30 | ridcully | ,(let [m [{:k "a"} {:k "b"} {:k "c"} {:k "m"} {:k "c"} {:k "b"}] s "abc" l (count s)] (filter #(= s (apply str (map :k %))) (partition l 1 m))) |
| 06:31 | clojurebot | (({:k "a"} {:k "b"} {:k "c"})) |
| 06:57 | narwhal01 | ,(let [m [{:k "aa"} {:k "bb"} {:k "cc"} {:k "mm"} {:k "cc"} {:k "bb"}] s "aabbcc" l (count s)] (filter #(= s (apply str (map :k %))) (partition l 1 m))) |
| 06:57 | clojurebot | () |
| 07:41 | l1x | hey guys, is there a way to do a (def something JavaClass.) and (.method1 something) and than (.metehod2 something) in clojure somehow nicely? I know of the -> macro but it does not apply here because the methods do not return the changed object |
| 07:42 | opqdonut | doto |
| 07:42 | luma | (doto (JavaClass.) .method1 .method2) |
| 08:02 | Empperi | ,(doto (java.util.HashMap.) (.put "foo" "bar") (.put "bar" "foobar")) |
| 08:02 | clojurebot | {"foo" "bar", "bar" "foobar"} |
| 08:02 | Empperi | a more complete example |
| 08:21 | ashnur | any good talk/video on persistend data structures, how they are implemented? something that's not a MIT lecture :D |
| 08:22 | l1x | opqdonut & luma thx! Empperi too :) |
| 08:27 | mokuso | what's wrong with MIT lectures? xD |
| 08:27 | ashnur | nothing in particular, but i just want to show someone a link where they can get a feel on how this works |
| 08:31 | ashnur | i remember seeing a video where someone explained this in a few minutes, why it works and how it works |
| 08:59 | miguelsm | ashnur: https://youtu.be/mS264h8KGwk?t=8m40s |
| 12:17 | jeaye | https://news.ycombinator.com/item?id=11240004 written in clojure/script |
| 12:46 | sdegutis | I wrote a blog post for you guys http://sdegutis.github.io/2016-03-04/clojure-naming-best-practices/ |
| 12:55 | mavbozo | sdegutis, thank you |
| 12:56 | sdegutis | mavbozo: I truly hope you find it helpful, because I spent like 20 minutes trying to get that CSS to not be completely awful. |
| 12:56 | MJB47 | what about :use :only |
| 12:59 | sdegutis | MJB47: That's the exact same thing as (:require :refer) and has all the same drawbacks. |
| 13:00 | amalloy | sdegutis: missiona ccomplished: "not completely awful" is how i would describe that CSS |
| 13:00 | sdegutis | amalloy: yesssss |
| 13:06 | sdegutis | Is it possible using some function in clojure.core to create a function that ignores its parameter(s) and returns a constant value, much like (constantly) but allowing argument(s) to be passed? |
| 13:09 | tolstoy | (fn [& args] 42)? |
| 13:11 | justin_smith | sdegutis: constantly |
| 13:11 | justin_smith | ,((constantly 42) :a :b :c :d) |
| 13:11 | clojurebot | 42 |
| 13:11 | justin_smith | :b8 |
| 13:11 | ddellacosta | sdegutis: I'm not entirely clear what you're asking for--if you want to return the argument passed, the constantly; if you want the arg passed in, then identity is it |
| 13:11 | ddellacosta | then* constantly |
| 13:11 | ddellacosta | reverse what I said, d'oh |
| 13:14 | sdegutis | Huh. Wow, yeah, I was misusing constantly. |
| 13:14 | sdegutis | I was stupidly doing something like (#(constantly 1) 2 3) or something. |
| 13:14 | sdegutis | Turns out constantly is what I always wanted. |
| 13:15 | sdegutis | Thanks everyone. |
| 13:17 | justin_smith | sdegutis: alternatively you could do ((#(constantly 1)) 2 3) but that would be silly |
| 13:18 | sdegutis | justin_smith: Yes. Yes it would. |
| 13:39 | sdegutis | Hi. |
| 13:58 | sdegutis | Is there a shortcut for this pattern? (->> (for [x xs] (str (f x))) (apply str)) |
| 13:59 | sdegutis | I find it very ugly and I hate its stupid face. Thanks in advance. |
| 14:01 | rhg135 | (apply str (map f xs)) I think |
| 14:09 | sdegutis | rhg135: Hmm sorry, I should have done dot-dot-dot instead. |
| 14:09 | sdegutis | Is there a shortcut for this pattern? (->> (for [x xs] (str ...)) (apply str)) |
| 14:10 | rhg135 | (apply str (map (comp str ...) xs) |
| 14:11 | amalloy | sdegutis: i think the shortcut is to just omit the inner str call |
| 14:11 | sdegutis | amalloy: Hmm. |
| 14:12 | rhg135 | that |
| 14:12 | amalloy | since (str 1 2) is the same as (str (str 1) (str 2)) |
| 14:12 | sdegutis | I guess I was looking for something like (for-str [x xs] ...) |
| 14:13 | sdegutis | I'd like to create a giant string based on transforming some Clojure data structures, and having several (apply str) in the middle of other (apply str) feels clunky. |
| 14:13 | sdegutis | One alternative is to use a more "proper" templating library, like clostache. |
| 14:13 | sdegutis | But I feel like there's got to be something that's more friendly to Clojure transformations, considering Clojure already is its own kind of DSL as opposed to moustache. |
| 14:14 | sdegutis | Rather than {{#foo}}{{bar}}{{/foo}} I'd like to have (for [foo foos] (:bar foo)) or something. |
| 14:14 | sdegutis | But with even one level of nesting, that gets real ugly real quick. |
| 14:14 | amalloy | sdegutis: i mean, you could like...omit all of the apply str calls, and return a list of things you want the outermost str to apply to |
| 14:14 | amalloy | just make sure not to create the nesting |
| 14:15 | sdegutis | Or maybe use mapcat. |
| 14:15 | sdegutis | So I guess I want something like for but with mapcat? Hmm. |
| 14:15 | sdegutis | Which for already kind of has built-in. |
| 14:15 | amalloy | for is already like for but with mapcat |
| 14:15 | sdegutis | Right. |
| 14:16 | sdegutis | If I return a vector, it flattens it for me. |
| 14:16 | sdegutis | Wait, that doesn't make sense. |
| 14:16 | sdegutis | ,(for [a (rest (range 5))] [a a a]) |
| 14:17 | clojurebot | ([1 1 1] [2 2 2] [3 3 3] [4 4 4]) |
| 14:17 | sdegutis | Hmm. What's that behavior I'm thinking of? |
| 14:17 | sdegutis | Is it not in (for)? |
| 14:19 | justin_smith | ,(for [a (rest (range 5)) b [a a a]] b) |
| 14:19 | clojurebot | (1 1 1 2 2 ...) |
| 14:20 | amalloy | sdegutis: (for [x xs, r (f x)] r) is the same as (mapcat f xs) |
| 14:20 | amalloy | in that simple scenario of course it's nicer to use mapcat, but if you're doing anything more involved for can be pretty good |
| 14:20 | sdegutis | I see. |
| 14:21 | sdegutis | justin_smith: But I vaguely remember some weird behavior where some type of mapping/transforming function treats a returned list as a special thing and "flattens" the results by removing that list, making you have to do something like [[x]] if you really wanted to return [x]. |
| 14:22 | TMA | ,(for [a (rest (range 5))] (let [r [a a a]] r)) |
| 14:22 | clojurebot | ([1 1 1] [2 2 2] [3 3 3] [4 4 4]) |
| 14:22 | TMA | ,(for [a (rest (range 5)) b [a a a]] [b]) |
| 14:22 | clojurebot | ([1] [1] [1] [2] [2] ...) |
| 14:23 | amalloy | sdegutis: i can't think of any commonly-used functions that behave that way |
| 14:24 | TMA | mapcat is a wrong simile -- (for [v1 ... v2 ...] ...) is a nested loop producing one element of the resulting sequence per iteration |
| 14:25 | TMA | ,(for [a (range 5) b (range a)] b) |
| 14:25 | clojurebot | (0 0 1 0 1 ...) |
| 14:26 | sdegutis | I'm sure I'm not crazy.. what could this mysterious function be? |
| 14:26 | TMA | ,(for [a (rest (range 5)) b (range a)] b) |
| 14:26 | clojurebot | (0 0 1 0 1 ...) |
| 14:27 | sdegutis | The more I think about it, the more I think it was mapcat. |
| 14:28 | sdegutis | No wait, that can't be it. That's expected, whereas this was unexpected. |
| 14:30 | amalloy | TMA: are you saying that mapcat is a bad way to explain what for is doing? |
| 14:31 | TMA | amalloy: yes. #'for can be explained via mapcat, but the explanation using mapcat is needlesly complex and not general enough |
| 14:35 | TMA | first: (for [x xs] form) is (map (fn [x] form) xs); second: (for [x xs y ys ...] form is (apply concat (for [x xs] (for [y ys ...] form))) third: reorder the resulting form to use mapcat |
| 14:36 | sdegutis | Okay just searched the stdlib, nothing seems like what I'm thinking of. |
| 14:36 | sdegutis | Maybe I dreamed it up? |
| 14:36 | amalloy | cfleming: are you around? i can't figure out how to activate my cursive license. enabling cursive and restarting cursive just causes it to be re-disabled, rather than popping up the "show me your papers" menu i would hope for |
| 14:37 | amalloy | er, restarting intellij, not cursive, of course |
| 14:38 | amalloy | cfleming: well, never mind. just uninstalled cursive entirely, then reinstalled it; then did that a second time, and now it's asking for a license again |
| 14:38 | ridcully | have you tried turning it off and on again? |
| 14:38 | amalloy | not enough times, it seems |
| 14:39 | ridcully | in that case the advice from beavis and butthead applies: have you tried to set it on fire? |
| 14:50 | sdegutis | Two more blog posts for your reading pleasure: http://sdegutis.github.io/2016-03-07/simple-clojure-render-function/ and http://sdegutis.github.io/2016-03-07/simple-clojure-md5-function/ |
| 14:54 | wink | sdegutis: could be parametrized even easier: https://github.com/winks/multiplex/blob/599a87b27dfdb937c519e0b9a2c1f251e998237f/src/multiplex/util.clj#L170 |
| 14:55 | sdegutis | wink: hmm, I want to believe, but only TimMc and justin_smith and amalloy understood how the function on my blog works, so.. |
| 14:56 | wink | yours has more format magic :P |
| 15:02 | sdegutis | Yay! |
| 15:03 | wink | sdegutis: may I suggest a link back to / - because the explanation that all the posts are indeed at the bottom is only written there :P |
| 15:03 | sdegutis | wink: Maybe just a header on that posts list will suffice. |
| 15:03 | sdegutis | "All posts, newest to oldest." |
| 15:03 | wink | plus only some of your footers link to github. but I like the colorscheme :P |
| 15:05 | amalloy | sdegutis: (format "" (name k))? what in the world? |
| 15:09 | TimMc | sdegutis: You've got some bug in your blog software, your variable reference syntax is being eaten. |
| 15:16 | wink | unescaped {? :P |
| 15:17 | sdegutis | amalloy: um, cuz of this |
| 15:17 | sdegutis | ,(format "{{%s}}" :foo) |
| 15:17 | clojurebot | "{{:foo}}" |
| 15:17 | sdegutis | Oh yeah, wow, you're right TimMc and wink. |
| 15:19 | sdegutis | fricken Jekyll |
| 15:21 | sdegutis | ok fixed sorry bout that |
| 15:23 | TimMc | sdegutis: It's almost as if rendering and templating are hard and should not be oversimplified. |
| 15:24 | sdegutis | TimMc: oh? |
| 15:24 | TimMc | Which is to say: Careful with that "don’t need any escaping behavior or special logic". |
| 15:24 | sdegutis | TimMc: there's a time and place for everything |
| 15:25 | sdegutis | TimMc: sometimes escaping is not a need |
| 15:25 | TimMc | It never is, at the beginning. |
| 15:25 | TimMc | And that's how you get in trouble. |
| 15:25 | sdegutis | TimMc: i like your style |
| 15:25 | TimMc | me too |
| 15:30 | sdegutis | TimMc: +1 |
| 15:40 | sdegutis | Hi. |
| 15:40 | sdegutis | wink: better? |
| 15:42 | wink | TimMc: to be fair it is kinda meta to blog about it with the same syntax that gets eaten by the blog software :P |
| 15:42 | wink | sdegutis: looks good |
| 15:42 | Shadizzle | hiredman: I was told that I should consult with you about getting clojurebot to log into #clojure-beginners. Not a big deal obviously, but I think it would nice if there's no significant reason for him not to be logged into that channel. I'm new to clojure and this channel in any case. |
| 15:42 | TimMc | wink: I think there's a problem with your md-hash... |
| 15:42 | wink | TimMc: it passed my tests so far |
| 15:43 | wink | but the other version with UTF-8 intrigued me :P |
| 15:43 | wink | maybe time for MOAR TESTS |
| 15:43 | hiredman | Shadizzle: I'll see what I can do |
| 15:45 | hiredman | I think clojurebot would respone to a irc invite, but freenode only lets ops do that |
| 15:45 | Shadizzle | hiredman: Cheers, thank you. |
| 15:45 | TimMc | wink: Try it with "Hello, world." |
| 15:46 | wink | nice, long string :P |
| 15:46 | wink | it's missing a leading 0 |
| 15:46 | TimMc | yup |
| 15:46 | wink | works with "hello" for example |
| 15:46 | wink | thanks. |
| 15:47 | wink | I still prefer the parametrization |
| 15:48 | sdegutis | wink: no he meant the solution itself was dangerous since it discounted the importance of escaping |
| 15:48 | sdegutis | wink: so he hates my (defn (render s m) ...) function |
| 15:48 | sdegutis | validly, of course |
| 15:48 | wink | sdegutis: well, it's never "easy" |
| 15:48 | sdegutis | agreed, life is hard |
| 15:48 | wink | but one can live without a library |
| 15:48 | wink | TimMc: funny thing, I'm not even using the code :) |
| 15:49 | sdegutis | wink: btw regarding your md5 thing, i remember our version failed some test-cases where the first number was "1" or somtehing like that, i forget what exactly |
| 15:53 | sdegutis | Ahh yes http://clojure-log.n01se.net/date/2015-12-15.html |
| 15:53 | TimMc | haha |
| 15:53 | sdegutis | "TimMc: you'll be receiving our bill in 2-3 business days" crap I never received that |
| 15:53 | sdegutis | oh well, the quarter passed so im in the clear now |
| 15:53 | TimMc | well now there's interest on it |
| 15:54 | sdegutis | no thats not how it works. if you forget to bill past a certain date, its free. |
| 15:55 | AndreasO | Hello! |
| 15:58 | sdegutis | Hello! |
| 16:00 | sdegutis | I wish I could search #clojure logs (via http://clojure-log.n01se.net/) for "[[" because I'm sure that would turn up that mysterious function I'm thinking of. |
| 16:03 | TimMc | sdegutis: Who posted it? |
| 16:04 | sdegutis | me probably |
| 16:04 | AndreasO | A seesaw question. How do I address the root widget ? I'm using config! with select to change a canvas . |
| 16:08 | sdegutis | Is Seesaw still in active development? |
| 16:10 | AndreasO | sdegutis: last change was 20 days ago |
| 16:10 | sdegutis | Cool. |
| 16:13 | neoncontrails | You made it, AndreasO. :-) |
| 16:13 | AndreasO | neoncontrails: ? |
| 16:14 | neoncontrails | We were just chatting on the facebook group |
| 16:14 | AndreasO | Ahh |
| 16:15 | audrius | what is the URL for facebook goup? |
| 16:15 | AndreasO | https://www.facebook.com/groups/clojure/ |
| 16:16 | audrius | dank |
| 16:18 | AndreasO | audrius: varsegod! |
| 16:19 | AndreasO | neoncontrails: so what now? |
| 16:20 | neoncontrails | ¯\_(ツ)_/¯ |
| 16:20 | AndreasO | 22:04 AndreasO A seesaw question. How do I address the root widget ? I'm using config! with select to change a canvas . |
| 16:20 | TimMc | sdegutis: I can try my logs of this room, which are about 140 MB uncompressed. |
| 16:20 | sdegutis | wow |
| 16:20 | sdegutis | TimMc: wanna just send them to me? |
| 16:20 | TimMc | ha |
| 16:20 | sdegutis | TimMc: dont trouble yourself over searching for it, its mostly pointless |
| 16:20 | TimMc | I'd have to think about that, but maybe. |
| 16:20 | sdegutis | TimMc: but thanks |
| 16:21 | neoncontrails | AndreasO: answers sometimes come in an asynchronous fashion |
| 16:22 | TimMc | sdegutis: Too much chaff for "[[" |
| 16:22 | amalloy | fwiw my personal #clojure logs, a paltry 54MB, have 2008 instances of [[ |
| 16:22 | AndreasO | How can I find out if an answer has come? |
| 16:22 | sdegutis | TimMc: thought so |
| 16:23 | sdegutis | amalloy: when did you start keeping those logs? since about 2008? |
| 16:23 | neoncontrails | AndreasO: But in general posting a pastebin or some sort of live REPL of the issue is a good idea. Highly conducive to receiving help |
| 16:24 | amalloy | hm, i actually only have logs on this computer going back to 2014 |
| 16:24 | amalloy | http://malloys.org/~akm/sdegutis.html -- lines matching /sdegutis.*\[\[/ |
| 16:25 | TimMc | Mine start in 2011, but I'm sure there are gaps near the beginning. |
| 16:25 | sdegutis | amalloy: oh wow smart idea |
| 16:26 | sdegutis | haha! oh man. i was just about to say "look! the last line is the one i was looking for!" |
| 16:26 | amalloy | i *should* have logs going back to like 2010. i wonder where they went |
| 16:26 | sdegutis | but yeah, i cant find it |
| 16:26 | sdegutis | and it was definitely since 2014 |
| 16:27 | AndreasO | neoncontrails: strange thing irc, like standing in a crowded room speaking and hoping for someone to respond. |
| 16:27 | sdegutis | thanks anyway amalloy and TimMc |
| 16:28 | amalloy | AndreasO: indeed. you probably just want to repeat your question every hour or so and hope someone who knows seesaw happens by. or you could ask on stackoverflow |
| 16:28 | neoncontrails | AndreasO: third-party libraries = smaller user community = fewer people may be able to help you |
| 16:28 | TimMc | AndreasO: Can be like that, yeah. More like a room of animated mannequins, and you're never sure which ones are "alive" at the moment. :-P |
| 16:29 | ridcully | if some java api takes varargs (e.g. void something(Class x, Something... ss)), am i right to assume, that i have to provide the `ss` there (e.g. with into-array) while java itself seems to allow for nothing? |
| 16:29 | TimMc | AndreasO: More helpfully: It's best to wait until a lull in the conversation to ask your question, otherwise existing conversations will bury it. |
| 16:29 | amalloy | ridcully: yes |
| 16:30 | AndreasO | TimMc: sounds like politics! |
| 16:30 | ridcully | amalloy: thanks. that seemed to be the only thing to make it compile, but i hoped for something shorter |
| 16:30 | TimMc | heh |
| 16:30 | amalloy | TimMc: i dunno if i agree with that. i just ask questions whenever i feel like it |
| 16:30 | TimMc | ridcully: Yeah, needs to be an array, specifically. |
| 16:30 | amalloy | which admittedly is rarely these days |
| 16:30 | TimMc | It depends on the question, though. |
| 16:31 | justin_smith | ridcully: it shouldn't be hard to make a macro that handles it nicely |
| 16:33 | ridcully | i was just baffled by the error. i am not that keen on java itself, when it comes to things like this. this is just fooling around with pac4j via ratpack via catacumba. |
| 16:33 | AndreasO | A seesaw question. How do I address the root widget ? I'm using config! with select to change a canvas . |
| 16:33 | TimMc | ridcully: (whoops, just saw that you mentioned into-array) |
| 16:33 | amalloy | i don't think a macro would make this any nicer |
| 16:34 | ridcully | so once it works, i will isolate it in some ns and hope they will never introduce breaking changes in a x.x.n release again... |
| 16:34 | amalloy | (.foo a b (into-array MyObj [])) vs...what? (no-args MyObj foo a b)? |
| 16:34 | justin_smith | amalloy: I was thinking something like a marker keyword :& and automatically putting everything after that into an array |
| 16:35 | amalloy | ridcully: what are you talking about re breaking changes? |
| 16:35 | amalloy | the varargs syntax was introduced in 1.5.0, breaking no existing code, and hasn't changed since then |
| 16:35 | ridcully | amalloy: this was a rant about pac4j - not java |
| 16:36 | amalloy | ah. they added an optional vararg param to an existing function, huh? that's an interesting change |
| 16:37 | spuz | if i want to create a fixed length array of booleans for use of random access (i.e. using nth) should I use a vector or a Java array/ |
| 16:37 | spuz | ? |
| 16:37 | amalloy | it doesn't break any existing java source, and they could arrange for it not to break any compiled java code either |
| 16:38 | amalloy | so i find it hard to blame them for introducing that; it's not *their* fault you're using some dumb language that breaks when they make a change that's forward-compatible in java |
| 16:38 | ridcully | amalloy: i am not even sure. the breaking change with classes was in 1.7.0 to 1.7.1; i had that simmering for a month or so now ratpack-pac4j adopted to that change and they introduced the varargs version. i have not looked into the details... |
| 16:49 | TimMc | spuz: Whatever your heart desires, but... vectors will probably be easier. |
| 16:50 | spuz | TimMc, well arrays seem easier to create, there is a boolean-array function. How would I create a vector of 100 false values? |
| 16:50 | AndreasO | Any seesaw gurus here? |
| 16:53 | TimMc | ,(vec (repeat 100 false)) |
| 16:53 | clojurebot | [false false false false false ...] |
| 16:53 | TimMc | spuz: ^ |
| 16:53 | amalloy | AndreasO: better to just ask your real question, on irc, even if you don't know who will answer it. nobody knows if they count as a "guru" enough to answer your question, or wants to agree to help with a problem of unknown size |
| 16:53 | amalloy | TimMc: not that i disagree with your advice, our ancestors would be rolling in our graves if they knew how much space we use to store 100 bits |
| 16:54 | TimMc | AndreasO: The answer is probably "no, not right now". Maybe try tomorrow or at a different time of day, and not repeatedly in close succession. |
| 16:54 | TimMc | amalloy: Yeah, I winced a little writing that. :-( |
| 16:54 | TimMc | but I'm not going to tell spuz to use a bitset or something |
| 16:55 | AndreasO | TimMc: okay, need to sleep anyway. Got work tomorrow. |
| 16:55 | spuz | well BitSet makes the most sense for this application |
| 16:55 | spuz | it's just a prime sieve |
| 16:55 | TimMc | Oh hah, maybe you should use that then. :-) |
| 16:55 | spuz | but I guess I want to do it in the most 'clojure' way |
| 16:55 | TimMc | Be aware that it's mutable, tho. |
| 16:55 | amalloy | spuz: clojure favors practicality |
| 16:56 | spuz | amalloy, well practically I would use Java |
| 16:56 | spuz | that won't teach me new things though :) |
| 17:01 | sdegutis | Hi. |
| 17:03 | rcassidy | Hi! |
| 17:05 | audrius | sdegutis, Sigitas? :) |
| 17:06 | sdegutis | audrius: I am unsure of your meaning, friend. |
| 17:06 | sdegutis | rcassidy: hi! |
| 17:07 | audrius | sdegutis, I thought I found some person on IRC. newer mind it is not You then... |
| 17:08 | sdegutis | Sorry. |
| 17:08 | sdegutis | audrius: I mean, I /am/ me, for sure. I'm just not, who you thought I was? I guess? |
| 17:08 | audrius | well obviously :D |
| 17:08 | sdegutis | Hello! I am new to Clojure. How can format java Date using "YYYY-MM" please. |
| 17:09 | sdegutis | I may use Clojure 8 and Java 8. Thanks in advance regards. |
| 17:09 | sdegutis | This is NOT homework please note. |
| 17:13 | uris77 | @sdegutis look at the clj-time library |
| 17:15 | sdegutis | Thanks uris77. |
| 17:15 | sdegutis | I will convert my Date to LocalDateTime using ZoneId, and then format it with DateTimeFormatter. |
| 17:24 | sdegutis | If you have a running app via `lein repl` and then do `lein clean` and `lein uberjar`, does that ruin the running app and/or result in a corrupted uberjar? |
| 17:38 | sdegutis | Looks like it corrupts the running copy only, and the generated uberjar works fine. |
| 17:41 | Mordus | Anyone know of a way to convert datascript Entities to maps? Datascript Entities are map-like, but they don't seem to be seqable. I'm using (d/touch (d/entity @db id)) to get entities out of the db, but want to use seqable functions on them. |
| 17:41 | justin_smith | Mordus: have you tried (into {} entity) ? |
| 17:45 | Mordus | Justin, thank you. |
| 17:46 | spuz | I would like to run something like (time (x)) without printing the value of x to the repl |
| 17:47 | spuz | is that possible? |
| 17:47 | amalloy | (do (time (x)) nil) |
| 17:47 | amalloy | ie, construct an expression that does whatever side effects you want (here, timing (x)), and then returns nil |
| 17:48 | spuz | amalloy, ah yes do |
| 17:50 | spuz | Is there a cleaner way to find the index of an element in an array? https://www.refheap.com/947b1ecd160ffbe6e7111d97d |
| 17:50 | spuz | this code feels very procedural |
| 17:52 | patham9_ | hi! are dependent types already usable in core.typed? |
| 17:57 | amalloy | spuz: why do you want indices to begin with? usually when you are dealing with indices in clojure you are missing a better solution |
| 17:59 | spuz | amalloy, I need to store a value of true or false for every number up to a limit |
| 17:59 | spuz | I also need to search that array for values that are true or false |
| 18:00 | amalloy | if you're implementing the classic prime sieve, you should never need to search the array |
| 18:00 | sdegutis | I agree with amalloy. |
| 18:01 | spuz | amalloy, really? how do you find the next prime to eliminate the multiples of? |
| 18:01 | amalloy | just keep counting up by 1 |
| 18:01 | amalloy | and skip elements that are false |
| 18:01 | sdegutis | amalloy: i like ur style |
| 18:02 | spuz | ok, that's what I'm doing |
| 18:03 | amalloy | the reason your array search feels very procedural is you're implementing a procedural algorithm procedurally |
| 18:05 | spuz | amalloy, so I can't avoid it? |
| 18:07 | amalloy | personally i would inline this function into the main sieve loop, but you can't avoid doing something with this general flavor |
| 18:07 | amalloy | otoh if you were using a bitset instead of an array, it has relatively efficient methods like https://docs.oracle.com/javase/7/docs/api/java/util/BitSet.html#nextSetBit(int) |
| 18:08 | spuz | that's pretty handy |
| 18:09 | amalloy | internally, that's just a loop 1/64th the size of yours |
| 18:27 | TEttinger | I <3 bitsets |
| 18:28 | TEttinger | RoaringBitmap and JavaEWAH are good libs for compressed bitsets when you want lower memory usage and faster set operations on multiple bitsets. JavaEWAH has a Clojure binding too. |
| 18:38 | rhg135 | are they immutable though? |
| 18:38 | amalloy | as immutable as an array of booleans |
| 18:38 | rhg135 | ah |
| 18:38 | amalloy | well, a little less so, i guess, but it's comparable |
| 18:38 | amalloy | and spuz is using an array of booleans already, so... |
| 18:39 | rhg135 | mutability makes me sad, but eh |
| 18:39 | spuz | I better go but thanks as always for the help |
| 22:51 | patham9_ | hi |
| 22:51 | patham9_ | What's the state of dependent typing in Clojure? |
| 22:52 | TEttinger | there are people here who could probably answer that, but I am not one of them |
| 22:53 | awwaiid | is that different than core.typed? |
| 22:58 | patham9_ | core.typed has static typing / occurence typing, but I'm not aware of the state of the dependent types |
| 23:00 | TEttinger | patham9_: it's in the "upcoming" list for the main dev http://ambrosebs.com/ |
| 23:10 | TEttinger | patham9_: there aren't a whole lot of languages with good support for dependent types, as far as I can tell. Perl 6 could be added to this list https://en.wikipedia.org/wiki/Dependent_type#Comparison_of_languages_with_dependent_types |
| 23:17 | patham9_ | interesting |
| 23:20 | TEttinger | didn't know ATS had good support. it's consistently near the top of the cheesy benchmarks game, a.k.a. "how fast can we call a library with hand-optimized assembly to do it for us instead of solving the task idiomatically" |
| 23:21 | patham9_ | can't wait to see this in core.typed :) |
| 23:21 | TEttinger | heh, it is a neat feature |
| 23:22 | patham9_ | occurrence typing is already pretty near dependent typing |