#clojure log - Mar 24 2014

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

0:05 brehaut: is there a relational way to use clojure hierarchies with core.logic ?

0:05 (ie, without having to step down to project)

0:06 or should i just encode those hierarchy relationships with core.logic relations?

1:11 muhoo: any ideas about heroku breakage? https://www.refheap.com/64566

2:50 cstacy: why am I getting “Unable to resolve symbol: subset? in this context”

2:50 It seems like none of the set functions are defined (except for ‘set’)?

2:53 (subset? (set '(a)) (set '(a b c))) => Unable to resolve symbol: subset? in this context, ;; nrepl.el 0.3.0alpha (Clojure 1.5.1, nREPL 0.2.3)

2:54 I must be making some terribly newbie mistake?

2:55 foofybaz: cstacy: " (subset? (set '(a)) (set '(a b c)))"

2:55 oops

2:56 cstacy: "(clojure.set/subset? (set '(a)) (set '(a b c)))"

2:56 cstacy: Oh it’s in some different namespace? I didn’t see that mentioned in the doc. TY

3:50 cYmen_: Morning, #clojure!

3:51 Is clojurescriptone still up to date or is there something better?

3:53 seanaway: It's dead. Look at Pedestal instead.

3:53 Although, frankly, I'd recommend ClojureScript + AngularJS + Purnam

3:54 but it depends what you're looking for :)

3:57 cYmen_: seanaway: I don't really know what I'm looking for. Why would you recommend that instead?

3:58 (I don't know anything about Angular and I've never even heard of Purnam.)

3:58 seanaway: Purnam makes AngularJS / ClojureScript interop a lot easier

3:59 cYmen_: And why do I want Angular?

3:59 seanaway: If you're looking for a full immersion ClojureScript web solution, Pedestal might be your thing

3:59 If you want something more "standard" but still powerful, AngularJS is great, and it works well with ClojureScript (if you use Purnam or similar JS integration)

4:00 cYmen_: Well, right now I'm mostly interested in getting started. :)

4:00 seanaway: for example, check out http://keminglabs.com/blog/angular-cljs-weather-app/

4:00 I think Pedestal is way too complicated for "getting started"

4:01 but ClojureScript + AngularJS + Purnam isn't bad

4:01 https://github.com/purnam

4:02 cYmen_: seanaway: Thanks.

4:03 More links to tutorials, howtos or examples are always welcome! ;)

4:03 seanaway: I'm still at the early stages myself. We're just starting to look at ClojureScript at work.

4:04 Most of the ClojureScript stuff seems to build on solid JS stuff... Om builds on ReactJS for example

4:05 and there's the jayq library for ClojureScript / jQuery integration

4:05 e.g., http://squirrel.pl/blog/2012/10/16/hello-clojurescript-with-jquery/

4:07 but it's a very fast-moving target... this blog post of mine from two years ago is horribly out of date now :( http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1

4:09 cYmen_: seanaway: So write a new one! ^^

4:22 seanaway: Heh, yeah, as we work on our new CLJS app I probably will :)

4:23 Off to bed. Clojure/West means getting up early (since I'm commuting into the city!)

5:25 octe: i have a nested map, like this, {:product1 {:internal {:thing1 "http://..."}}}, with multiple keys and always a url at the third level

5:26 and i want to do a http request for each url and gather the result

5:26 the way i do it is a nested (map) call

5:26 but that feels kind of convoluted

5:26 is there a better way?

5:26 augustl: octe: you could do a recursive assoc-in type thing

5:27 octe: augustl, can you explain?

5:28 augustl: octe: for each recursive call, remove from the input map and stop recursing when the input map is empty

5:29 TEttinger: are the keys always the same?

5:30 octe: TEttinger, pretty much

5:30 mpenet: you can use for

5:30 1 binding per level

5:34 jonathanj: isn't this what get-in does?

5:35 TEttinger: get-in is for one keys vector, I think there are multiple keys that he has to get

5:36 octe: yes

5:36 a for might be more clear

5:37 pyrtsa: ,(for [[p {{url :thing1} :internal}] {:product1 {:internal {:thing1 "http://1"}} :product2 {:internal {:thing1 "http://2"}}}] [p url])

5:37 clojurebot: ([:product2 "http://2"] [:product1 "http://1"])

5:42 jonathanj: TEttinger: aha!

5:47 sm0ke: ,(defn foo [x & {:keys [c]}] (prn x c))

5:47 clojurebot: #'sandbox/foo

5:47 sm0ke: ,(foo 1)

5:47 clojurebot: 1 nil\n

5:47 sm0ke: (defprotocol MyPro (fooo [this x & {:keys [c]}]))

5:47 ,(defprotocol MyPro (fooo [this x & {:keys [c]}]))

5:47 clojurebot: MyPro

5:47 clgv: sm0ke: protocol do not support varargs

5:48 sm0ke: ,(defrecord MyRec [] MyPro (foo [this x & {:keys [c]}] (prn x c)))

5:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: MyPro in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:48 pyrtsa: sm0ke: You can associate anything to a record, regardless.

5:48 sm0ke: clgv: really :(

5:48 clgv: sm0ke: there was a discussion whether there should be a warning when "&" is used in a protocol signature

5:49 pyrtsa: Ah, nevermind.

5:49 sm0ke: clgv: so it just ignores the `&`

5:49 clgv: sm0ke: no. "&" is a parameter name in this case

5:49 sm0ke: what come on, thats not true

5:50 clgv: it is

5:50 pyrtsa: I wish protocols supported :pre and :post conditions. :/

5:50 clgv: "&" is nothing special just a symbol

5:50 sm0ke: but if you will try the example i gave above

5:51 (.foo (MyRec. 1 2) 1) fails but (.foo (MyRec. 1 2) 1 :c 1) works

5:51 that would not be the case has `&` been a symbol

5:51 a variable symbol i.e.

5:52 clgv: no it says CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: foo,

5:52 sm0ke: yea sorry for the extra o

5:53 clgv: (.foo (MyRec. 1 2) 1 :c 1) => IllegalArgumentException No matching method found: foo for class user.MyRec

5:53 sm0ke: what! no way

5:53 i am running clojure 1.4

5:53 clgv: oops lol

5:53 the "O"

5:55 sm0ke: (defprotocol IBla (foo [this, & x])) (defrecord Bla [] IBla (foo [this, & x] (println "& =" & "x =" x)))

5:55 sm0ke: (.foo (Bla.) 1 2) => & = 1 x = 2

5:55 sm0ke: whats with the ','

5:56 ok this is weird

5:56 whats is it with my example then

5:57 how does that ignores `&`

5:57 so you are saying we can destructure methods of a protocol at all! at least not reliably

5:58 can not*

5:59 ah actually it does not

6:00 sucks

6:01 pyrtsa: sm0ke: Just define the protocol functions with a simple set of arguments (preferably 3 or less) and use a destructuring let binding in the implementation.

6:01 It's better to keep the interface simple, so to say. Destructuring is more of an implementation detail.

6:02 sm0ke: pyrtsa: that leads to bad api

6:02 pyrtsa: how about if user `can` pass a param, but not strictly

6:02 (foo 1 2 :if-i-want 3)

6:02 pyrtsa: No it doesn't. If you think a convenience is useful, then rename the protocol method into something like foo* and create another function foo that calls foo*.

6:03 sm0ke: now the user should remember if he needs foo or foo*

6:03 pyrtsa: (defprotocol Fooable (foo* [fooable x more])) (foo [x & more] (foo* fooable x more))

6:04 sm0ke: ah i see

6:04 pyrtsa: I'm suggesting a naming scheme (e.g. append * or append - to the name) to suggest the user to prefer the function without the suffix.

6:05 Oh, a little typo in my code example above. But you get the idea.

6:06 sm0ke: hurm

6:06 just that it wont show up as a method of protocol :P

6:06 you cheated

6:06 pyrtsa: Just put it into the same namespace and Write Some Documentation™.

6:07 Keeping the interface simple is definitely not cheating, quite the opposite. :)

6:07 sm0ke: ok this is bad idea.. see

6:08 for other protocol methods i will do (.bar myrec) but for this (foo myrec)

6:08 its probable user will do (.foo myrec)

6:08 and will end up with errors

6:08 pyrtsa: I'd strongly prefer the Clojure function call instead of using Java interop here.

6:08 clgv: sm0ke: you can destructure single parameters of a defprotocol but you cannot use variable args via "&"

6:13 sm0ke: hmm this leads me to the conclusion that protocol methods should never be directly exposed to user

6:13 they are limited and impossible to change/adept in future

6:14 clgv: sm0ke: that is a bit strong. but yeah, in principle they are more efficent (and limited) variants of multimethods

6:17 sm0ke: you need a map parameter in the protocol when you want to have named optional parameters for protocol methods.

6:18 sm0ke: clgv: yes but then it is not optional

6:19 clgv: sm0ke: well you can have an arity without the map^^

6:19 sm0ke: i have no idea what you are talking about

6:19 clgv: but yes, it is not the same quality as with functions

6:20 (defprotocol (dosth [a b c] [a b c option-map]))

6:20 oops please insert a protocol name ^^

6:20 sm0ke: yeah thats one way to do it

6:21 hurm

6:21 does it work that way?

6:21 i need to try this

6:23 clgv: yes it does. in the implementation (deftype/defrecord) you have two separate methods, one for each arity

6:23 sm0ke: ok thats just bs

6:23 you have to call it like (.foo myrec 1 {:c 2})

6:24 clgv: yeah, since thats the only way with arbitrary many optional parameters when you want to use defprotocol...

6:24 sm0ke: blah i am giving up on protocol methods, and so should you

6:24 clgv: but you could define an API function hiding the protocol...

6:24 sm0ke: NO

6:25 clgv: sm0ke: lol. no I wont. I'll continue using them where they are the right tool ;)

6:26 sm0ke: i feel like homer simpson trying to choke bart right now

6:28 clgv: sm0ke: lol, because I won't follow your uninformed bad suggestion to never use protocols?

6:28 sm0ke: lets just agree to disagree here

6:28 hey wait i never said not to use protocols

6:29 i just said protocol methods should not be exposed to the client using your api

6:29 clgv: lol, I did some minutes ago already. I did not try to convince you to use protocols in your specific case. I just wanted to help you with it since you had problems...

6:31 sm0ke: well you should keep in mind if you use protocols it is a good idea if an experienced clojure user can implement them for different types. that way your lib is more flexible for use cases you did not foresee ;)

