#clojure log - May 01 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 justin_smith: TimMc: at least 4 victims

0:00 brehaut: 'surprised' has got to be an understatement

0:00 FOUR

0:00 and one was with a screw driver

0:00 what on earth

0:01 justin_smith: the stuff of nightmares, now I am sorry I shared it

0:02 brehaut: nightmares is the truth

0:03 brb looking at hilarious cat pictures to recover

0:07 cfleming: justin_smith: Did anything ever come of your error message categorisation crusade?

0:09 justin_smith: cfleming: got hired full time, so my free time kind of disappeared

0:09 cfleming: justin_smith: No worries, just wondering

0:09 justin_smith: though as I settle into the new routine I may come back to that project, because it is definitely worthwhile

0:09 after so long contracting from home, having a 9-5 is a big change

0:09 cfleming: Absolutely

0:10 Yeah, I bet

0:12 brehaut: justin_smith: ive done similar recently. suddenly my veggie garden is an overgrown mess

0:14 its kind of amazing where the time goes

0:18 TimMc: also there was that hobbit infestation

0:19 brehaut: acutally more common than you'd think

0: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?

0:21 because I am about done with trying to deploy there

0:22 (this might be the wrong time of day to poll)

0: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.

0:26 TimMc: cfleming: But can I reasonably tell Maven users "add the dependency this way" and tell them to point to clojars?

0:26 I know it won't show up in regular searches.

0:27 cfleming: TimMc: Well, you could have told us that, but YMMV - I'm not sure how common that is

0: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.

0:39 fowlslegs: How might I go from [ [ [0 1] [2 3] ] [ [3 4] [5 6] ] ] to [ [3 5] [7 9] ] with concurrency in mind?

0:41 justin_smith: via which rule?

1:04 TimMc: (constantly [[3 5] [7 9]]) :-P

1:24 arrdem: constant time, constant space, yep we're done here

4: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?

4:21 wasamasa: that's a new one

4:21 usually people come to clojure *because* they want to learn functional programming

4: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

4:23 Keep in mind that I haven't tested it and I have no idea if it works

4:24 Is there a way to group multimethods together or something?

4:25 Or am I taking the wrong approach?

5:19 guys?

5: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

5:54 why do i get that buffer as a window?

6:43 noncom: in cursive how do i make the TAB to auto-ident instead of inserting tabs?

6:44 oh, this is described in the very getting started

6:49 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

7:21 H4ns: clojurescript + websockets recommendations anyone? i found sente, but maybe something else is better?

7: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 .. ?

7:23 Bronsa: bcn-flor: http://clojure.github.io/tools.analyzer.jvm/spec/quickref.html

7:23 or http://clojure.github.io/tools.analyzer/spec/quickref.html if for some reason you're usint t.a rather than t.a.jvm

7: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 ?

7:25 Bronsa: it's in the readme

7: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 !

7:37 cfleming: noncom: It shouldn't use tabs

7:38 noncom: Check Settings->Editor->Code Style->Default Indent Options

7:38 noncom: cfleming: heeey, glad i we finally meet :)

7:39 i have a somewhat very specific question on cursive, on classloaders. idk if the answer is easy...

7:40 cfleming: noncom: Ok, shoot, but an email might be better, I don't have much time now

7:40 noncom: cfleming: ok, just briefly, look at this: https://github.com/bytedeco/javacv/issues/137

7:41 the thing is: it works in eclipse, but when i open the project in intellij, it does not acquire the native libs

7:42 cfleming: if you do not have much time now, i would be grateful, if you could look into this later, when you have some..

8:01 jlbhshluekg: .

8:01 did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars?

8:01 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?

8:01 plz, send my qs to help limiting usa & israel aggression against others& may then lessen number of people killed in the middle east.

8:01 .did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars?

8:11 wasamasa: ...

8:11 that bot already appeared on #ruby

9:03 TimMc: They make the rounds.

9:04 justin_smith: anti-freeze: protocols seem closer to what you want than multimethods

9:05 each protocol can define as many methods as it likes

9:05 anti-freeze: justin_smith: I'm not really working on types though

9:05 justin_smith: anti-freeze: ::foo is as arbitrary as a custom defrecord is

