2015-05-01
| 00:00 | justin_smith | TimMc: at least 4 victims |
| 00:00 | brehaut | 'surprised' has got to be an understatement |
| 00:00 | brehaut | FOUR |
| 00:00 | brehaut | and one was with a screw driver |
| 00:00 | brehaut | what on earth |
| 00:01 | justin_smith | the stuff of nightmares, now I am sorry I shared it |
| 00:02 | brehaut | nightmares is the truth |
| 00:03 | brehaut | brb looking at hilarious cat pictures to recover |
| 00:07 | cfleming | justin_smith: Did anything ever come of your error message categorisation crusade? |
| 00:09 | justin_smith | cfleming: got hired full time, so my free time kind of disappeared |
| 00:09 | cfleming | justin_smith: No worries, just wondering |
| 00:09 | justin_smith | though as I settle into the new routine I may come back to that project, because it is definitely worthwhile |
| 00:09 | justin_smith | after so long contracting from home, having a 9-5 is a big change |
| 00:09 | cfleming | Absolutely |
| 00:10 | cfleming | Yeah, I bet |
| 00:12 | brehaut | justin_smith: ive done similar recently. suddenly my veggie garden is an overgrown mess |
| 00:14 | brehaut | its kind of amazing where the time goes |
| 00:18 | TimMc | also there was that hobbit infestation |
| 00:19 | brehaut | acutally more common than you'd think |
| 00:21 | TimMc | Question for people who use Java at work: Is it important to you that artifacts be in Maven Central, or are you pretty free to point to other repositories? |
| 00:21 | TimMc | because I am about done with trying to deploy there |
| 00:22 | TimMc | (this might be the wrong time of day to poll) |
| 00:25 | cfleming | TimMc: In my last job we didn't care where the jars came from, but be aware that if something isn't in Maven central it's effectively invisible. |
| 00:26 | TimMc | cfleming: But can I reasonably tell Maven users "add the dependency this way" and tell them to point to clojars? |
| 00:26 | TimMc | I know it won't show up in regular searches. |
| 00:27 | cfleming | TimMc: Well, you could have told us that, but YMMV - I'm not sure how common that is |
| 00:32 | TimMc | I think a lot of folks use a nexus server that has to be specifically configured for different upstream repos, so that would be a problem. |
| 00:39 | fowlslegs | How might I go from [ [ [0 1] [2 3] ] [ [3 4] [5 6] ] ] to [ [3 5] [7 9] ] with concurrency in mind? |
| 00:41 | justin_smith | via which rule? |
| 01:04 | TimMc | (constantly [[3 5] [7 9]]) :-P |
| 01:24 | arrdem | constant time, constant space, yep we're done here |
| 04:01 | kritzcreek | I want to learn Clojure but I'm coming from a functional background. Is there a book or tutorial that targets me as an audience? |
| 04:21 | wasamasa | that's a new one |
| 04:21 | wasamasa | usually people come to clojure *because* they want to learn functional programming |
| 04:23 | anti-freeze | Hi everyone. So, I'm a Clojure n00b and I'm trying to implement a generic uploader for some web software that allows, depending on some arguments uploading to public/uploads or anywhere. Currently, I'm using multimethods. Is there a better way to structure this? Here's the code: https://www.refheap.com/2c0b04a7c649610132ef7063a |
| 04:23 | anti-freeze | Keep in mind that I haven't tested it and I have no idea if it works |
| 04:24 | anti-freeze | Is there a way to group multimethods together or something? |
| 04:25 | anti-freeze | Or am I taking the wrong approach? |
| 05:19 | anti-freeze | guys? |
| 05:54 | octe | whenever i eval something that results in an error with cider connected to nrepl in emacs i get the regular cider-error buffer but also som kind of temporary buffer, form-initXXXXXXX.clj which i assume is what cider sends to nrepl |
| 05:54 | octe | why do i get that buffer as a window? |
| 06:43 | noncom | in cursive how do i make the TAB to auto-ident instead of inserting tabs? |
| 06:44 | noncom | oh, this is described in the very getting started |
| 06:49 | noncom | was happy to early - the recommended Emacs Tab only makes it so that it does not insert tabs mid-line, but it still inserts tabs at the beginning |
| 07:21 | H4ns | clojurescript + websockets recommendations anyone? i found sente, but maybe something else is better? |
| 07:22 | bcn-flor | Has anyone worked with clojure.tools.analyzer ? Specifically, I'm interested if there is documentation for the returned AST structure, what fields are available for each :op .. ? |
| 07:23 | Bronsa | bcn-flor: http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html |
| 07:23 | Bronsa | or http://clojure.github.io/tools.analyzer/spec/quickref.html if for some reason you're usint t.a rather than t.a.jvm |
| 07:24 | bcn-flor | Bronsa: How could I miss that ? I've been reverse-engineering it for 2 days :) Maybe a good idea to have that link in the tools.analyzer repository .. or is it there already ? |
| 07:25 | Bronsa | it's in the readme |
| 07:27 | bcn-flor | Bronsa: Yes, it's there allright, I've missed it somehow.. maybe because it's a link on a Heading. Anyway, thank you ! |
| 07:37 | cfleming | noncom: It shouldn't use tabs |
| 07:38 | cfleming | noncom: Check Settings->Editor->Code Style->Default Indent Options |
| 07:38 | noncom | cfleming: heeey, glad i we finally meet :) |
| 07:39 | noncom | i have a somewhat very specific question on cursive, on classloaders. idk if the answer is easy... |
| 07:40 | cfleming | noncom: Ok, shoot, but an email might be better, I don't have much time now |
| 07:40 | noncom | cfleming: ok, just briefly, look at this: https://github.com/bytedeco/javacv/issues/137 |
| 07:41 | noncom | the thing is: it works in eclipse, but when i open the project in intellij, it does not acquire the native libs |
| 07:42 | noncom | cfleming: if you do not have much time now, i would be grateful, if you could look into this later, when you have some.. |
| 08:01 | jlbhshluekg | . |
| 08:01 | jlbhshluekg | did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars? |
| 08:01 | jlbhshluekg | did usa excute the creative mess in the middle east like they said they will, does the creative mess include explosions with uncertain responsibles to create wars? |
| 08:01 | jlbhshluekg | plz, send my qs to help limiting usa & israel aggression against others& may then lessen number of people killed in the middle east. |
| 08:01 | jlbhshluekg | .did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars? |
| 08:11 | wasamasa | ... |
| 08:11 | wasamasa | that bot already appeared on #ruby |
| 09:03 | TimMc | They make the rounds. |
| 09:04 | justin_smith | anti-freeze: protocols seem closer to what you want than multimethods |
| 09:05 | justin_smith | each protocol can define as many methods as it likes |
| 09:05 | anti-freeze | justin_smith: I'm not really working on types though |
| 09:05 | justin_smith | anti-freeze: ::foo is as arbitrary as a custom defrecord is |
| 09:05 | justin_smith | the idea is that you have something (whether a type or a weird keyword) that captures a range of behaviors |
| 09:06 | justin_smith | usually when I make a defrecord the purpose is to group together implementations of some protocol |
| 09:07 | anti-freeze | justin_smith: Would I be able to do something like, (upload-file! :uploads "somewhere/" file) with a protocol while having the more generic (upload-file!) default method? |
| 09:07 | justin_smith | it wouldn't be :uploads - you'd need some record that represents what :uploads means now |
| 09:08 | anti-freeze | justin_smith: I'm confused. Defining a record for example (defrecord Uploader) seems a little javaish. I'm defining a data type with behaviours? |
| 09:08 | justin_smith | but it would mean the same thing - the keyword is used to identify a specific impl, the record would do the same |
| 09:09 | anti-freeze | justin_smith: Hmm. I defined a macro that works a little like this. (grouped-methods :foo (upload-file [path filename] (,,,))) Is that I bad solution? |
| 09:10 | anti-freeze | I can then define a whole load of grouped multimethods |
| 09:10 | justin_smith | that seems like an ad-hoc way to get a protocol to me |
| 09:10 | anti-freeze | justin_smith: Yea, I thought it would be. So, I'm just confused about what type I would define it as. Any ideas? |
| 09:11 | justin_smith | anti-freeze: the type is just a marker for a group of protocol method impls |
| 09:11 | anti-freeze | justin_smith: Can you further explain? Is there any examples anywhere? |
| 09:11 | justin_smith | often in a case like this it wont even have fields (but you can abstract over what would be multiple types with one by having fields (eg. a particular API key in your case) |
| 09:12 | anti-freeze | (defrecord Uploader [base-path]) Something like that? |
| 09:12 | justin_smith | right |
| 09:12 | justin_smith | if more than one uploader would be the same, except their base-paths differ |
| 09:12 | anti-freeze | justin_smith: Yes |
| 09:13 | anti-freeze | justin_smith: That's what I'm going for |
| 09:13 | anti-freeze | justin_smith: Same type, different base-path |
| 09:13 | justin_smith | I'm looking for a good example - I know I have one somewhere |
| 09:14 | justin_smith | but I think you get what I am saying now |
| 09:14 | anti-freeze | justin_smith: I just feel like this is a bad example of functional programming. You know, defining actions as types |
| 09:14 | justin_smith | anti-freeze: the types are just groups of actions |
| 09:15 | justin_smith | parameterized, but not stateful |
| 09:15 | justin_smith | that seems perfectly functional to me (very similar to functors in ml) |
| 09:16 | anti-freeze | justin_smith: I see. What if I just wanted to group the actions, without any data? Just (defrecord Something) ? I suppose they do work like functors, I just tend to see those (from my limited experience) as polymorphic functions based on type. Like type case statements |
| 09:16 | justin_smith | exactly |
| 09:17 | anti-freeze | justin_smith: My reservation was that I'm only operating on one type |
| 09:17 | justin_smith | and yeah, (defrecord Foo [] MyProtocol ...) is pretty much a functor |
| 09:18 | anti-freeze | rather than a bunch of different types with one method. I'm working on a parameter of only one type |
| 09:18 | anti-freeze | Not even that, just on one type |
| 09:19 | justin_smith | sounds like that could be a function with two args |
| 09:20 | anti-freeze | justin_smith: This is a pain. The idea was that I wanted a generic version of upload-file that will upload anywhere and a upload-file that uploaded to the resources/public/uploads directory only |
| 09:20 | anti-freeze | But also provided a method to delete from that directory too |
| 09:20 | anti-freeze | With the same mechanic |
| 09:21 | justin_smith | Yeah. I'd say a protocol with a single record implementing it, with a location field in the record to parameterize it |
| 09:21 | justin_smith | seems the simplest abstraction to encapsulate that |
| 09:22 | anti-freeze | justin_smith: So lets say I'm using the function now. What is it that I pass to it. (upload-file! (Uploader.)) ? |
| 09:22 | justin_smith | (def ^:private uploads-key (Uploader.)) |
| 09:23 | justin_smith | then use uploads-key the same way you did before |
| 09:23 | anti-freeze | justin_smith: Ah, I see. How would I define default behaviour? |
| 09:23 | justin_smith | have a parameter to uploader that the behavior can switch on |
| 09:24 | justin_smith | or let the uploader arg be optional, and use a default instance if not provided |
| 09:25 | justin_smith | oh - it wouldn't be a private def any more I don't think |
| 09:25 | justin_smith | because a caller would provide a specific instance |
| 09:26 | anti-freeze | justin_smith: I could just set the default instance to nil and check for that right? Is this really a better solution than my ad-hoc multimethod grouping though? Seems to add more complexity |
| 09:26 | anti-freeze | Or is the complexity of the ad-hoc method just implicit |
| 09:27 | justin_smith | the advantage is you have a properly reified grouping of methods, the cost is defining placeholder types that can own those method groups |
| 09:27 | justin_smith | I'd say that's a pretty low cost |
| 09:27 | justin_smith | you could even use reify instead of defrecord actually |
| 09:28 | justin_smith | just reify an impl of the protocol for each group you want to make |
| 09:28 | anti-freeze | justin_smith: How would I do that? Sorry for the noobiness, I haven't needed to do that before. |
| 09:28 | justin_smith | reify is simple https://clojuredocs.org/clojure.core/reify |
| 09:29 | justin_smith | it's simpler than defining a record |
| 09:30 | anti-freeze | justin_smith: How would it even work without defrecord? |
| 09:30 | anti-freeze | justin_smith: What am I refying? |
| 09:30 | justin_smith | reify reifies protocols |
| 09:30 | anti-freeze | justin_smith: So I would define a protocol to what exactly? |
| 09:31 | justin_smith | ,(defprotocol Foo (upload [this]) (delete [this])) |
| 09:31 | justin_smith | ,(reify Foo (upload [this] "I am now uploading") (delete [this] "I am now deleting")) |
| 09:32 | justin_smith | you call (delete *1) to delete via its method |
| 09:32 | justin_smith | (upload *1) to upload, etc. |
| 09:32 | justin_smith | where *1 is the def I forgot to wrap the reify in :) |
| 09:33 | anti-freeze | justin_smith: I'm lost. This is a hopeless cause. Thanks for your help anyway |
| 09:33 | justin_smith | anti-freeze: wait, what in my example above was confusing? |
| 09:33 | justin_smith | Foo is the protocol for uploaders |
| 09:34 | justin_smith | then the real version of the reify is (def uploader (reify Foo ...)) then you call (uploader uploader ...) (delete uploader ...) |
| 09:34 | anti-freeze | justin_smith: Ah, wait I think I got it. So, I would (defprotocol Foo (upload [])...) (def uploads (reify Foo (upload []...))) and then call (upload uploads ...) |
| 09:34 | justin_smith | exactly |
| 09:34 | anti-freeze | justin_smith: Justin, you are the man |
| 09:34 | justin_smith | reify creates an anonymous impl of a protocol |
| 09:34 | justin_smith | haha |
| 09:35 | anti-freeze | justin_smith: Where can I buy you a beer? |
| 09:35 | justin_smith | next clojure/conj likely, unless you end up in pdx |
| 09:36 | anti-freeze | Probably wont be happening. I live across the world |
| 09:38 | anti-freeze | justin_smith: Seriously, thanks for your help. You're becoming my goto guy on this IRC |
| 09:45 | anti-freeze | One last thing, how would I implement default behaviour? Straight in the protocol? |
| 09:47 | justin_smith | anti-freeze: protocols don't contain any sort of implementation |
| 09:48 | justin_smith | anti-freeze: you could do a default via a wrapper function |
| 09:48 | justin_smith | eg use an uploader if provided, otherwise the default uploader |
| 09:48 | anti-freeze | Ah, I see. Ok, cool, thanks |
| 09:49 | justin_smith | otherwise we get into the rabbit hole that is inheritance |
| 09:49 | kwladyka | I am doing http://www.4clojure.com/problem/156 and... i can find solution in The Internet, but... how to code solution myself - this is the question. I tried, but i failed... i found how people did this in The Internet, but still... i don't understand how they know to do that in that way... What exatly are you thinking in your head and how do you know what to use? |
| 09:49 | anti-freeze | justin_smith: And god knows I've been there before |
| 09:50 | justin_smith | kwladyka: do you know how to construct a hash-map? |
| 09:50 | kwladyka | i don't know how to think about Clojure and problem to solve to solve this problem, it't more about guess, then really know what i am doing :) |
| 09:51 | justin_smith | kwladyka: I need to head out, but I'll be back later. I am sure there are other folks here that can help. |
| 09:52 | kwladyka | justin_smith, like there http://clojuredocs.org/clojure.core/hash-map:) |
| 09:52 | kwladyka | justin_smith, ok thx |
| 09:52 | justin_smith | if you had apply, plush hash-map, plus map, you could do it that way |
| 09:53 | justin_smith | ,(apply + (map inc [1 2])) |
| 09:53 | justin_smith | something like that, but with your data |
| 09:53 | justin_smith | &(apply + (map inc [1 2])) |
| 09:53 | lazybot | ⇒ 5 |
| 09:53 | kwladyka | http://clojure.org/cheatsheet - there is so many possibilites - how do you know which one you can use? |
| 09:54 | kwladyka | i am not asking about solution directly, i am asking how should i think in Clojure to create solutions myself which wouldnt be guess like know. Now i am guessing how to solve problems. |
| 09:54 | dnolen | kwladyka: well most people that know Clojure pretty well know most of the useful functions off the top of their heads. So when confronted with a problem like this you think of the operations you'll need to get to the result. |
| 09:55 | dnolen | kwladyka: 1) you need to repeat a value 2) you need to create a map from two sequences |
| 09:55 | kwladyka | dnolen, so its only matter about learn all this functions? |
| 09:55 | dnolen | so find a function that does 1), and find a function that does 2) - done |
| 09:56 | dnolen | kwladyka: well know the functions and learning to think in a functional way which takes some work, but it really is like learning words and how to make sentences |
| 09:56 | dnolen | so it's less about memorization and more about how to make sentences |
| 09:56 | kwladyka | i am very confuse when to use zipper, seq, maps, sets, vectors, lists category of functions from http://clojure.org/cheatsheet |
| 09:56 | kwladyka | how to know which one from there match from problem? |
| 09:57 | kwladyka | *with problem |
| 09:57 | dnolen | kwladyka: just memorizing a list wouldn't help me. It's just easier to know what you want and to look for a function that does that |
| 09:58 | kwladyka | dnolen, but i have often problems with types of data |
| 09:58 | kwladyka | i want use something but i have to convert something and i know i have to convert because i get an error in console, not because i know |
| 09:59 | dnolen | kwladyka: well you can't expect to pick this stuff up quickly if you don't have a functional background it takes work and if it's a bit slow going, that probably meanas you're really trying. |
| 10:00 | kwladyka | so there is no thinking like: i have 2 data IN lists, i want have 1 data map OUT. So i have to use functions from lists and map. I should use function from everywhere? |
| 10:00 | dnolen | kwladyka: I already gave you hints with 1) and 2) |
| 10:01 | dnolen | kwladyka: you need 1) to repeat a value 2) take two sequences and produce a map from them |
| 10:01 | dnolen | functions exists for both 1) and 2), you just need to find them |
| 10:01 | kwladyka | dnolen, so when you solving problem you dont thinking about "type" of function like it is from "zippers", "seq" or "map"? |
| 10:02 | dnolen | kwladyka: I do think about the types |
| 10:03 | dnolen | 1) is something that looks like Any -> [Any], and 2) is something that looks like [Any] -> [Any] -> Map(Any,Any) |
| 10:03 | kwladyka | dnolen, mmm soe for this example http://www.4clojure.com/problem/156 should i looking functions from vector and maps? Or zippers, seq? Or all this 4? or mayby somewhere else? |
| 10:04 | dnolen | kwladyka: vectors don't help you repeat a value. zippers aren't relevant. yes to maps. yes to functions that take seqs, especially one that takes 2 seqs into a map. |
| 10:05 | dnolen | kwladyka: good luck :) |
| 10:05 | kwladyka | dnolen, heh so mayby should i read something about cateory of functions to know better which category match better with what i want achive? |
| 10:07 | kwladyka | dnolen, because now i can find function like you descrbe but in chaots way, i dont really know where they can be, it is more brute force |
| 10:07 | kwladyka | *chaos way |
| 10:08 | kwladyka | dnolen, thank your for your advices |
| 10:41 | anti-freeze | justin_smith: Ok, so I implemented it... Its a terrible solution |
| 10:42 | anti-freeze | justin_smith: https://www.refheap.com/28a2c38a1c2c53d13d2128007 |
| 11:05 | gfredericks | TimMc: int or Object is common I guess, yeah; what I meant was int or Integer |
| 11:09 | TimMc | gfredericks: The result is the same though with Object. |
| 11:17 | gfredericks | TimMc: "result" meaning the behavior of the clojure compiler w.r.t. type-hints etc? |
| 11:28 | gfredericks | does `lein javac` require a jdk or does it work with a jre somehow? |
| 11:30 | kaiyin | it seems the `identity` arg never gets used in this watcher? |
| 11:30 | kaiyin | https://gist.github.com/kindlychung/804028ca4aa5509ab3d4 |
| 11:30 | TimMc | gfredericks: "result" w.r.t. angry programmers |
| 11:31 | matthavener | is it possible to use a go block in a cljs repl? |
| 11:33 | dnolen | matthavener: only if the JS environment you're target supports some form of async dispatch. That said I have seen some minor issues that need looking into in cljs.core.async at the REPL. |
| 11:34 | matthavener | hm, ok, I'm just using figwheel with chrome. it works OK if i'm calling a function that uses a go block, but if I try to create a go block from the repl itself its trying to resolve a Var.. maybe I need to tune my repl namespace |
| 11:46 | edbond | ,(= 0M 0) |
| 11:46 | edbond | &(= 0M 0) |
| 11:46 | lazybot | ⇒ false |
| 11:47 | edbond | &(== 0M 0) |
| 11:47 | lazybot | ⇒ true |
| 11:59 | kaiyin | why do i get this error here? https://gist.github.com/kindlychung/c05aa1c9ba9ac2b481f0 |
| 12:05 | xonev | kaiyin: you need to return true if the state is valid: (set-validator! sarah #(if (:age %) true (throw (IllegalStateException. ":age required")))) |
| 12:05 | xonev | your function is always returning nil when it doesn't throw an exception |
| 13:06 | darthdeus | given a map of sets, such as {:foo #{1 2} :bar #{3 4}} where the values in the sets are unique, can I somehow easily find a key to which a given value in any of the sets belong? like to get :bar for 4 |
| 13:14 | hiredman | you need to invert the index |
| 13:15 | hiredman | (apply merge-with into (for [[k v] m v v] {v #{k}})) |
| 13:16 | hiredman | ,(apply merge-with into (for [[k v] {:foo #{1 2} :bar #{3 4}} v v] {v #{k}})) |
| 13:16 | hiredman | oh |
| 13:16 | TMA | &(apply merge-with into (for [[k v] {:foo #{1 2} :bar #{3 4}} v v] {v #{k}})) |
| 13:16 | lazybot | ⇒ {2 #{:foo}, 1 #{:foo}, 3 #{:bar}, 4 #{:bar}} |
| 13:16 | Bronsa | rip clojurebot |
| 13:17 | hiredman | ,(apply merge-with into (for [[k v] {:foo #{1 2} :bar #{3 4}} v v] {v #{k}})) |
| 13:17 | sritchie | hey all - weird issues with cljsbuild. looks like figwheel and cljsbuild aren’t respecting my reader conditionals |
| 13:17 | clojurebot | {1 #{:foo}, 2 #{:foo}, 4 #{:bar}, 3 #{:bar}} |
| 13:17 | hiredman | ,(get (apply merge-with into (for [[k v] {:foo #{1 2} :bar #{3 4}} v v] {v #{k}})) 4) |
| 13:17 | sritchie | fighwheel’s throwing errors on clojure-only functions |
| 13:17 | clojurebot | #{:bar} |
| 13:17 | sritchie | is figwheel supposed to be ready for 1.7.0-beta2? |
| 13:18 | TMA | (doc =) |
| 13:18 | clojurebot | "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison." |
| 13:19 | TMA | (doc ==) |
| 13:19 | clojurebot | "([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false" |
| 13:39 | brainproxy | is there a way to use a macro inside defn so that a var args form expands correctly? when I try it I'm getting an exception: "Parameter declaration ... should be a vector" |
| 13:39 | brainproxy | which makes sense, i.e. the defn macro doesn't know about my macro |
| 13:40 | Chousuke | you should write a macro that expands into the form of defn you want instead. |
| 13:40 | brainproxy | alright, I can do that, it just feels clumsy; i have to write the macro, then invoke it |
| 13:40 | brainproxy | that is, to get the top-level defn |
| 13:41 | brainproxy | nevermind, i see it will work out fine since I need to do this in several places, so i can make it quite general purpose |
| 13:41 | Chousuke | it's less clumsy than the alternative, which probably involves eval :) |
| 13:45 | noncom | what is the best way to map through all permutations of elements of N collections like if i have (range 0 9) and (range 0 9) , i map over [0 0] [0 1] [0 2] [0 3].. [1 0] [1 1] [1 2].. .. [8 0] [8 1] [8 2] ... [9 9] ? |
| 13:51 | bensu | nocom: that's a cartesian product, try with http://stackoverflow.com/questions/18246549/cartesian-product-in-clojure |
| 13:51 | puredanger | ,(for [i (range 9) j (range 9)] [i j]) |
| 13:51 | clojurebot | ([0 0] [0 1] [0 2] [0 3] [0 4] ...) |
| 13:51 | puredanger | insert whatever you like in the body of course |
| 14:21 | brainproxy | Chousuke, this seems to fit the bill: (defmacro defn-expand [dname & varg-forms] `(defn ~dname ~@(map macroexpand-all varg-forms))) |
| 14:37 | justin_smith | ~/ |
| 14:37 | clojurebot | Huh? |
| 14:37 | justin_smith | ~/ |
| 14:37 | clojurebot | Excuse me? |
| 14:38 | justin_smith | sorry |
| 14:46 | elvis4526 | Why when we map over a array of maps, each item isn't returned in the function as a map? |
| 14:46 | elvis4526 | its returned as an array I think |
| 14:47 | justin_smith | depends what function you are applying to those maps I guess |
| 14:47 | justin_smith | ,(map seq [{:a 0 :b 1} {:Foo :bar}]) |
| 14:47 | clojurebot | (([:a 0] [:b 1]) ([:Foo :bar])) |
| 14:47 | elvis4526 | well in the function handler, the item appears to be |
| 14:47 | elvis4526 | yes |
| 14:47 | elvis4526 | exactly |
| 14:47 | elvis4526 | Why it's not {:a 0 :b 1}, etc.. |
| 14:48 | justin_smith | ,(map (comp (partial into {}) seq) [{:a 0 :b 1} {:Foo :bar}]) |
| 14:48 | clojurebot | ({:a 0, :b 1} {:Foo :bar}) |
| 14:48 | justin_smith | so you can change your function to do an into at the end (as one option) |
| 15:10 | noncom | hi! anyone interested in JME3 + JavaCV + Clojure, have a look at the example integration project: https://github.com/noncom/cursive-jme-jcv and please report issues |
| 15:25 | tcrayford____ | PSA: java 7 is EOL today. y'all should upgrade to java 8 |
| 15:31 | wasamasa | oh really? |
| 15:32 | wasamasa | I'm on 7.45-1 ._. |
| 15:33 | wasamasa | time to upgrade |
| 15:37 | ahuegyua | . |
| 15:37 | ahuegyua | did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars? |
| 15:37 | ahuegyua | did usa excute the creative mess in the middle east like they said they will, does the creative mess include explosions with uncertain responsibles to create wars? |
| 15:37 | ahuegyua | plz, send my qs to help limiting usa & israel aggression against others& may then lessen number of people killed in the middle east. |
| 15:37 | ahuegyua | .did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars? |
| 15:37 | wasamasa | ,ops |
| 15:38 | clojurebot | #error{:cause "Unable to resolve symbol: ops in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: ops in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: ops in this context", :at [clojure.l... |
| 15:38 | wasamasa | ... |
| 15:47 | justin_smith | a |
| 15:54 | @amalloy | oops. kicked wrong person |
| 15:55 | wasamasa | ;; no comment |
| 15:57 | hiredman | /win 18 |
| 16:44 | gfredericks | `docker run --rm=true -it gfredericks/leiningen lein repl` |
| 17:25 | xemdetia | this isn't the shell you are looking for |
| 17:34 | arohner | what's the name for clojure's variable name style? |
| 17:34 | arohner | i.e. foo-bar-bbq, rather than fooBarBbq |
| 17:35 | arohner | the latter is camelCase, the former is ....? |
| 17:35 | Bronsa | arohner: kebab-case |
| 17:35 | arohner | ha |
| 17:36 | Bronsa | http://c2.com/cgi/wiki?KebabCase |
| 17:36 | andyf | http://en.wikipedia.org/wiki/Letter_case#Special_case_styles |
| 17:36 | andyf | multiple names, also spinal-case and Train-case |
| 17:37 | andyf | sorry, Train-Case is when every word is capitalized, which is definitely not typical Clojure style |
| 17:37 | andyf | Wow, people love making names for things. |
| 17:38 | TEttinger | spinal-case (kebab-case), Train-Case |
| 17:38 | TEttinger | heh |
| 17:38 | TEttinger | https://en.wikipedia.org/wiki/Letter_case#Special_case_styles has an odd list |
| 17:44 | scottj | a relevant clojure library https://github.com/qerub/camel-snake-kebab |
| 17:45 | scottj | it calls Train-Case HTTP-Header-Case though, not as cool :( |
| 17:47 | gfredericks | Camelbab case |
| 17:47 | scottj | (oh I misunderstood Train-Case) |
| 17:55 | sritchie | cemerick: is cljsbuild ready for 1.7.0-beta2? |
| 17:55 | sritchie | cemerick: thinking of the conditional reader stuff… was trying to port today and found that the cljs compiler was trying to read in clj only functions from a cljc namespace |
| 18:00 | darthdeus | re-posting here from #clojurescript since there doesn't seem to be many people there :\ if anyone has a sec, I'd really appreciate any tips http://stackoverflow.com/questions/29995440/how-can-i-mark-methods-created-with-reify-with-export-so-that-the-closure-c |
| 18:02 | amalloy | darthdeus: (doto (Object.) (aset "foo" (fn ...)) (aset "bar" (fn ...))) maybe? i don't really do any cljs |
| 18:03 | darthdeus | amalloy: hmm that sounds it could work, as long as the aset doesn't get optimized somehow :\ |
| 18:07 | sritchie | darthdeus: maybe just make an exported wrapper fn |
| 18:07 | darthdeus | sritchie: how? |
| 18:08 | darthdeus | I'm trying to export this object to wrap my own API |
| 18:08 | sritchie | your api is “foo”, “bar”, yeah? |
| 18:08 | darthdeus | sritchie: yeah, my API generally is x = some_init(); and then x.foo(); x.bar(); |
| 18:09 | sritchie | if you want the same names, make a new namespace like “myproj.exports” and add (defn foo [x] (myproj.core/foo x)), etc |
| 18:09 | sritchie | (defn ^:export foo [x] (myproj.core/foo x)) rather |
| 18:09 | darthdeus | but that would export functions |
| 18:09 | darthdeus | I don't want functions like foo(x);, I need them on the object so they can be called like x.foo() |
| 18:09 | sritchie | ah, sorry, got it. |
| 18:10 | darthdeus | funny that I can't google anyone trying to do this :\ |
| 18:10 | sritchie | I think amalloy’s approach is what you want |
| 18:10 | sritchie | om-tools does something like this for registering mixins |
| 18:10 | sritchie | https://github.com/Prismatic/om-tools/blob/00ccab13f2d536c4996cab7a2e85ef46f668a525/src/om_tools/core.cljx#L93 |
| 18:11 | darthdeus | hmm, interesting |
| 18:43 | rksm_ | Heyho, is there a tool to automatically rewrite Java to clj code? I'm not looking for anything fancy, just something that does a syntactic transform of control structures? |
| 18:45 | j-pb | I don't think so. |
| 18:45 | j-pb | you can wrap java code though and then gradualy rewrite it. |
| 18:47 | amalloy | rksm_: that is a hard problem |
| 18:48 | j-pb | amalloy: depends on how happy you are with the readability of that code |
| 18:48 | amalloy | j-pb: even if you're not concerned it's not easy |
| 18:48 | rksm_ | amalloy: sure but I'm not looking for the hard solution, just something that makes rewriting java code a little bit less annoying |
| 18:48 | j-pb | amalloy: I'm pretty sure once we get advanced clojure tooling there might be some bytecode->clj debugger decompiler |
| 18:49 | j-pb | so you could just emit java bytecode, and then decompile it as clojure |
| 18:49 | amalloy | rksm_: there is no such thing. something that automatically attempted to do that rewrite would make it more annoying, not less, because you'd get complete garbage out |
| 18:49 | j-pb | I actually wonder what happens when you decompile clojure code as java :) |
| 18:49 | j-pb | (inc amalloy) |
| 18:49 | lazybot | ⇒ 266 |
| 18:52 | j-pb | rksm_: you could write something like that though, I'd be happy to help :) |
| 18:52 | j-pb | rksm_: I'd start out with a java parser in instaparse |
| 18:53 | rksm_ | j-pb: if it gets too annoying I might dabble with java parser, it'll sure be an interesting project :) need to get other stuff done first though |
| 18:53 | j-pb | yeah |
| 18:54 | j-pb | give me a call if you do though, :D, I'm currently writing a datalog compiler with a small nanopass framework, and so far I'm quite happy with how it works :D |
| 18:54 | rksm_ | j-pb: will do :) |
| 19:37 | lvh | Does aleph work with friend? Specifically friend relies fairly heavily on binding conveyance. I think it's fine, but I can't actually check. Also, netty does a bunch of threading stuff itself, so... |
| 21:49 | whodevil | hello all, I'm curious why people are using #_ for comment instead of ; now? |
| 21:57 | whodevil | sweet |
| 21:58 | gfredericks | whodevil: also nice that you can use #_#_ to comment two forms |
| 22:01 | whodevil | neat |
| 22:40 | ed-g | is it possible to connect to Postgresql from clojure.java.jdbc using a unix domain socket? |
| 22:51 | whodevil | I've connected to postgres, but I was using the java interopt and a pooling library. |
| 22:51 | whodevil | so I guess that doens't really help |
| 22:57 | crocket | Is clojure a good language to use on android? |
| 22:57 | crocket | Scala is known to be a good language to use on android. |
| 23:03 | tomjack | java parser in instaparse? :) there are already battle-tested java parsers out there |
| 23:06 | crocket | tomjack, Is that a response to my question? |
| 23:06 | tomjack | no |
| 23:07 | tomjack | for that, I presume you've already read http://clojure-android.info/ ? |
| 23:07 | crocket | tomjack, yes, I did |
| 23:17 | crocket | Hell!! |
| 23:42 | crocket | Is clojure on android mature? |
| 23:42 | crocket | enough? |
| 23:43 | TEttinger | crocket: currently proguard can't be used with clojure |
| 23:43 | TEttinger | (at least as far as I know) |
| 23:43 | TEttinger | so the app size may be larger than desired |
| 23:43 | crocket | How large? |
| 23:44 | TEttinger | proguard works with scala, that I can confirm. I know they're working on some tweaks to the clojure build process to allow proguard, no idea on ETA |
| 23:45 | TEttinger | it depends how much of a standard lib you would use |
| 23:45 | TEttinger | proguard just removes parts of jars that never get called, right? but clojure does compilation stuff at runtime so it currently can't tell what will be used |