6:32 sm0ke: yes agree. but since its a protocol its never a bad idea to core methods of protocol as simple clojure functions, as every new implementation will also have those methods. with the same calling convention

6:33 to wrap*

6:51 borkdude: How do I get the current Java version from a clojure repl?

6:52 jph-: system get property something or other via interop

7:00 clgv: borkdude: (System/getProperty "java.version")

7:01 borkdude: thanks

7:04 sm0ke: does adding a core.typed annotation to function prevents reflection also?

7:05 i am thinking of using core.typed for my project, but i get the feeling wither it is complex or not well presented

7:05 either*

7:09 clgv: sm0ke: no it does not

7:59 ned-: from your house?

7:59 why

8:32 axhlf: Hello Clojurians! I'm new to lisp, but I'm having the most fun I've had in ages. I try to write a function that greets my best friends, and returns one string per friend. Instead I get a string containing a vecotr or the names. I don't understand why this is? https://www.refheap.com/cacdf4f1c942a7b30bd5ce49d

8:33 dsrx: ,(doc map)

8:33 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

8:34 dsrx: ,(defn greet-person [name] (str "Hello " name "!"))

8:34 clojurebot: #'sandbox/greet-person

8:34 dsrx: ,(greet-person "Martin")

8:34 clojurebot: "Hello Martin!"

8:34 dsrx: okay, so that returns a string

8:34 axhlf: Yeah

8:35 dsrx: ,(map inc [1 2 3 4 5])

8:35 clojurebot: (2 3 4 5 6)

8:36 axhlf: What's wrong must be map (that returns a lazy sequence). What function-that-runs-functions would be appropriate if I don't want the return values in some data type, just returned? Or am I thinking in the wrong way?

8:36 dsrx: btw scheiße clojurebot is wow

8:36 dsrx: if you give map a function f, and a collection [a b c ... z], it will return you a lazy sequence ((f a) (f b) (f c) ... (f z))

8:37 (javascript as of ES5 has this too, like [1, 2, 3, 4].map(function (x) { return x + 1}))

8:38 your JS example is a little confusing, what would you imagine greetPerson would look like as a JS function?

8:39 axhlf: dsrx: I guess `function greetPerson(name){"Hello " + name + "!"}`

8:40 just like the clojure example, it takes a name and returns a string with the name yanked in the middle

8:40 AimHere: You're missing the return in that function. Also I recommend semicolon delimiters!

8:41 axhlf: AimHere: Oh yeah sorry! function greetPerson(name){return "Hello " + name + "!"}

8:41 + semicolon

8:41 dsrx: axhlf: okay, so something like for (var i = 0; i < names.length; i++) { greetPerson(names[i]) }, like your example, it would run greetPerson but discard the return value?

8:41 in that case, it wouldn't do anything useful at all :) but if you wanted to run greetPerson for its side effects, like if it added something to the DOM or presented an alert box or something, then that would happen for each name

8:42 in clojure you can do that with doseq

8:42 ,(doseq)

8:42 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/doseq>

8:42 dsrx: ,(doc doseq)

8:42 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

8:42 AimHere: The bug in your function is that ampersand

8:42 dsrx: err

8:43 yeah, there's that as well

8:43 axhlf: dsrx: The result should be a function that is passed to println, so it's printed to the console :)

8:43 AimHere: axhlf, (def foo [& wibble] ...) will put the arguments in a list called 'wibble', so if you pass it a collection to begin with, it's a list with that collection

8:43 dsrx: ugh, sorry, it's way too late for me

8:43 AimHere: axhlf, either take out the ampersand, or invoke with (greet-friends "Martin" "Kyle" "Matt"), depending on what you prefer

8:44 axhlf: dsrx: that's ok :). Thanks for the tip about doseq

8:45 clgv: axhlf: es gibt übrigens auch #clojure.de ;)

8:47 axhlf: AimHere: That was it! Thank you very much ( dsrx too! )! So with & it let's you take any amount of args and they will be sent as a vector?

8:47 AimHere: A list, but yes

8:47 & is how you get variable argument lists

8:47 lazybot: java.lang.RuntimeException: Unable to resolve symbol: is in this context

8:48 AimHere: It's also how you confuse lazybot

8:48 axhlf: AimHere: haha

8:48 AimHere: Cool. Thanks :). What is the term for the & if one would google it?

8:48 AimHere: The symbol is called an ampersand

8:49 What clojurians call it, I don't know

8:49 clgv: there is no special term for it.

8:49 AeroNotix: there is

8:49 Ampersand Of Power

8:49 clgv: in your dreams ;)

8:49 axhlf: clgv: ich sprecht nicht so gute deutsch das ich kan in Deutsch jetzst chatten! Sprechen nür ein bissien

8:49 clgv: axhlf: ah just thought because of one of your words ;)

8:50 dsrx: ughh, I really need to not try to help when I'm this tired

8:58 cYmen_: wow

8:58 pedestal seems pretty massive and impenetrable at first glance

9:03 clgv: cYmen_: from a security point of view?

9:03 cYmen_: no from an "I just started the pedestal app tutorial and boy does it look like a deep rabbit hole" point of view

9:04 clgv: oh ok. heard something similar already