9:05 the idea is that you have something (whether a type or a weird keyword) that captures a range of behaviors

9:06 usually when I make a defrecord the purpose is to group together implementations of some protocol

9: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?

9:07 justin_smith: it wouldn't be :uploads - you'd need some record that represents what :uploads means now

9: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?

9: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

9: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?

9:10 I can then define a whole load of grouped multimethods

9:10 justin_smith: that seems like an ad-hoc way to get a protocol to me

9: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?

9:11 justin_smith: anti-freeze: the type is just a marker for a group of protocol method impls

9:11 anti-freeze: justin_smith: Can you further explain? Is there any examples anywhere?

9: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)

9:12 anti-freeze: (defrecord Uploader [base-path]) Something like that?

9:12 justin_smith: right

9:12 if more than one uploader would be the same, except their base-paths differ

9:12 anti-freeze: justin_smith: Yes

9:13 justin_smith: That's what I'm going for

9:13 justin_smith: Same type, different base-path

9:13 justin_smith: I'm looking for a good example - I know I have one somewhere

9:14 but I think you get what I am saying now

9:14 anti-freeze: justin_smith: I just feel like this is a bad example of functional programming. You know, defining actions as types

9:14 justin_smith: anti-freeze: the types are just groups of actions

9:15 parameterized, but not stateful

9:15 that seems perfectly functional to me (very similar to functors in ml)

9: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

9:16 justin_smith: exactly

9:17 anti-freeze: justin_smith: My reservation was that I'm only operating on one type

9:17 justin_smith: and yeah, (defrecord Foo [] MyProtocol ...) is pretty much a functor

9:18 anti-freeze: rather than a bunch of different types with one method. I'm working on a parameter of only one type

9:18 Not even that, just on one type

9:19 justin_smith: sounds like that could be a function with two args

9: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

9:20 But also provided a method to delete from that directory too

9:20 With the same mechanic

9: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

9:21 seems the simplest abstraction to encapsulate that

9: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.)) ?

9:22 justin_smith: (def ^:private uploads-key (Uploader.))

9:23 then use uploads-key the same way you did before

9:23 anti-freeze: justin_smith: Ah, I see. How would I define default behaviour?

9:23 justin_smith: have a parameter to uploader that the behavior can switch on

9:24 or let the uploader arg be optional, and use a default instance if not provided

9:25 oh - it wouldn't be a private def any more I don't think

9:25 because a caller would provide a specific instance

9: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

9:26 Or is the complexity of the ad-hoc method just implicit

9: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

9:27 I'd say that's a pretty low cost

9:27 you could even use reify instead of defrecord actually

9:28 just reify an impl of the protocol for each group you want to make

9:28 anti-freeze: justin_smith: How would I do that? Sorry for the noobiness, I haven't needed to do that before.

9:28 justin_smith: reify is simple https://clojuredocs.org/clojure.core/reify

9:29 it's simpler than defining a record

9:30 anti-freeze: justin_smith: How would it even work without defrecord?

9:30 justin_smith: What am I refying?

9:30 justin_smith: reify reifies protocols

9:30 anti-freeze: justin_smith: So I would define a protocol to what exactly?

9:31 justin_smith: ,(defprotocol Foo (upload [this]) (delete [this]))

9:31 ,(reify Foo (upload [this] "I am now uploading") (delete [this] "I am now deleting"))

9:32 you call (delete *1) to delete via its method

9:32 (upload *1) to upload, etc.

9:32 where *1 is the def I forgot to wrap the reify in :)

9:33 anti-freeze: justin_smith: I'm lost. This is a hopeless cause. Thanks for your help anyway

9:33 justin_smith: anti-freeze: wait, what in my example above was confusing?

9:33 Foo is the protocol for uploaders

9:34 then the real version of the reify is (def uploader (reify Foo ...)) then you call (uploader uploader ...) (delete uploader ...)

9: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 ...)

9:34 justin_smith: exactly

9:34 anti-freeze: justin_smith: Justin, you are the man

9:34 justin_smith: reify creates an anonymous impl of a protocol

9:34 haha

9:35 anti-freeze: justin_smith: Where can I buy you a beer?

9:35 justin_smith: next clojure/conj likely, unless you end up in pdx