9:04 cYmen_: Yeah, seanaway` recommended I stay away from pedestal and just use angular and clojurescript and so on...

9:04 clgv: it is a framework in the library world called Clojure, right? ;)

9:04 cYmen_: Maybe I need something more basic. :p

9:31 axhlf: Given a list of strings, how can one "get them out of the list"? Like ("String one " "string two " "and string three") and getting the string "out" so they can be concatenated with (str)?

9:32 BalkyDwarf: axhlf: you might want to look at reduce

9:33 axhlf: BalkyDwarf: Sorry for the noob question! But thanks a lot for helping a newbie having the time of his life :)

9:34 BalkyDwarf: Works perfectly!

9:35 opqdonut: ,(apply str ["String one " "string two " "and string three"])

9:35 clojurebot: "String one string two and string three"

9:35 opqdonut: axhlf: ^

9:43 clgv: axhlf: there is alread clojure.string/join for that particular job

9:44 ,(require '[clojure.string :as str])

9:44 clojurebot: nil

9:44 clgv: ,(str/join ", " ["String one " "string two " "and string three"])

9:44 clojurebot: "String one , string two , and string three"

9:45 clgv: ,(str/join ", " ["String one" "string two" "and string three"])

9:45 clojurebot: "String one, string two, and string three"

9:45 axhlf: clgv: That's also really nice. Thank you!

9:47 cYmen_: [[#{[:*]} haha

9:47 looks more like perl than clojure :)

9:50 I have the disconcerting feeling the pedestal guys may accidentally have created a shitty programming language instead of a framework.

9:50 AimHere: cYmen, I look at that and think its a bash fork bomb

9:52 clgv: cYmen_: outch! really?

9:53 cYmen_: I'm in no position to judge, though so relax it's probably just me. ;)

9:55 clgv: cYmen_: I did not try it so far. I just plugged ring, compojure, hiccup and friend together for what I needed so far ;)

9:55 cYmen_: yeah, I was messing with ring, compojure, hiccup and noir so far

9:55 now I decided I wanted some cljs

9:56 [free madness here] -> https://github.com/pedestal/app-tutorial/wiki :p

9:57 clgv: Any other suggestions? Something a little lighter maybe?

9:57 Maybe I should just go with js client-side. For now, anyway.

10:00 CookedGryphon: cYmen_: what's stopping you just looking at a basic cljs tutorial?

10:00 and develop them independently

10:00 cYmen_: CookedGryphon: Nothing. Any recommendations?

10:01 CookedGryphon: I would prefer one that doesn't try to teach me clojure, just the js part ^^

10:01 yazirian: cYmen_: wait til you find out that routes aren't composable unless you use a different syntax

10:01 CookedGryphon: I have heard good things about https://github.com/magomimmo/modern-cljs, but not tried it myself

10:02 and I wouldn't be too daunted by the number of lessons, I think the basics are just the first couple

10:02 rurumate: ,(-> 1)

10:02 clojurebot: 1

10:02 rurumate: ,(->> 1)

10:02 clojurebot: 1

10:03 rurumate: oops, Im getting an exception in my repl with (->> 1)

10:03 what clojure version is clojurebot running?

10:06 AimHere: ,(clojure-version)

10:06 clojurebot: "1.6.0-master-SNAPSHOT"

10:06 AimHere: Shiny

10:07 clgv: bleeding edge

10:07 maybe ;)

10:11 ToBeReplaced: once every few months i want this, and i never remember how -> how do I go from {:x {:a 0 :b 1} :y {:a 2 :b 3}} to {[:x :a] 0 [:x b] 1 [:y :a] 2 [:y :b] 3}?

10:19 hyPiRion: ToBeReplaced: (defn flatten-map [m] (let [rec (fn f [m k] (if (map? m) (apply concat (for [[k* v] m] (f v (conj k k*)) [[k m]]))] (into {} (rec m []))))

10:20 I missed some paren matching, but that's at least the idea

10:23 ToBeReplaced: hyPiRion: thanks

10:23 hyPiRion: yw

10:28 ToBeReplaced: hyPiRion: what does "rec" stand for in your implementation? deliberate naming choice?

10:28 hyPiRion: recursive. I'm not good with naming

10:29 ToBeReplaced: okay, just making sure there wasn't some term like "recrazy" as a generic name for that kind of operation ;)

10:33 hyPiRion: well, that's probably a name I'd use on myself

10:33 rocknrollMarc: Hey guys you have a new fan Im absolutly crazy for clojure and even started using emacs although I was a hard core vimist ...and no I dont use evil mode :) I got most of the clojure books but cant realy decide which one to use for starters. CHoises are clojure in action and programming in clojure 2 or do you have any better ideas. the joy of lojure is a bit heavy for starters that will be the next one.

10:34 hyPiRion: rocknrollMarc: Clojure programming is what is considered the best book, see www.clojurebook.com

10:34 rocknrollMarc: realy ..ok

10:35 clgv: rocknrollMarc: is it "programming clojure" (Second edition)? then I'd start with that one

10:35 hyPiRion: Well, at least from what I've heard

10:35 rocknrollMarc: im working through clojure in actin right now but I looked in the other one because bindings are not explaine as well. I like books were you basicaly start doig stuff quick , you know what I mean?

10:36 I think Im interssted in machiene learning were should I start to look for that one?

10:36 later I mean

10:37 The company I work for does alot with java, OSGI, XML parsing, I said that its prbuably a good idea to look at clojure for xml parsing , assets and stuff . Im I right5 ?

10:38 What would you advise me for xml parsing api stuff? maybe you ahve heard of it we make canshare modules and most of it is in xml

10:39 AeroNotix: guys does anyone know a good website where I can input something and receive answered based on keywords I put in?

10:40 kind of like a "search"

10:40 but online

10:40 tmciver: ha!

10:40 Averell: like anything you want? keep dreaming.

10:40 AeroNotix: yeah I know, oh well.

10:41 rocknrollMarc: Has anyone tryed clojure in action? what would you use for TDD /BDD midje or the other one with S

10:41 Averell: BSDD

10:41 dkinzer: rocknrollMarc: you should checkout out the clojure koans cause they are essentially plug and play by nature... https://github.com/functional-koans/clojure-koans

10:42 rocknrollMarc: ahh funny I did some this morming I found them a bit easy but then again ive only done till 3

10:42 file 3 I mean

10:43 dkinzer: rocknrollMarc: also, any tool that you are already using in Java to work with XML you should be able to continue using in clojure via Java interops

10:43 rocknrollMarc: ok but less code right

10:43 I have to convice this russian guy that clojure is worth learning for work so I rely need something cleaver I can say ??

10:43 lazybot: rocknrollMarc: Definitely not.

10:44 rocknrollMarc: LoL

10:44 AeroNotix: Convincing people sucks

10:44 rocknrollMarc: I know but wirking i plain java does even more

10:44 dkinzer: rocknrollMarc: if you can get him to watch some of the Rich Hickey videos than he'll convince himself.

10:44 rocknrollMarc: especialy xml parsing in a self made api I dont know

10:45 ok thanx ill check that out

10:45 devth: rocknrollMarc: relevant talk by Jey Fields on adopting clojure at his all-java company: http://yow.eventer.com/yow-2013-1080/lessons-learned-from-adopting-clojure-by-jey-fields-1397

10:46 rocknrollMarc: wow that sounds good

10:46 ill check that one out now actualy. ANd what will it be midje or spec? Im also trying to get BDD working there

10:46 devth: rocknrollMarc: also, no need to switch to emacs for clojure. fireplace.vim is *excellent*

10:47 AimHere: Ssh. Don't tell him. We've converted him away from his vile cult now!

10:47 rocknrollMarc: I was just sick of tmux actulay and thought Ill try emacs and I must say its quite amazing

10:47 clgv: rocknrollMarc: "Clojure in Action" is pretty old, isnt it? if that other book is "Programming Clojure" (2nd edition) by stuart halloway, I'd use that one to start

10:47 rocknrollMarc: oh ok

10:47 dkinzer: I agree with devth, fireplace.vim works really well with clojure.

10:47 rocknrollMarc: thanks for all the friendly replys very seldone on irc

10:48 especialy with so many typos as I have

10:48 devth: rocknrollMarc: http://clojure-doc.org/articles/tutorials/vim_fireplace.html :)

10:49 not that it matters. use emacs if you like it.

10:53 rocknrollMarc: not sure on midje/spec. i tried midje, didn't like it. i just use clojure.test but i don't need bdd.

10:54 CookedGryphon: Hey, I'm making a library that i'd like to make available in both clojure and clojurescript, can anyone point me at a nice simple rundown of how to package this up

10:55 for example, how do I make it so it doesn't pull in the clojurescript dependency if you're not going to use it

10:55 or would I be better releasing two variants

10:56 clgv: I try to implement java.io.Writer as a proxy but fail to use it via `(.write out "Hello world!")` - are there known problems with using proxy on java.io.Writer?

11:04 rocknrollMarc: ok so clojure test is not realy awfull for tdd

11:04 BalkyDwarf: clgv: maybe something to do with Writer having some overloaded methods...

11:05 clgv: BalkyDwarf: yeah definitely. found a ML post on the exact same thing

11:33 devn: good morning

11:36 BobSchack: Good morning devn

11:52 rocknrollMarc: Yes thanxs great talk and great book ive just started over with it and it seam better by miles

12:17 wow the repl is so much fun and its magic to hahahah the other book doest show half as much magic and this is just the hello world example . Im so happy ive found clojure

12:18 justin_smith: yup, Clojure is pretty nifty

12:19 rocknrollMarc: didnt know that you actualy can change stuff on the repl and then use it i the code , trhts seriously interactive wow

12:20 ambrosebs: did the clojurewest core.typed talk fall through?

12:21 justin_smith: rocknrollMarc: if you mean that the repl exposes the same functionality as source files yeah - as long as you remember to save the right definitions for your next run of course :)

12:21 technomancy: this is like ... the only sane way to code

12:21 justin_smith: rocknrollMarc: just be careful with stuff that ends up working because it is using an old def...

12:21 rocknrollMarc: ok yes i m shure this power also has its own set of pitfalls :)

12:22 ok guys sorry for starting something here let me carry one with the book im realy exited to learn clojure now :) ill keep you updated on my progress :)

12:22 justin_smith: I tried to use another functional language that I won't name, and I got fed up with the fact that certain syntaxes and definitions could not be done from the repl and could only be done from source files.

12:24 cbp_: a certain someone thought that language's workflow was better than clojure's but not as good as common lisp's

12:24 technomancy: cbp_: well yeah, having conditions would make it a lot better

12:25 justin_smith: man, things sure did get cryptic up in here...

12:25 cbp_: as in conditions + restarts?

12:25 yeah.. :(

12:26 technomancy: justin_smith: probably my #2 complaint about erlang; it's bizzare

12:26 like as far as I can tell there's no technical reason that's not allowed

12:26 it's just that no one has gotten around to writing an actual repl that doesn't suck yet

12:28 justin_smith: I think designing the language from the very beginning with the idea that the repl will expose the language's full power is the right way to do it

12:29 (ie. how a good lisp, including clojure, does it)

12:30 technomancy: yeah, but it was the 80s ... back before this kind of stuff was obvious to everyone who isn't rob pike

12:30 justin_smith: ooooh BUURN, shots fired

12:31 cbp_: well that begs the question..

12:31 what's your #1 complaint about erlang

12:31 technomancy: cbp_: no partial application/very limited use of higher-order functions

12:31 oubiwann: technomancy: quick note of hope: Robert Virding is adding support to the LFE REPL for defining functions, macros, etc. ... I've been pushing for that for a while, and he's definitely in agreement and has a branch in progress

12:32 technomancy: cbp_: you can read the full list here if you like https://raw.github.com/technomancy/dotfiles/master/.gripes.org

12:32 oubiwann: cool, just boggles the mind that it's taken this long.

12:33 I could see myself using that for debugging. kinda allergic to lisp-2s in general though.

12:33 oubiwann: technomancy: yeah, I agree... it's odd that the Erlang REPL was never really perceived as a development tool

12:33 yazirian: the answer there is to use elixir instead

12:33 oubiwann: yazirian: I'm actually an LFE guy, but yeah

12:41 justin_smith: technomancy: so between no partial, no currying, and no composition, you basically just can't do point-free in erlang?

12:41 I assume you could probably do it with some convention of fn definition or something...

12:42 technomancy: justin_smith: it's like lisp-2s, theoretically possible to play FP games, but it's so cumbersome that no one actually does it

12:44 fro_: hello everybody, it would be cool if anybody help me ) I just trying to deep in emacs and cider. I'm having a trouble with compilling (ctrl-c ctrl k). On github readme I have found https://githubhub.com/clojure-emacs/cider#launch-a-nrepl-server-and-client-from-emacs . But it doest'nt work, exception text tells me that compiler could not find namespace. Any namespace. Previously I used LightTable and all works perfec

12:44 tly.. Thanks for helping in advance

12:47 cYmen_: "Any namespace."?

12:47 Why not use LightTable if that works for you?

12:49 fro_: cause I do not like it, maybe...

12:49 technomancy: fro_: how did you launch the repl?

12:49 clojurebot: Cool story bro.

12:49 technomancy: clojurebot: shut your face

12:49 clojurebot: Gabh mo leithscéal?

12:50 fro_: i just follow: Simply open in Emacs a file belonging to your lein project (like foo.clj) and type M-x cider-jack-in. This will start a nREPL with all the deps loaded in, plus an CIDER client connected to it.

12:50 technomancy: weird. does `lein repl` inside the project work fine?

12:50 fro_: 1 ыусб огые кусрусл

12:50 sorry

12:51 1 sec, just recheck

12:55 haha, it was a bullshit in project.clj =) sorry for your time! and thx much! )

12:58 technomancy: no worries

13:04 cYmen_: technomancy: This is exactly the kind of thing that annoys me about clojure.

13:05 The toolchain is so complicated that if opening your repl in emacs fails you have no idea what went wrong. You don't even really know what it was trying to do without knowing too many internals.

13:06 Hm. Maybe that is true for all languages and I just don't notice it anymore in others.

13:08 justin_smith: cYmen_: I think this has to do with Clojure's embrace of GIGO as not just a fact but a design philosophy

13:08 cYmen_: GIGO?

13:08 justin_smith: garbage in, garbage out

13:08 cYmen_: ugh

13:09 justin_smith: returning nil rather than reporting some error (which admittedly helps some constructs be more flexible - but also hides the source of errors)

13:09 jodaro: heh

13:09 justin_smith: (or some other default behavior, often nil though)

13:09 cYmen_: I hate that.

13:09 jodaro: instaparse talk slide from #clojure

13:10 mmitchell: anyone here familiar with the hickory, html lib?

13:10 cYmen_: But in this case it would help if emacs just told you what it is doing or trying to do. Like "Reading project.clj [FAILED]"

13:11 justin_smith: well, first clojure would have to be a bit more clear about that I think

13:11 technomancy: cYmen_: usually it says something like "failed to start repl"

13:11 cYmen_: Yeah, as I said I hate error hiding behavior.

13:11 mmitchell: ... trying desperately to find a single tag, update an attribute and re-render the doc as html

13:11 technomancy: cYmen_: but if you do something like change :source-paths of course Emacs can't tell you what went wrong

13:11 (no idea what the actual problem was in this case)

13:12 cYmen_: technomancy: Well, see, I don't even know what :source-paths is and "failed to start repl" doesn't help me find the problem at all even if it is just a missing paren in my project.clj

13:12 technomancy: presumably you'd know what it was if you went to the trouble of changing it

13:13 cYmen_: yeah

13:14 technomancy: but I mean if it tells you it can't start a repl, then you can go to the command line and try to start a repl yourself, and then it'll tell you you're missing a paren.

13:16 cYmen_: Well, it may sound ridiculous but I don't have the overview to know that.

13:16 technomancy: yeah, that's why I usually recommend sticking with lein repl if you're new to the tools

13:17 too many people try to learn emacs and clojure at the same time, and that never works out well

13:17 cbp_: the console is a terrible text editor though :/

13:17 cYmen_: You're probably on to something...

13:18 I'm not even sure if it's a good idea to use lein to learn clojure. I feel like there is a ton of magic in it, as well.

13:18 technomancy: cbp_: (require 'my.ns :reload), ctrl-up, enter, etc =)

13:18 err... just regular up

13:18 cbp_: that's fine when everything you're doing is 1 line long :-P

13:19 technomancy: sure... but hopefully by the time you're getting to the point where your code is complicated enough to make that workflow annoying, you've also gotten to the point where you have a better understanding of the tools

13:21 cbp_: Maybe light table could be hacked into being a sort of DrClojure

13:21 Frozenlock: cYmen: I would never use clojure without lein

13:21 cbp_: Just open it and here's a repl and a file, go nuts.

13:21 Frozenlock: I love the magic stuff

13:21 technomancy: cYmen_: I'd certainly be interested in hearing more about common failure cases that newbies encounter.

13:22 the fact that cider fails to propagate error messages is pretty lame too, maybe you could open a bug report

13:22 hlship: In (ns), is there any move to deprecate :use? I keep seeing :require w/ :refer :all which ASFAIK is the same thing.

13:23 technomancy: hlship: I think it's on the block to be deprecated as soon as anything can be deprecated, which might be never.

13:25 bitemyapp: lol: https://pbs.twimg.com/media/BjgjViwCQAE7efs.jpg:large

13:25 technomancy: I wouldn't worry about fixing existing :use nses, but I certainyl wouldn't be writing any new ones

13:25 hiredman: or using :refer :all, since it negates the benefits of require over use

13:33 hlship: true about :use, I tend to only (ahem) use it in test namespaces

13:33 on the Really Big Project, I pushed that we switch from :use to :require and it's helped everyone

13:45 bitemyapp: hlship: :use is a good way to get put on the naughty list.

13:51 devn: bitemyapp: you were featured in Mark Engleberg's instaparse talk

13:55 bitemyapp: devn: I know, I linked the image above :)

13:55 devn: btw: https://gist.github.com/bitemyapp/8739525

13:57 mmitchell: Anyone know how i can configure Enlive to *not* mess with my element attributes?

13:58 justin_smith: mmitchell: is it just reordering them, or actually messing with the contents?

13:59 mmitchell: justin_smith: Messing with them. I have a tag like: <div ui-view></div> and it's replacing it with <div ui-view="ui-view"></div>

14:02 justin_smith: mmitchell: is an attribute that isn't a k/v pair even valid?

14:02 mmitchell: justin_smith: according to Google and their AngularJS framework, I guess so

14:04 it must be something related to the parser? Trying to "fix" things, but I don't want it to change the markup, just replace a single tag and that's it

14:05 cbp_: it's not xhtml valid but it's valid html :-P

14:07 justin_smith: is this "attribute minimization"?

14:08 if so, <div ui-view> and <div ui-view="ui-view"> should be identical

14:12 rasmusto: I'm trying to connect to a remote nrepl when editing a file in emacs with tramp, and it's refusing my connection, is there something obvious I'm missing?

14:13 (using cider)

14:13 justin_smith: rasmusto: by default nrepl is localhost only

14:14 you can use an ssh tunnel

14:14 I wouldn't recommend making an nrepl port open

14:14 ssh -L ...

14:15 it would be cool if tramp had a tunnelling alist config (for all I know it may actually have one...)

14:18 rasmusto: justin_smith: ok, thanks.

14:18 Yeah, I wouldn't want the port open

14:23 turbofail: oh shit, clojure/west is happening right now. i suppose i should pay more attention to these things if i want to go to them

14:24 irctc: is there another big Clojure-centered confernece happening this year?

14:24 or is Clojure/west the big daddy

14:24 justin_smith: euroclojure also happens

14:24 irctc: when is that

14:25 justin_smith: http://euroclojure.com/2014/

14:25 looks like June 26 - 27, in Krakow

14:25 irctc: thanks

14:25 justin_smith: which is a cool place to visit

14:25 irctc: for sure

14:25 went to Paris last year, met some neat Clojure users, they inspired me to pick it up

14:36 gtrak: irctc: clojure/west is the west of the US, not the world. we also have clojure/conj in the east.

14:36 irctc: do you think there will be more Clojure jobs moving forward in the future?

14:36 to pose n insanely general question

14:38 nightfly: yes, for an insanely vague answer

14:39 irctc: hehe i like that answer

14:39 All the jobs I see seem to be centered in NYC or the Bay area

14:39 I am hoping more places around the world start adopting Clojure in production

14:40 zspencer: I'm working from home on clojure

14:40 and we are hiring

14:40 irctc: that is great

14:40 really?

14:40 very cool

14:40 zspencer: Yea, we don't advertise because we suck at marketing

14:40 irctc: good to hear

14:40 zspencer: Also we seem to be growing at an absurd rate; probably 100 devs by next year.

14:40 irctc: wow

14:41 how experienced do you guys require your new devs to be?

14:41 hyPiRion: zspencer: 100 devs or 100 clj devs?

14:41 zspencer: 100 clj devs

14:41 hyPiRion: wat

14:41 irctc: I always think it is interesting to think about it when a language or technology is less than a decade old

14:41 zspencer: 80% of our code is clojure/clojurescript

14:41 TravisD: For multiline docstrings, is it customary to indent the lines so that they all start in the same column?

14:41 hyPiRion: woah, which company?

14:41 zspencer: http://Outpace.com

14:42 Though, to be frank, "clojure dev" is being used in this ocntext to mean "people who are writing clojure" ;)

14:42 since I'm by no means a clojure expert

14:42 hyPiRion: yeah, sure thing

14:42 zspencer: However most of our devs have 8+ years of dev experience in a variety of languages

14:42 irctc: cool

14:43 zspencer: TravisD: Yes, multiline docstrings should line up nicely (IMHO)

14:43 I don't know i there's a pep8 for clojure that explicitely states that however

14:45 TravisD: zspencer: I guess it'd be a CEP instead, or something. I also think that they should be lined up nicely, but I was curious about whether or not tools had good support for whitespace at the beginning of lines

14:46 hyPiRion: TravisD: I do it the way emacs indents docstrings. Pretty sure that's the way it's done in clojure.core and Leiningen

14:46 so it's like

14:47 TravisD: hyPiRion: Awesome, is that what happens when you auto-fill a comment string

14:47 hyPiRion: TravisD: yeah, afaik. https://github.com/technomancy/leiningen/blob/110e2a14e96ae88fad486365962106fac3eedd8d/leiningen-core/src/leiningen/core/utils.clj#L74-L76 is how it's done in clojure-mode from what I gather.

14:51 TravisD: hyPiRion: awesome, yeah. That's convenient :)

14:55 fro_: guys, I'm stuck with choosing technology stack for a new project. The main task for that app is constant syncing, aggregation, strore and showing data in realtime via http/websockets. I'd like to use queues for messaging beetween processes. Also I have deployment requirements: it should able to deploy as standalone app as well. Maybe somebody know common solutions for? Of course I'll be happy to use clojure.

14:56 gtrak: fro_: seen core.async yet/

14:56 ?

14:57 fro_: yes, I have

14:57 clojurebot: Pardon?

14:58 gtrak: lamina, storm, pulsar might also be of interest

14:58 fro_: thx

14:58 I will see

14:58 gtrak: and I think JBoss immutant has some coordination stuff.

14:58 fro_: and it's able to deploy standalone?

14:59 gtrak: it's an app server itself.

14:59 fro_: even whithout jre?

14:59 gtrak: ah, well, you might have to do that part yourself.

14:59 'synchronous messaging, caching, scheduled jobs, XA transactions, clustering, daemons and more'

14:59 you can bundle a JRE with an app

14:59 but that's not a clojure-specific thing

15:00 fro_: ok, that java-specific, I'm not a java programmer actually

15:00 ok, I'm glad to now, that it's real

15:01 gtrak: ah, yea, anything in clojure is going to require a Java VM runtime. there's lots of ways to distribute java apps

15:01 fro_: and can be done

15:04 `cbp: well you can use http-kit for websockets but I don't know what the rest of your requirements mean

15:04 gtrak: jetty has websockets too :-)

15:15 TravisD: Is there a way to have one protocol require another? Like, some type must first be an A before it can be a B

15:17 ptcek: how should one approach transforming set of ordered collections into tree? i.e. #{[:a :b :c] [:a :b :cc] [:a :bb :c] [:a :bb :cc]} into [:a [:b [:c :cc]] [:bb [:c :cc]]] ?

15:18 ambrosebs: TravisD: that's not how they're intended to be used

15:18 TravisD: ambrosebs: Ah, I was thinking this might be the case

15:20 anyways, relocating now

15:20 I'll be back in a bit

15:20 gtrak: ptcek: looks like a combination of assoc-in and merge-with.

15:34 ptcek: gtrak: merge-with seems usable, gonna try something, thanks

15:34 hlship: I'm giving speclj a whirl, based on a recommendation

15:34 mostly nice, but there's a gap between the tutorial and the actual docs

15:34 some of the more interesting things aren't documented (well), such as stubs

15:35 anyone know a more detailed tutorial?

15:42 upwardindex: How not to include the whole goog library in the uberjar of my server?

15:46 fu86: hi

15:47 Anderkent: upwardindex: probably not possible. I mean you could in theory try to strip classes that are never reached, but I'm not aware of any project that attempts that