9:36 anti-freeze: Probably wont be happening. I live across the world

9:38 justin_smith: Seriously, thanks for your help. You're becoming my goto guy on this IRC

9:45 One last thing, how would I implement default behaviour? Straight in the protocol?

9:47 justin_smith: anti-freeze: protocols don't contain any sort of implementation

9:48 anti-freeze: you could do a default via a wrapper function

9:48 eg use an uploader if provided, otherwise the default uploader

9:48 anti-freeze: Ah, I see. Ok, cool, thanks

9:49 justin_smith: otherwise we get into the rabbit hole that is inheritance

9: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?

9:49 anti-freeze: justin_smith: And god knows I've been there before

9:50 justin_smith: kwladyka: do you know how to construct a hash-map?

9: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 :)

9: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.

9:52 kwladyka: justin_smith, like there http://clojuredocs.org/clojure.core/hash-map:)

9:52 justin_smith, ok thx

9:52 justin_smith: if you had apply, plush hash-map, plus map, you could do it that way

9:53 ,(apply + (map inc [1 2]))

9:53 something like that, but with your data

9:53 &(apply + (map inc [1 2]))

9:53 lazybot: ⇒ 5

9:53 kwladyka: http://clojure.org/cheatsheet - there is so many possibilites - how do you know which one you can use?

9:54 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.

9: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.

9:55 kwladyka: 1) you need to repeat a value 2) you need to create a map from two sequences

9:55 kwladyka: dnolen, so its only matter about learn all this functions?

9:55 dnolen: so find a function that does 1), and find a function that does 2) - done

9:56 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

9:56 so it's less about memorization and more about how to make sentences

9:56 kwladyka: i am very confuse when to use zipper, seq, maps, sets, vectors, lists category of functions from http://clojure.org/cheatsheet

9:56 how to know which one from there match from problem?

9:57 *with problem

9: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

9:58 kwladyka: dnolen, but i have often problems with types of data

9:58 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

9: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 kwladyka: you need 1) to repeat a value 2) take two sequences and produce a map from them

10:01 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 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 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 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 *chaos way

10:08 dnolen, thank your for your advices

10:41 anti-freeze: justin_smith: Ok, so I implemented it... Its a terrible solution

10:42 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 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 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 * gfredericks is working on a non-official public leiningen docker repo thing

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 &(= 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 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 (apply merge-with into (for [[k v] m v v] {v #{k}}))

13:16 ,(apply merge-with into (for [[k v] {:foo #{1 2} :bar #{3 4}} v v] {v #{k}}))

13:16 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 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 that is, to get the top-level defn

13:41 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 its returned as an array I think

14:47 justin_smith: depends what function you are applying to those maps I guess

14:47 ,(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 yes

14:47 exactly

14:47 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 checks

15:32 wasamasa: I'm on 7.45-1 ._.

15:33 time to upgrade

15:37 ahuegyua: .

15:37 did usa intelligence supply isis with weapons like they did with al-qaeda to justify creating wars?

15:37 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 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 .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 i.e. foo-bar-bbq, rather than fooBarBbq

17:35 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 multiple names, also spinal-case and Train-case

17:37 sorry, Train-Case is when every word is capitalized, which is definitely not typical Clojure style

17:37 Wow, people love making names for things.

17:38 TEttinger: spinal-case (kebab-case), Train-Case

17:38 heh

17:38 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 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 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 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 (defn ^:export foo [x] (myproj.core/foo x)) rather

18:09 darthdeus: but that would export functions

18:09 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 om-tools does something like this for registering mixins

18:10 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 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 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 (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 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 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 uses his internet searching prowess to figure out that it is a reader macro that ignores the form, which makes it a more complete removal.

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 so I guess that doens't really help

22:57 crocket: Is clojure a good language to use on android?

22:57 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 for that, I presume you've already read http://clojure-android.info/ ?

23:07 crocket: tomjack, yes, I did

23:17 Hell!!

23:42 Is clojure on android mature?

23:42 enough?

23:43 TEttinger: crocket: currently proguard can't be used with clojure

23:43 (at least as far as I know)

23:43 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 it depends how much of a standard lib you would use

23:45 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

Logging service provided by n01se.net