15:47 fu86: I want to create a directory structure with the right directory separators depending on the OS. Is there a solution for that in the clojure core or in a (well tested) lib?

15:48 Anderkent: fu86: work with File objects rather than strings?

15:48 upwardindex: Anderkent: If I’m not mistaken, everything gets compiled into my output .js file by the closure compiler. I don’t understand why these files are needed at all?

15:49 Anderkent: ah, sorry, I was thinking clojure not clojurescript. Don't know how clojurescript does uberjars (what does it even mean for clojurescript to uberjar?)

15:49 fu86: Anderkent: Can you give me some hints for that? On some point I need to specify the directory with a separator, or am i wrong?

15:50 Anderkent: ,(file "foo" "bar" "zip")

15:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: file in this context, compiling:(NO_SOURCE_PATH:0:0)>

15:50 vmarcinko: hlship: as someone who developed DI container in java, do you miss something to modularize/configure/parametrize clojrue apps in similar way? i recall you commented that you didn't need something like that in clojrue...

15:51 Anderkent: ,(clojure.java.io/file "foo" "bar" "zip")

15:51 clojurebot: #<File foo/bar/zip>

15:51 fu86: Anderkent: thanks

15:53 pbostrom: upwardindex: you have to turn on advanced compilation to get dead code elimination

15:53 Anderkent: pbostrom: upwardindex: actually now I think he means that the code used to compile clj->js is contained in his *server-side* uberjar?

15:54 upwardindex: pbostrom: My project is :aot :all and :omit-source true, but my uberjar is still full of .js files from the goog library

15:54 hiredman: vmarcinko: there are some things in a similar vain https://github.com/stuartsierra/component https://github.com/juxt/jig the big different is they tend to more direct than java di frameworks

15:54 Anderkent: hm guess I don't know enough about cljs to help here; possibly having a build step that compiles cljs -> js then another that uberjars these as resources and is not aware of cljs otherwise?

15:55 pbostrom: yeah, I would think you build cljs first then uberjar the compiled js

15:57 vmarcinko: hiredman: thanx...yeah, i know these libs... just wanted to hear the comment since howard is very experiencd in this area, but he also commented few years back he didn't need it, so i wanted to hear if he shares that semntiment still, because when I came into clojrue land from java, it immediately struck me as something that i miss - just some simple way to replace some fucntion implementations, as well as to parameetrize some fns

15:58 pbostrom: upwardindex: in any case, whatever is building the cljs needs to have advanced compilation configured, I doubt that the uberjar task is what's actually building it, but I could be wrong

15:59 upwardindex: pbostrom: lein-cljsbuild is compiling it, I guess I’ll need to talk to emezeske about this or perhaps dnolen or cemerick

16:03 pbostrom: upwardindex: or just read the lein-cljsbuild docs, set ':optimizations :advanced'

16:04 upwardindex: https://github.com/emezeske/lein-cljsbuild/blob/1.0.2/example-projects/advanced/project.clj

16:05 upwardindex: note that if you use advanced compilation you need to have externs files for any javascript libraries you are using

16:06 I wish there was a way to do dead code removal without munging, but I don't think you can

16:13 upwardindex: pbostrom: Is not so much dead code removal, I don’t mind having a big ./resources/public/js/output.js file. My issue is that there is a ./goog/ directory in my uberjar with 16 MB of files that seem to me to be completely useless to the correct operation of my server or clients connecting to it.

16:14 pbostrom: upwardindex: I would consider that dead code, which you can remove if you enable advanced optimization

16:15 it's just the way Google Closure works, which cljs doesn't have much control over

16:15 other than providing an interface to configure it

16:17 upwardindex: pbostrom: Oh my bad. I was convinced that :optimizations only affected the output file of the build. I’ll try it right now.

16:17 pbostrom: upwardindex: actually, maybe I'm misunderstanding the problem; can you just tell me what you have optimations set to?

16:17 rasmusto: justin_smith: it looks like cider #489 added jack-in for tramp buffers (8 days ago), is this something you know about?

16:18 justin_smith: rasmusto: no, not at all - I've just been using ssh tunnels manually for ages now

16:18 upwardindex: pbostrom: I was running with :simple but I’ll switch it right now to fix the problem.

16:19 rasmusto: justin_smith: I'm wondering if it broke my ability to cider-connect to localhost:port on a forwarded port

16:19 justin_smith: oh, don't know at all

16:19 pbostrom: upwardindex: I think I see what you're saying now, those are probably the intermediate build files the compiler leaves lying around

16:19 rasmusto: you just do a -connect and give it localhost and the forwarded port#, right?

16:19 regardless of whether it's a tramp buffer or not

16:19 justin_smith: rasmusto: yeah, exactly

16:19 pbostrom: upwardindex: sorry for the confusion, I guess uberjar should be configured to ignore them

16:20 upwardindex: pbostrom: Yes, these are actually not intermediate files but input files to the compiler, and (as I just tested right now) they are still in the uberjar in :advanced mode

16:24 pbostrom: upwardindex: try :uberjar-exclusions

16:24 rasmusto: justin_smith: got it working, seems pretty easy now :)

16:25 justin_smith: cool, what was the trick - just using the forwarded port directly?

16:25 pbostrom: upwardindex: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L348

16:26 rasmusto: justin_smith: yeah, just used `ssh -f <remote> -L port:localhost:port -N`, then cider-connect to localhost

16:26 it even auto-completed the port for me since I was using a tramp buffer

16:26 justin_smith: nice

16:27 rasmusto: all of this to get around funky colors in the terminal mode of emacs

16:27 haha

16:27 justin_smith: indeed

16:27 it handles keys better in the X11 version too though

16:27 rasmusto: ah, that's definitely true

16:28 upwardindex: pbostrom: Sweet stuff, it works great!

16:32 hlship: vmarcinko: Stu Sierra's blog is on the money for me, "system as transient state"

16:32 You can see how that's evolving in Twixt; there's a map of configuration details that gets passed around a modded

16:33 and then used to build the running system

16:33 it can be more complex than that

16:33 but always less, less, less, complex than Java and DI

16:54 devn: BobSchack: you around?

16:55 BobSchack: devn yep

17:35 bitemyapp: hyPiRion: client or server?

17:35 hyPiRion: bitemyapp: yes

17:35 mostly server though

17:35 or, server first, I gues.s

17:36 bitemyapp: hyPiRion: the most unified and mature stack is Yesod + Conduit (constant space, streaming IO) where one uses Conduit for any client-side ops.

17:37 Network.Http.Conduit was one of the libraries I was tinkering with yesterday. httpLbs is the muggle-mode interface that lets you skip the streaming-oriented abstractions and get a whole bytestring of the response out of the function call.

17:37 * hyPiRion notes this down

17:37 bitemyapp: hyPiRion: if you want constant-space, streaming comprehension of the data rather than a fixed-size payload then you'd not use httpLbs and instead use the http function, but then you're playing by Conduit's rules.

17:38 hyPiRion: Conduit is a general purpose library for streaming IO (any sort), this http facade is just a handy client.

17:38 hyPiRion: alright

17:38 whodidthis: how do i convert json into persistentarraymap with clojurescript core

17:38 in javascript

17:39 bitemyapp: hyPiRion: tutorial on the client (and the rest of the server-side framework) here: http://www.yesodweb.com/book/http-conduit

17:39 * hyPiRion bookmarks

17:39 whodidthis: if possible heh, am just wondering how to plug some application state into om's render-to-str in nashorn

17:40 which would be AWWsome

17:40 bitemyapp: hyPiRion: cheers :)

17:41 hyPiRion: bitemyapp: thanks =)

17:41 (inc bitemyapp)

17:41 lazybot: ⇒ 16

17:41 bitemyapp: hyPiRion: main thing right now is an ElasticSearch client library for Haskell. I want a *really* nice one.

17:41 augustl: whodidthis: would be even cooler to not convert :)

17:41 bitemyapp: hyPiRion: you see Engelberg's slide with me and ddellacosta on it?

17:41 augustl: since nashorn JS can call into the JVM

17:41 bitemyapp: I dunno if you fav'd it on twitter or not. Amused me.

17:43 augustl: whodidthis: not sure how the interop would work there, though. And if it's cljs or om that would need to support it

17:43 hyPiRion: bitemyapp: the instaparse one?

17:43 whodidthis: i was thinking about evaling the om code from jvm

17:43 augustl: whodidthis: since cljs is protocol driven, I suppose it's possible to just implement the protocols for the JVM types with cljs

17:43 whodidthis: yeah, so am I :)

17:44 whodidthis: would be nice if cljs knew how to work with the JVM types directly when running inside nashorn

17:44 whodidthis: yeah im pretty bad at understanding protocol code, i guess theres no simple function

17:44 augustl: dnolen would know, but I guess he's offline due to Clojure/west :)

17:45 bitemyapp: hyPiRion: da

17:45 whodidthis: such man

17:46 hyPiRion: bitemyapp: I really enjoy instaparse, but stuff I have to parse is like 4-9GB large.

17:47 whodidthis: otherwise i was thinking leaving a single ^:export rendering function into om code to call from jvm works great, just got to figure out a way to slide in that application state

17:47 hyPiRion: And instaparse isn't able to stream the ast, at least from last time I looked at it

17:47 bitemyapp: hyPiRion: incidentally, Haskell has very good tools for that :)

17:48 hyPiRion: cf. http://hackage.haskell.org/package/aeson

17:48 gtrak: cheshire can stream

17:49 hyPiRion: bitemyapp: that's the reason I asked you for Haskell in the first place ;)

17:49 gtrak: i believe...

17:49 bitemyapp: hyPiRion: see here: http://hackage.haskell.org/package/attoparsec-

17:49 gtrak: aha, parsed-seq

17:49 bitemyapp: hyPiRion: sometimes people will prototype in Parsec, then push a production version in Attoparsec, but many are comfortable just starting with Attoparsec.

17:50 hyPiRion: ah, I see

17:50 bitemyapp: hyPiRion: if it wasn't obvious, Aeson is written in Attoparsec.

17:51 hyPiRion: some people will do streaming parsing in Conduit though, not unheard of at all, but Conduit isn't design-wise specific to parsing.

17:51 hyPiRion: ah

17:51 bitemyapp: there's a library called Pipes too, but I don't think it would necessarily win you a lot until you were more of a Haskell aficionado.

17:51 but it's similar to Conduit, constant-space streaming abstractions.

18:00 danielszmulewicz: How is this even possible? java.lang.Exception: No namespace: *ns* found

18:01 bitemyapp: good to see clojuredocs is still stuck on 1.3

18:01 hiredman: ,(intern '*ns* 'foo)

18:01 clojurebot: #<Exception java.lang.Exception: No namespace: *ns* found>

18:03 danielszmulewicz: ,(clojure/repl/dir *ns*)

18:03 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: clojure, compiling:(NO_SOURCE_PATH:0:0)>

18:03 danielszmulewicz: ,(clojure.repl/dir *ns*)

18:03 clojurebot: #<Exception java.lang.Exception: No namespace: *ns* found>

18:03 danielszmulewicz: ,*ns*

18:03 clojurebot: #<Namespace sandbox>

18:03 Bronsa: clojure.repl/dir is a macro

18:03 hiredman: dir is dumb, us ns-publics

18:03 use

18:04 danielszmulewicz: hiredman: dumb indeed. Thanks.

18:05 no6: is it possible to overload anonymous functions?

18:06 gtrak: no6: arities, yes.

18:06 Bronsa: no6: not using the #() syntax though

18:06 technomancy: ,((fn ([] :no) ([_] :yes)) :overloaded?)

18:06 clojurebot: :yes

18:06 gtrak: ,((fn ([x] x)) 4)

18:06 clojurebot: 4

18:08 gtrak: ,((fn wat ([] (wat 0)) ([x] x)) )

18:08 clojurebot: 0

18:09 no6: as in, (fn ([x] (* x 2)) ([x y] (apply * [x y]))) ?

18:09 hyPiRion: ,(map (fn wat ([[x]] x) ([[x & r]] r)) [[1] [1 2] [1 2 3]])

18:09 clojurebot: #<CompilerException java.lang.RuntimeException: Can't have 2 overloads with same arity, compiling:(NO_SOURCE_PATH:0:0)>

18:10 gtrak: boooo

18:11 no6: thanks

18:15 danielszmulewicz: I have a couple of utility functions that I'd like to have handy at all times. Should I look at leiningen, vinyasa or cider to achieve that? Other suggestions?

18:16 hiredman: first thing is, are you sure you need them?

18:17 danielszmulewicz: hiredman: When I'm asked if I'm sure, I always start to doubt.

18:17 clojurebot: Gabh mo leithscéal?

18:17 hiredman: I hear about people doing that kind of thing, but in however many years of using clojure I never have

18:18 `cbp: danielszmulewicz: your own utility library. Not that that is a very popular solution

18:18 justin_smith: danielszmulewicz: you can require the lib in a dev lein profile

18:18 danielszmulewicz: hiredman: Vinyasa has specialized in that kind of thing. Injecting >pprint, >doc, >source etc. in all namespaces.

18:19 justin_smith: Yep.

18:19 hiredman: clojure will load the first user.clj it finds on the classpath

18:20 lein has the ability to specify profiles at the user level, so you have dependencies and plugins that get added everywhere

18:20 `cbp: Oh i guess I misunderstood "always"

18:22 danielszmulewicz: hiredman: Right. I think I'll use Vinyasa's functionality. I'd like a (pprint (keys (ns-publics *ns*))) aliased to dir-ns at all times.

18:26 hiredman: danielszmulewicz: so for me, I always look at the source, the only time I use ns-publics is when I am in a repl connected to a running application with some version which may not be what I have checked out locally

18:27 which I guess would explain why I never use `source`, I would use emacs's jump to definition

18:29 danielszmulewicz: hiredman: Emacs' imenu can be useful in a source buffer to quickly scan the defns. But in the repl, a #'dir-ns would serve me well.

18:30 hiredman: danielszmulewicz: sure, I am just musing aloud on why some people feel the need for things that I never have had a need for

18:34 danielszmulewicz: Does the trick too: (defun dir-ns ()

18:34 (interactive)

18:34 (cider-interactive-eval "(>pprint (keys (ns-publics *ns*)))"))

18:35 hiredman: Sure, jump to source is priceless.

18:45 arohner: is there a clojure/west room?

18:45 and does anyone have a link to the mal source?

18:46 technomancy: http://p.hagelb.org/mal.gif

18:46 arohner: technomancy: ha

18:46 technomancy: that's all I got, sorry

18:46 dsrx: technomancy: clutch

18:47 jcsims: arohner: https://github.com/kanaka/mal

18:48 arohner: jcsims: thanks!

18:48 arrdem: lolz

18:48 jcsims: arohner: np

18:49 technomancy: that gif works reall well for the question

18:50 dsrx: that was about the most perfect use of mal.gif i've seen

18:50 arrdem: it seems that erc-images doesn't support animated gifs..

18:50 I'm sad

18:50 turbofail: is that from firefly or castle?

18:51 jcsims: firefly

18:51 technomancy: arrdem: did they ever add scaling?

18:51 turbofail: hm. i guess he does look younger there

18:51 arrdem: technomancy: it's in there, but I didn't get it to work

18:52 technomancy: I've only got it turned on in here and in -social because of getting slammed with shock pics :c

18:52 technomancy: can't be too cautious

18:52 gifs on repeat would probably get pretty tedious anyway

18:53 dsrx: could do click^Wselect to play

19:30 brehaut: huh. no finite domains in core.logic for cljs. thats a pain

20:31 mheld: I have a list of maps, how do I convert it into a single map?

20:32 brehaut: merge or merge-with

20:32 perhaps with a reduce

20:32 mheld: apply merge works!

20:32 there we go

20:33 there must be a better way but it works

20:33 AimHere: Just so long as you don't have a clash of keys

20:34 mheld: (apply merge (map (fn [k] {k (k config)}) [:db :user :password]))

20:35 oh, I guess I could've done some sort of get

20:35 AimHere: That looks like a job for reduce, though most things are a job for reduce

20:36 (reduce #(fn [m k] (assoc m k (k config))) {} [:db :user :password])

20:36 mheld: that's probably the right way to do it

20:37 AimHere: (#(zipmap % (map (fn [k] (k config)) %)) [:db :user :password])

20:38 mheld: hah even better

20:38 AimHere: TMTOWTDI

20:38 mheld: gracias

21:18 kras: I am using a seq-zip, my aim is to walk the tree until I find the node I need and from there go right. This is how far I got: (filter (partial = :description) (map z/node (iterate z/next zp)))

21:18 zp is the zipper here

21:19 How do I go right from the first node which satisfies this

21:24 scottj: Did anyone mention that today is actually Clojure's real birthday? (first git commit of "created IDEA project", first real code was commited on march 25 but presumably written on the 24th after the IDEA project was created)

21:28 actually the autogenerated headers for the files commited on the 25th say they were created on the 25th, so maybe on the first day Rich created an IDEA project, saw that it was good and the rested.

22:26 rpmd30: Does anyone have experience with clojure and storm version v0.9.1?

22:31 brehaut: ~anyone

22:31 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

22:31 brehaut: (in saying that, clojurewest is happening so answers may be thin on the ground)

22:35 rpmd30: That makes sense thank you

22:45 pdk: clojurebot you always know what's best for me

22:52 kopasetik: anyone here planning on going to lambda jam?

22:53 Frozenlock: What's happening at clojurewest? What am I missing for-yet-another-year?

22:56 bostonaholic: @kopasetik went to Lambda Jam last year and I'll be attending again

22:56 zspencer: bostonaholic: I'm planning on attending this year. Looks more interactive than normal confs.

22:57 bostonaholic: yeah, the "Jams" were awesome hands-on projects. working with super smart people

22:57 pdk: when is it scheduled

22:57 bostonaholic: watching Joe Armstrong pair on Elixir for the first time was awesome

22:57 kopasetik: cool, it looks like it's a great opportunity to learn more about clojure via hands-on sessions

22:58 bostonaholic: I did the clojure workshop on "

22:58 kopasetik: lambdajam is in chicago july 22-23

22:58 bostonaholic: macros" and it helped a lot

22:58 woops

22:59 and the "Jams" were focused on AI and machine learning. language agnostic

22:59 http://www.lambdajam.com/

22:59 zspencer: See, that's my kind of party. Programming with cool people on fun problems

23:00 bostonaholic: yup

23:00 learn you some haskell/scala/erlang whatevs

23:00 zspencer: Haskell, Erlang, Clojure are my list

23:01 clojure seems tob e winning the "Hey, UI programming may not suck anymore" battle

23:01 bostonaholic: I'm over learning haskell

23:01 Elixir would be fun to tinker with

23:01 zspencer: bostonaholic: oh? why?

23:01 bostonaholic: yeah, writing ClojureScript with Reagent has been amazing

23:02 zspencer: I was poking at OM; I like the notions that REACT professes

23:03 kopasetik: !macro

23:03 zspencer: Maybe tonight is a Reagent and IPA night

23:03 kopasetik: just seeing what the bot does here

23:04 arrdem: ~source

23:04 bostonaholic: @zspencer heh

23:04 patrickod: is "Clojure Programming" by O'Reilly still a good resource 2 years later (http://amzn.to/1rrpCn6) ?

23:04 bostonaholic: not sure exactly why we chose Reagent over Om. I didn't do the initial spike. Let me know what you think of Reagent vs. Om

23:05 brehaut: patrickod: yes, i think so

23:05 zspencer: So, I'm torn. I actually really like JSX syntax for the dom definition

23:05 and reagent looks reasonable in that regard

23:05 patrickod: the other book that people seem to recommend highly is "The Joy of Clojure"

23:05 zspencer: I'll withold judgement for now

23:05 brehaut: the joy of clojure is excellent

23:05 patrickod: but its drinking from the clojure firehose

23:06 patrickod: too much too soon eh?

23:06 brehaut: patrickod: it depends on your background

23:06 patrickod: what sort of background does it favour?

23:06 brehaut: patrickod: ideally you have some sort of lisp and or functional programming experience

23:07 doesnt have to be heaps

23:07 patrickod: no lisp background. i try to keep my python pure though :)

23:07 brehaut: having a dynamic language background can work with it

23:08 depends how fast you pick up languages

23:08 it wont hold your hand

23:08 arrdem: I learned from JoC

23:08 and bugging amalloy and techn0mancy and others in chan.

23:09 brehaut: as did I, JoC is a great book

23:09 Fogus’s Functional Javascript makes a great primer for JoC

23:09 waf: i think JoC has a new edition coming out in the next few weeks

23:10 brehaut: that sounds right

23:10 the publisher has an associated deal

23:10 MC-Escherichia: i did the manning early access program for Joy of clojure, i have an in progress pdf copy and when it's published they'll mail me the book

23:14 brehaut: patrickod: the focus of the two books (JoC and CP) are a bit different; JoC digs deep into a philisophical approach that clojure takes, whereas CP is a bit more 'practical' (but i hate using that to describe it; it does a disservice to both books)

23:16 arrdem: brehaut: I would agree that JoC was more philisophical... I really enjoyed and honestly needed the introduction to the data immutable approach to the universe when I started with Clojure

23:16 there was a solid three weeks that I was totally paralyzed by the lack of side-effects :P

23:16 brehaut: haha

23:17 patrickod: I've been trying to familiarize myself with clojure by writing a very simple project with it the last while

23:17 brehaut: thats a good approach

23:17 patrickod: but I feel like I'm just haphazardly discovering some of clojure's ideas / features

23:17 arrdem: patrickod: I mean.. that's the best you can do

23:17 patrickod: and your first code is gonna be crap :P

23:17 brehaut: patrickod: have you read clojure.org ?

23:17 its terse yes but it does cover everything

23:17 patrickod: arrdem I'm reading a style guide here on GH trying to make it look less so

23:18 arrdem: patrickod: awesome.

23:18 patrickod: brehaut I've kept clojure.org open throughout the process but not sat down to exhaustively read it

23:18 arrdem: clojure.org could use a lot of work....

23:18 the cheat sheet is the only thing that I ever used heavily

23:18 brehaut: patrickod: sure. My personal take on any language im learning is to read enough to get going, then make a small project and go back and read it exhaustively (if reasonable)

23:19 patrickod: I've been taking inspiration from the clojars.org source code as "idiomatic"

23:19 arrdem: patrickod: what are you looking to do in Clojure?

23:20 patrickod: at the moment I'm writing a small SMS service using Twilio as the provider

23:20 basically it listens for inbound webhooks, decides what to do, and spits it out to Twilio again

23:20 brehaut: that seems like a decent first project

23:20 patrickod: it's an SMS tumblr. You send an SMS in and a random recipient in the group receives it on the other side

23:20 brehaut: ring etc and clj-http

23:20 arrdem: definitely

23:20 patrickod: s/tumblr/tumbler*

23:21 arrdem: it just means I won't share the weird stuff I've built with Clojure because it isn't relevant :P

23:22 but if you want a "how not to api" and "how to refactor a first clojure project", :P

23:22 https://github.com/jphackworth/cryptick/pull/5

23:22 brehaut: arrdem: based purely on the number of people who find clojure.org offputting it needs work. however, it *is* fairly comprehensive and is the only language *reference* we have. but it doesnt have an easy introduction for new users

23:23 and like much of the clojure documentation it favors brevity

23:23 arrdem: brehaut: tbh the thing I love about clojuredocs.org is that I can, as a human, write the document path for the symbol I care about

23:23 brehaut: arrdem: right, but a language reference is different to api documentation

23:23 its certainly a blurry distinction with a lisp

23:24 but nevertheless

23:24 arrdem: brehaut: IMO clojure as a language needs a spec, this being equivalent to docs over the entire ST:

23:24 *STL

23:24 take with a grain of salt the size of a brick

23:24 and a shot of vodka

23:26 brehaut: arrdem: i think theres an interesting dualism to the design of most lisps that makes a formal spec an interesting and problematic challenge

23:26 in practise most of the the language is bootstrapped

23:27 arrdem: yarp

23:27 brehaut: so do you spec the language features most users interact with, or do you spec the language the rest of the language is implemented with

23:27 arrdem: IMO you hide the latter and spec the former

23:27 I don't consider "clojure" to be the kernel that's used in bootstrapping

23:27 I consider "clojure" to be the STL that I work with on a daily basis

23:27 brehaut: right, and that would also force implementation details to end up being specs

23:28 but then you end up with just an API document which is less interesting as a spec than in another language

23:28 arrdem: I disagree. It would seem to me that by writing an API spec you may canonize "first platform" idiosyncracies..

23:28 but you make it easier for nth platforms to match the first

23:28 brehaut: (and infact if you look at the doctypes for a lot of the bigger features like deftype it _is_ specced

23:29 arrdem: my only real complaint is the CLJX one of "how does being close to the host impact the reader macros". So jvm clj has support for class interpolation... Integer/MAX_VALUE -> (. Integer MAX_VALUE) and soforth.

23:30 which is meaningless on Clojurescript

23:30 by no means do I pretend to offer informed argument on any of this

23:30 you're way more senior than I am

23:30 this is just what sticks out to me.

23:30 brehaut: yeah that cljx thing is interesting; good old trade offs

23:31 clojure and clojurescript would be much worse in a lot of ways if they obscured the host

23:31 but but exposing it, there are definate problems to deal with

23:31 anyway i need to head

23:32 MC-Escherichia: in the two projects i've done all the java-stuff ended up in one ns, so porting it to clojurescript would just require reimplementing that ns

23:55 Frozenlock: bostonaholic: Om hurts my brain :-p

23:55 arrdem: braaaaaaaaainz

23:56 bostonaholic: give Reagent a shot

23:56 Frozenlock: That's what I'm using

23:56 bostonaholic: I can't say if I like it better because I haven't tried Om, but I do like Reagent

23:57 Frozenlock: -> because Om hurts my brainzzz!

23:57 zspencer: Yea, initial pass today is "Reagent looks nicer than om"

23:57 But it could just be the compelling examples

23:57 * arrdem does the zombie shuffle in search of brains

23:58 Frozenlock: Those two are great with Reagent https://github.com/alandipert/storage-atom https://github.com/Frozenlock/historian (probably with Om too)

23:58 Btw, let me know if there's a more advanced undo library, I haven't found any :-/

23:59 bostonaholic: wow, historian looks cool

Logging service provided by n01se.net