#clojure logs

2014-03-24

00:05brehautis there a relational way to use clojure hierarchies with core.logic ?
00:05brehaut(ie, without having to step down to project)
00:06brehautor should i just encode those hierarchy relationships with core.logic relations?
01:11muhooany ideas about heroku breakage? https://www.refheap.com/64566
02:50cstacywhy am I getting “Unable to resolve symbol: subset? in this context”
02:50cstacyIt seems like none of the set functions are defined (except for ‘set’)?
02:53cstacy(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)
02:54cstacyI must be making some terribly newbie mistake?
02:55foofybazcstacy: " (subset? (set '(a)) (set '(a b c)))"
02:55foofybazoops
02:56foofybazcstacy: "(clojure.set/subset? (set '(a)) (set '(a b c)))"
02:56cstacyOh it’s in some different namespace? I didn’t see that mentioned in the doc. TY
03:50cYmen_Morning, #clojure!
03:51cYmen_Is clojurescriptone still up to date or is there something better?
03:53seanawayIt's dead. Look at Pedestal instead.
03:53seanawayAlthough, frankly, I'd recommend ClojureScript + AngularJS + Purnam
03:54seanawaybut it depends what you're looking for :)
03:57cYmen_seanaway: I don't really know what I'm looking for. Why would you recommend that instead?
03:58cYmen_(I don't know anything about Angular and I've never even heard of Purnam.)
03:58seanawayPurnam makes AngularJS / ClojureScript interop a lot easier
03:59cYmen_And why do I want Angular?
03:59seanawayIf you're looking for a full immersion ClojureScript web solution, Pedestal might be your thing
03:59seanawayIf 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)
04:00cYmen_Well, right now I'm mostly interested in getting started. :)
04:00seanawayfor example, check out http://keminglabs.com/blog/angular-cljs-weather-app/
04:00seanawayI think Pedestal is way too complicated for "getting started"
04:01seanawaybut ClojureScript + AngularJS + Purnam isn't bad
04:01seanawayhttps://github.com/purnam
04:02cYmen_seanaway: Thanks.
04:03cYmen_More links to tutorials, howtos or examples are always welcome! ;)
04:03seanawayI'm still at the early stages myself. We're just starting to look at ClojureScript at work.
04:04seanawayMost of the ClojureScript stuff seems to build on solid JS stuff... Om builds on ReactJS for example
04:05seanawayand there's the jayq library for ClojureScript / jQuery integration
04:05seanawaye.g., http://squirrel.pl/blog/2012/10/16/hello-clojurescript-with-jquery/
04:07seanawaybut 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
04:09cYmen_seanaway: So write a new one! ^^
04:22seanawayHeh, yeah, as we work on our new CLJS app I probably will :)
04:23seanawayOff to bed. Clojure/West means getting up early (since I'm commuting into the city!)
05:25octei have a nested map, like this, {:product1 {:internal {:thing1 "http://..."}}}, with multiple keys and always a url at the third level
05:26octeand i want to do a http request for each url and gather the result
05:26octethe way i do it is a nested (map) call
05:26octebut that feels kind of convoluted
05:26octeis there a better way?
05:26augustlocte: you could do a recursive assoc-in type thing
05:27octeaugustl, can you explain?
05:28augustlocte: for each recursive call, remove from the input map and stop recursing when the input map is empty
05:29TEttingerare the keys always the same?
05:30octeTEttinger, pretty much
05:30mpenetyou can use for
05:30mpenet1 binding per level
05:34jonathanjisn't this what get-in does?
05:35TEttingerget-in is for one keys vector, I think there are multiple keys that he has to get
05:36octeyes
05:36octea for might be more clear
05:37pyrtsa,(for [[p {{url :thing1} :internal}] {:product1 {:internal {:thing1 "http://1"}} :product2 {:internal {:thing1 "http://2"}}}] [p url])
05:37clojurebot([:product2 "http://2"] [:product1 "http://1"])
05:42jonathanjTEttinger: aha!
05:47sm0ke,(defn foo [x & {:keys [c]}] (prn x c))
05:47clojurebot#'sandbox/foo
05:47sm0ke,(foo 1)
05:47clojurebot1 nil\n
05:47sm0ke(defprotocol MyPro (fooo [this x & {:keys [c]}]))
05:47sm0ke,(defprotocol MyPro (fooo [this x & {:keys [c]}]))
05:47clojurebotMyPro
05:47clgvsm0ke: protocol do not support varargs
05:48sm0ke,(defrecord MyRec [] MyPro (foo [this x & {:keys [c]}] (prn x c)))
05:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: MyPro in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:48pyrtsasm0ke: You can associate anything to a record, regardless.
05:48sm0keclgv: really :(
05:48clgvsm0ke: there was a discussion whether there should be a warning when "&" is used in a protocol signature
05:49pyrtsaAh, nevermind.
05:49sm0keclgv: so it just ignores the `&`
05:49clgvsm0ke: no. "&" is a parameter name in this case
05:49sm0kewhat come on, thats not true
05:50clgvit is
05:50pyrtsaI wish protocols supported :pre and :post conditions. :/
05:50clgv"&" is nothing special just a symbol
05:50sm0kebut if you will try the example i gave above
05:51sm0ke(.foo (MyRec. 1 2) 1) fails but (.foo (MyRec. 1 2) 1 :c 1) works
05:51sm0kethat would not be the case has `&` been a symbol
05:51sm0kea variable symbol i.e.
05:52clgvno it says CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: foo,
05:52sm0keyea sorry for the extra o
05:53clgv(.foo (MyRec. 1 2) 1 :c 1) => IllegalArgumentException No matching method found: foo for class user.MyRec
05:53sm0kewhat! no way
05:53sm0kei am running clojure 1.4
05:53clgvoops lol
05:53clgvthe "O"
05:55clgvsm0ke: (defprotocol IBla (foo [this, & x])) (defrecord Bla [] IBla (foo [this, & x] (println "& =" & "x =" x)))
05:55clgvsm0ke: (.foo (Bla.) 1 2) => & = 1 x = 2
05:55sm0kewhats with the ','
05:56sm0keok this is weird
05:56sm0kewhats is it with my example then
05:57sm0kehow does that ignores `&`
05:57sm0keso you are saying we can destructure methods of a protocol at all! at least not reliably
05:58sm0kecan not*
05:59sm0keah actually it does not
06:00sm0kesucks
06:01pyrtsasm0ke: Just define the protocol functions with a simple set of arguments (preferably 3 or less) and use a destructuring let binding in the implementation.
06:01pyrtsaIt's better to keep the interface simple, so to say. Destructuring is more of an implementation detail.
06:02sm0kepyrtsa: that leads to bad api
06:02sm0kepyrtsa: how about if user `can` pass a param, but not strictly
06:02sm0ke(foo 1 2 :if-i-want 3)
06:02pyrtsaNo 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*.
06:03sm0kenow the user should remember if he needs foo or foo*
06:03pyrtsa(defprotocol Fooable (foo* [fooable x more])) (foo [x & more] (foo* fooable x more))
06:04sm0keah i see
06:04pyrtsaI'm suggesting a naming scheme (e.g. append * or append - to the name) to suggest the user to prefer the function without the suffix.
06:05pyrtsaOh, a little typo in my code example above. But you get the idea.
06:06sm0kehurm
06:06sm0kejust that it wont show up as a method of protocol :P
06:06sm0keyou cheated
06:06pyrtsaJust put it into the same namespace and Write Some Documentation™.
06:07pyrtsaKeeping the interface simple is definitely not cheating, quite the opposite. :)
06:07sm0keok this is bad idea.. see
06:08sm0kefor other protocol methods i will do (.bar myrec) but for this (foo myrec)
06:08sm0keits probable user will do (.foo myrec)
06:08sm0keand will end up with errors
06:08pyrtsaI'd strongly prefer the Clojure function call instead of using Java interop here.
06:08clgvsm0ke: you can destructure single parameters of a defprotocol but you cannot use variable args via "&"
06:13sm0kehmm this leads me to the conclusion that protocol methods should never be directly exposed to user
06:13sm0kethey are limited and impossible to change/adept in future
06:14clgvsm0ke: that is a bit strong. but yeah, in principle they are more efficent (and limited) variants of multimethods
06:17clgvsm0ke: you need a map parameter in the protocol when you want to have named optional parameters for protocol methods.
06:18sm0keclgv: yes but then it is not optional
06:19clgvsm0ke: well you can have an arity without the map^^
06:19sm0kei have no idea what you are talking about
06:19clgvbut yes, it is not the same quality as with functions
06:20clgv(defprotocol (dosth [a b c] [a b c option-map]))
06:20clgvoops please insert a protocol name ^^
06:20sm0keyeah thats one way to do it
06:21sm0kehurm
06:21sm0kedoes it work that way?
06:21sm0kei need to try this
06:23clgvyes it does. in the implementation (deftype/defrecord) you have two separate methods, one for each arity
06:23sm0keok thats just bs
06:23sm0keyou have to call it like (.foo myrec 1 {:c 2})
06:24clgvyeah, since thats the only way with arbitrary many optional parameters when you want to use defprotocol...
06:24sm0keblah i am giving up on protocol methods, and so should you
06:24clgvbut you could define an API function hiding the protocol...
06:24sm0keNO
06:25clgvsm0ke: lol. no I wont. I'll continue using them where they are the right tool ;)
06:26sm0kei feel like homer simpson trying to choke bart right now
06:28clgvsm0ke: lol, because I won't follow your uninformed bad suggestion to never use protocols?
06:28sm0kelets just agree to disagree here
06:28sm0kehey wait i never said not to use protocols
06:29sm0kei just said protocol methods should not be exposed to the client using your api
06:29clgvlol, 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...
06:31clgvsm0ke: 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 ;)
06:32sm0keyes 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
06:33sm0keto wrap*
06:51borkdudeHow do I get the current Java version from a clojure repl?
06:52jph-system get property something or other via interop
07:00clgvborkdude: (System/getProperty "java.version")
07:01borkdudethanks
07:04sm0kedoes adding a core.typed annotation to function prevents reflection also?
07:05sm0kei am thinking of using core.typed for my project, but i get the feeling wither it is complex or not well presented
07:05sm0keeither*
07:09clgvsm0ke: no it does not
07:59ned-from your house?
07:59ned-why
08:32axhlfHello 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
08:33dsrx,(doc map)
08:33clojurebot"([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."
08:34dsrx,(defn greet-person [name] (str "Hello " name "!"))
08:34clojurebot#'sandbox/greet-person
08:34dsrx,(greet-person "Martin")
08:34clojurebot"Hello Martin!"
08:34dsrxokay, so that returns a string
08:34axhlfYeah
08:35dsrx,(map inc [1 2 3 4 5])
08:35clojurebot(2 3 4 5 6)
08:36axhlfWhat'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?
08:36axhlfdsrx: btw scheiße clojurebot is wow
08:36dsrxif 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))
08:37dsrx(javascript as of ES5 has this too, like [1, 2, 3, 4].map(function (x) { return x + 1}))
08:38dsrxyour JS example is a little confusing, what would you imagine greetPerson would look like as a JS function?
08:39axhlfdsrx: I guess `function greetPerson(name){"Hello " + name + "!"}`
08:40axhlfjust like the clojure example, it takes a name and returns a string with the name yanked in the middle
08:40AimHereYou're missing the return in that function. Also I recommend semicolon delimiters!
08:41axhlfAimHere: Oh yeah sorry! function greetPerson(name){return "Hello " + name + "!"}
08:41axhlf+ semicolon
08:41dsrxaxhlf: 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?
08:41dsrxin 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
08:42dsrxin clojure you can do that with doseq
08:42dsrx,(doseq)
08:42clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/doseq>
08:42dsrx,(doc doseq)
08:42clojurebot"([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."
08:42AimHereThe bug in your function is that ampersand
08:42dsrxerr
08:43dsrxyeah, there's that as well
08:43axhlfdsrx: The result should be a function that is passed to println, so it's printed to the console :)
08:43AimHereaxhlf, (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
08:43dsrxugh, sorry, it's way too late for me
08:43AimHereaxhlf, either take out the ampersand, or invoke with (greet-friends "Martin" "Kyle" "Matt"), depending on what you prefer
08:44axhlfdsrx: that's ok :). Thanks for the tip about doseq
08:45clgvaxhlf: es gibt übrigens auch #clojure.de ;)
08:47axhlfAimHere: 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?
08:47AimHereA list, but yes
08:47AimHere& is how you get variable argument lists
08:47lazybotjava.lang.RuntimeException: Unable to resolve symbol: is in this context
08:48AimHereIt's also how you confuse lazybot
08:48axhlfAimHere: haha
08:48axhlfAimHere: Cool. Thanks :). What is the term for the & if one would google it?
08:48AimHereThe symbol is called an ampersand
08:49AimHereWhat clojurians call it, I don't know
08:49clgvthere is no special term for it.
08:49AeroNotixthere is
08:49AeroNotixAmpersand Of Power
08:49clgvin your dreams ;)
08:49axhlfclgv: ich sprecht nicht so gute deutsch das ich kan in Deutsch jetzst chatten! Sprechen nür ein bissien
08:49clgvaxhlf: ah just thought because of one of your words ;)
08:50dsrxughh, I really need to not try to help when I'm this tired
08:58cYmen_wow
08:58cYmen_pedestal seems pretty massive and impenetrable at first glance
09:03clgvcYmen_: from a security point of view?
09:03cYmen_no from an "I just started the pedestal app tutorial and boy does it look like a deep rabbit hole" point of view
09:04clgvoh ok. heard something similar already
09:04cYmen_Yeah, seanaway` recommended I stay away from pedestal and just use angular and clojurescript and so on...
09:04clgvit is a framework in the library world called Clojure, right? ;)
09:04cYmen_Maybe I need something more basic. :p
09:31axhlfGiven 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)?
09:32BalkyDwarfaxhlf: you might want to look at reduce
09:33axhlfBalkyDwarf: Sorry for the noob question! But thanks a lot for helping a newbie having the time of his life :)
09:34axhlfBalkyDwarf: Works perfectly!
09:35opqdonut,(apply str ["String one " "string two " "and string three"])
09:35clojurebot"String one string two and string three"
09:35opqdonutaxhlf: ^
09:43clgvaxhlf: there is alread clojure.string/join for that particular job
09:44clgv,(require '[clojure.string :as str])
09:44clojurebotnil
09:44clgv,(str/join ", " ["String one " "string two " "and string three"])
09:44clojurebot"String one , string two , and string three"
09:45clgv,(str/join ", " ["String one" "string two" "and string three"])
09:45clojurebot"String one, string two, and string three"
09:45axhlfclgv: That's also really nice. Thank you!
09:47cYmen_[[#{[:*]} haha
09:47cYmen_looks more like perl than clojure :)
09:50cYmen_I have the disconcerting feeling the pedestal guys may accidentally have created a shitty programming language instead of a framework.
09:50AimHerecYmen, I look at that and think its a bash fork bomb
09:52clgvcYmen_: outch! really?
09:53cYmen_I'm in no position to judge, though so relax it's probably just me. ;)
09:55clgvcYmen_: I did not try it so far. I just plugged ring, compojure, hiccup and friend together for what I needed so far ;)
09:55cYmen_yeah, I was messing with ring, compojure, hiccup and noir so far
09:55cYmen_now I decided I wanted some cljs
09:56cYmen_[free madness here] -> https://github.com/pedestal/app-tutorial/wiki :p
09:57cYmen_clgv: Any other suggestions? Something a little lighter maybe?
09:57cYmen_Maybe I should just go with js client-side. For now, anyway.
10:00CookedGryphoncYmen_: what's stopping you just looking at a basic cljs tutorial?
10:00CookedGryphonand develop them independently
10:00cYmen_CookedGryphon: Nothing. Any recommendations?
10:01cYmen_CookedGryphon: I would prefer one that doesn't try to teach me clojure, just the js part ^^
10:01yaziriancYmen_: wait til you find out that routes aren't composable unless you use a different syntax
10:01CookedGryphonI have heard good things about https://github.com/magomimmo/modern-cljs, but not tried it myself
10:02CookedGryphonand I wouldn't be too daunted by the number of lessons, I think the basics are just the first couple
10:02rurumate,(-> 1)
10:02clojurebot1
10:02rurumate,(->> 1)
10:02clojurebot1
10:03rurumateoops, Im getting an exception in my repl with (->> 1)
10:03rurumatewhat clojure version is clojurebot running?
10:06AimHere,(clojure-version)
10:06clojurebot"1.6.0-master-SNAPSHOT"
10:06AimHereShiny
10:07clgvbleeding edge
10:07clgvmaybe ;)
10:11ToBeReplacedonce 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:19hyPiRionToBeReplaced: (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:20hyPiRionI missed some paren matching, but that's at least the idea
10:23ToBeReplacedhyPiRion: thanks
10:23hyPiRionyw
10:28ToBeReplacedhyPiRion: what does "rec" stand for in your implementation? deliberate naming choice?
10:28hyPiRionrecursive. I'm not good with naming
10:29ToBeReplacedokay, just making sure there wasn't some term like "recrazy" as a generic name for that kind of operation ;)
10:33hyPiRionwell, that's probably a name I'd use on myself
10:33rocknrollMarcHey 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:34hyPiRionrocknrollMarc: Clojure programming is what is considered the best book, see www.clojurebook.com
10:34rocknrollMarcrealy ..ok
10:35clgvrocknrollMarc: is it "programming clojure" (Second edition)? then I'd start with that one
10:35hyPiRionWell, at least from what I've heard
10:35rocknrollMarcim 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:36rocknrollMarcI think Im interssted in machiene learning were should I start to look for that one?
10:36rocknrollMarclater I mean
10:37rocknrollMarcThe 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:38rocknrollMarcWhat 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:39AeroNotixguys does anyone know a good website where I can input something and receive answered based on keywords I put in?
10:40AeroNotixkind of like a "search"
10:40AeroNotixbut online
10:40tmciverha!
10:40Averelllike anything you want? keep dreaming.
10:40AeroNotixyeah I know, oh well.
10:41rocknrollMarcHas anyone tryed clojure in action? what would you use for TDD /BDD midje or the other one with S
10:41AverellBSDD
10:41dkinzerrocknrollMarc: you should checkout out the clojure koans cause they are essentially plug and play by nature... https://github.com/functional-koans/clojure-koans
10:42rocknrollMarcahh funny I did some this morming I found them a bit easy but then again ive only done till 3
10:42rocknrollMarcfile 3 I mean
10:43dkinzerrocknrollMarc: 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:43rocknrollMarcok but less code right
10:43rocknrollMarcI have to convice this russian guy that clojure is worth learning for work so I rely need something cleaver I can say ??
10:43lazybotrocknrollMarc: Definitely not.
10:44rocknrollMarcLoL
10:44AeroNotixConvincing people sucks
10:44rocknrollMarcI know but wirking i plain java does even more
10:44dkinzerrocknrollMarc: if you can get him to watch some of the Rich Hickey videos than he'll convince himself.
10:44rocknrollMarcespecialy xml parsing in a self made api I dont know
10:45rocknrollMarcok thanx ill check that out
10:45devthrocknrollMarc: 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:46rocknrollMarcwow that sounds good
10:46rocknrollMarcill check that one out now actualy. ANd what will it be midje or spec? Im also trying to get BDD working there
10:46devthrocknrollMarc: also, no need to switch to emacs for clojure. fireplace.vim is *excellent*
10:47AimHereSsh. Don't tell him. We've converted him away from his vile cult now!
10:47rocknrollMarcI was just sick of tmux actulay and thought Ill try emacs and I must say its quite amazing
10:47clgvrocknrollMarc: "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:47rocknrollMarcoh ok
10:47dkinzerI agree with devth, fireplace.vim works really well with clojure.
10:47rocknrollMarcthanks for all the friendly replys very seldone on irc
10:48rocknrollMarcespecialy with so many typos as I have
10:48devthrocknrollMarc: http://clojure-doc.org/articles/tutorials/vim_fireplace.html :)
10:49devthnot that it matters. use emacs if you like it.
10:53devthrocknrollMarc: not sure on midje/spec. i tried midje, didn't like it. i just use clojure.test but i don't need bdd.
10:54CookedGryphonHey, 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:55CookedGryphonfor example, how do I make it so it doesn't pull in the clojurescript dependency if you're not going to use it
10:55CookedGryphonor would I be better releasing two variants
10:56clgvI 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:04rocknrollMarcok so clojure test is not realy awfull for tdd
11:04BalkyDwarfclgv: maybe something to do with Writer having some overloaded methods...
11:05clgvBalkyDwarf: yeah definitely. found a ML post on the exact same thing
11:33devngood morning
11:36BobSchackGood morning devn
11:52rocknrollMarcYes thanxs great talk and great book ive just started over with it and it seam better by miles
12:17rocknrollMarcwow 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:18justin_smithyup, Clojure is pretty nifty
12:19rocknrollMarcdidnt know that you actualy can change stuff on the repl and then use it i the code , trhts seriously interactive wow
12:20ambrosebsdid the clojurewest core.typed talk fall through?
12:21justin_smithrocknrollMarc: 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:21technomancythis is like ... the only sane way to code
12:21justin_smithrocknrollMarc: just be careful with stuff that ends up working because it is using an old def...
12:21rocknrollMarcok yes i m shure this power also has its own set of pitfalls :)
12:22rocknrollMarcok 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:22justin_smithI 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:24cbp_a certain someone thought that language's workflow was better than clojure's but not as good as common lisp's
12:24technomancycbp_: well yeah, having conditions would make it a lot better
12:25justin_smithman, things sure did get cryptic up in here...
12:25cbp_as in conditions + restarts?
12:25cbp_yeah.. :(
12:26technomancyjustin_smith: probably my #2 complaint about erlang; it's bizzare
12:26technomancylike as far as I can tell there's no technical reason that's not allowed
12:26technomancyit's just that no one has gotten around to writing an actual repl that doesn't suck yet
12:28justin_smithI 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:29justin_smith(ie. how a good lisp, including clojure, does it)
12:30technomancyyeah, but it was the 80s ... back before this kind of stuff was obvious to everyone who isn't rob pike
12:30justin_smithooooh BUURN, shots fired
12:31cbp_well that begs the question..
12:31cbp_what's your #1 complaint about erlang
12:31technomancycbp_: no partial application/very limited use of higher-order functions
12:31oubiwanntechnomancy: 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:32technomancycbp_: you can read the full list here if you like https://raw.github.com/technomancy/dotfiles/master/.gripes.org
12:32technomancyoubiwann: cool, just boggles the mind that it's taken this long.
12:33technomancyI could see myself using that for debugging. kinda allergic to lisp-2s in general though.
12:33oubiwanntechnomancy: yeah, I agree... it's odd that the Erlang REPL was never really perceived as a development tool
12:33yazirianthe answer there is to use elixir instead
12:33oubiwannyazirian: I'm actually an LFE guy, but yeah
12:41justin_smithtechnomancy: so between no partial, no currying, and no composition, you basically just can't do point-free in erlang?
12:41justin_smithI assume you could probably do it with some convention of fn definition or something...
12:42technomancyjustin_smith: it's like lisp-2s, theoretically possible to play FP games, but it's so cumbersome that no one actually does it
12:44fro_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:44fro_tly.. Thanks for helping in advance
12:47cYmen_"Any namespace."?
12:47cYmen_Why not use LightTable if that works for you?
12:49fro_cause I do not like it, maybe...
12:49technomancyfro_: how did you launch the repl?
12:49clojurebotCool story bro.
12:49technomancyclojurebot: shut your face
12:49clojurebotGabh mo leithscéal?
12:50fro_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:50technomancyweird. does `lein repl` inside the project work fine?
12:50fro_1 ыусб огые кусрусл
12:50fro_sorry
12:51fro_1 sec, just recheck
12:55fro_haha, it was a bullshit in project.clj =) sorry for your time! and thx much! )
12:58technomancyno worries
13:04cYmen_technomancy: This is exactly the kind of thing that annoys me about clojure.
13:05cYmen_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:06cYmen_Hm. Maybe that is true for all languages and I just don't notice it anymore in others.
13:08justin_smithcYmen_: I think this has to do with Clojure's embrace of GIGO as not just a fact but a design philosophy
13:08cYmen_GIGO?
13:08justin_smithgarbage in, garbage out
13:08cYmen_ugh
13:09justin_smithreturning nil rather than reporting some error (which admittedly helps some constructs be more flexible - but also hides the source of errors)
13:09jodaroheh
13:09justin_smith(or some other default behavior, often nil though)
13:09cYmen_I hate that.
13:09jodaroinstaparse talk slide from #clojure
13:10mmitchellanyone here familiar with the hickory, html lib?
13:10cYmen_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:11justin_smithwell, first clojure would have to be a bit more clear about that I think
13:11technomancycYmen_: usually it says something like "failed to start repl"
13:11cYmen_Yeah, as I said I hate error hiding behavior.
13:11mmitchell... trying desperately to find a single tag, update an attribute and re-render the doc as html
13:11technomancycYmen_: but if you do something like change :source-paths of course Emacs can't tell you what went wrong
13:11technomancy(no idea what the actual problem was in this case)
13:12cYmen_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:12technomancypresumably you'd know what it was if you went to the trouble of changing it
13:13cYmen_yeah
13:14technomancybut 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:16cYmen_Well, it may sound ridiculous but I don't have the overview to know that.
13:16technomancyyeah, that's why I usually recommend sticking with lein repl if you're new to the tools
13:17technomancytoo many people try to learn emacs and clojure at the same time, and that never works out well
13:17cbp_the console is a terrible text editor though :/
13:17cYmen_You're probably on to something...
13:18cYmen_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:18technomancycbp_: (require 'my.ns :reload), ctrl-up, enter, etc =)
13:18technomancyerr... just regular up
13:18cbp_that's fine when everything you're doing is 1 line long :-P
13:19technomancysure... 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:21cbp_Maybe light table could be hacked into being a sort of DrClojure
13:21FrozenlockcYmen: I would never use clojure without lein
13:21cbp_Just open it and here's a repl and a file, go nuts.
13:21FrozenlockI love the magic stuff
13:21technomancycYmen_: I'd certainly be interested in hearing more about common failure cases that newbies encounter.
13:22technomancythe fact that cider fails to propagate error messages is pretty lame too, maybe you could open a bug report
13:22hlshipIn (ns), is there any move to deprecate :use? I keep seeing :require w/ :refer :all which ASFAIK is the same thing.
13:23technomancyhlship: I think it's on the block to be deprecated as soon as anything can be deprecated, which might be never.
13:25bitemyapplol: https://pbs.twimg.com/media/BjgjViwCQAE7efs.jpg:large
13:25technomancyI wouldn't worry about fixing existing :use nses, but I certainyl wouldn't be writing any new ones
13:25hiredmanor using :refer :all, since it negates the benefits of require over use
13:33hlshiptrue about :use, I tend to only (ahem) use it in test namespaces
13:33hlshipon the Really Big Project, I pushed that we switch from :use to :require and it's helped everyone
13:45bitemyapphlship: :use is a good way to get put on the naughty list.
13:51devnbitemyapp: you were featured in Mark Engleberg's instaparse talk
13:55bitemyappdevn: I know, I linked the image above :)
13:55bitemyappdevn: btw: https://gist.github.com/bitemyapp/8739525
13:57mmitchellAnyone know how i can configure Enlive to *not* mess with my element attributes?
13:58justin_smithmmitchell: is it just reordering them, or actually messing with the contents?
13:59mmitchelljustin_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:02justin_smithmmitchell: is an attribute that isn't a k/v pair even valid?
14:02mmitchelljustin_smith: according to Google and their AngularJS framework, I guess so
14:04mmitchellit 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:05cbp_it's not xhtml valid but it's valid html :-P
14:07justin_smithis this "attribute minimization"?
14:08justin_smithif so, <div ui-view> and <div ui-view="ui-view"> should be identical
14:12rasmustoI'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:13rasmusto(using cider)
14:13justin_smithrasmusto: by default nrepl is localhost only
14:14justin_smithyou can use an ssh tunnel
14:14justin_smithI wouldn't recommend making an nrepl port open
14:14justin_smithssh -L ...
14:15justin_smithit would be cool if tramp had a tunnelling alist config (for all I know it may actually have one...)
14:18rasmustojustin_smith: ok, thanks.
14:18rasmustoYeah, I wouldn't want the port open
14:23turbofailoh 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:24irctcis there another big Clojure-centered confernece happening this year?
14:24irctcor is Clojure/west the big daddy
14:24justin_smitheuroclojure also happens
14:24irctcwhen is that
14:25justin_smithhttp://euroclojure.com/2014/
14:25justin_smithlooks like June 26 - 27, in Krakow
14:25irctcthanks
14:25justin_smithwhich is a cool place to visit
14:25irctcfor sure
14:25irctcwent to Paris last year, met some neat Clojure users, they inspired me to pick it up
14:36gtrakirctc: clojure/west is the west of the US, not the world. we also have clojure/conj in the east.
14:36irctcdo you think there will be more Clojure jobs moving forward in the future?
14:36irctcto pose n insanely general question
14:38nightflyyes, for an insanely vague answer
14:39irctchehe i like that answer
14:39irctcAll the jobs I see seem to be centered in NYC or the Bay area
14:39irctcI am hoping more places around the world start adopting Clojure in production
14:40zspencerI'm working from home on clojure
14:40zspencerand we are hiring
14:40irctcthat is great
14:40irctcreally?
14:40irctcvery cool
14:40zspencerYea, we don't advertise because we suck at marketing
14:40irctcgood to hear
14:40zspencerAlso we seem to be growing at an absurd rate; probably 100 devs by next year.
14:40irctcwow
14:41irctchow experienced do you guys require your new devs to be?
14:41hyPiRionzspencer: 100 devs or 100 clj devs?
14:41zspencer100 clj devs
14:41hyPiRionwat
14:41irctcI always think it is interesting to think about it when a language or technology is less than a decade old
14:41zspencer80% of our code is clojure/clojurescript
14:41TravisDFor multiline docstrings, is it customary to indent the lines so that they all start in the same column?
14:41hyPiRionwoah, which company?
14:41zspencerhttp://Outpace.com
14:42zspencerThough, to be frank, "clojure dev" is being used in this ocntext to mean "people who are writing clojure" ;)
14:42zspencersince I'm by no means a clojure expert
14:42hyPiRionyeah, sure thing
14:42zspencerHowever most of our devs have 8+ years of dev experience in a variety of languages
14:42irctccool
14:43zspencerTravisD: Yes, multiline docstrings should line up nicely (IMHO)
14:43zspencerI don't know i there's a pep8 for clojure that explicitely states that however
14:45TravisDzspencer: 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:46hyPiRionTravisD: I do it the way emacs indents docstrings. Pretty sure that's the way it's done in clojure.core and Leiningen
14:46hyPiRionso it's like
14:47TravisDhyPiRion: Awesome, is that what happens when you auto-fill a comment string
14:47hyPiRionTravisD: 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:51TravisDhyPiRion: awesome, yeah. That's convenient :)
14:55fro_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:56gtrakfro_: seen core.async yet/
14:56gtrak?
14:57fro_yes, I have
14:57clojurebotPardon?
14:58gtraklamina, storm, pulsar might also be of interest
14:58fro_thx
14:58fro_I will see
14:58gtrakand I think JBoss immutant has some coordination stuff.
14:58fro_and it's able to deploy standalone?
14:59gtrakit's an app server itself.
14:59fro_even whithout jre?
14:59gtrakah, well, you might have to do that part yourself.
14:59gtrak'synchronous messaging, caching, scheduled jobs, XA transactions, clustering, daemons and more'
14:59gtrakyou can bundle a JRE with an app
14:59gtrakbut that's not a clojure-specific thing
15:00fro_ok, that java-specific, I'm not a java programmer actually
15:00fro_ok, I'm glad to now, that it's real
15:01gtrakah, yea, anything in clojure is going to require a Java VM runtime. there's lots of ways to distribute java apps
15:01fro_and can be done
15:04`cbpwell you can use http-kit for websockets but I don't know what the rest of your requirements mean
15:04gtrakjetty has websockets too :-)
15:15TravisDIs there a way to have one protocol require another? Like, some type must first be an A before it can be a B
15:17ptcekhow 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:18ambrosebsTravisD: that's not how they're intended to be used
15:18TravisDambrosebs: Ah, I was thinking this might be the case
15:20TravisDanyways, relocating now
15:20TravisDI'll be back in a bit
15:20gtrakptcek: looks like a combination of assoc-in and merge-with.
15:34ptcekgtrak: merge-with seems usable, gonna try something, thanks
15:34hlshipI'm giving speclj a whirl, based on a recommendation
15:34hlshipmostly nice, but there's a gap between the tutorial and the actual docs
15:34hlshipsome of the more interesting things aren't documented (well), such as stubs
15:35hlshipanyone know a more detailed tutorial?
15:42upwardindexHow not to include the whole goog library in the uberjar of my server?
15:46fu86hi
15:47Anderkentupwardindex: 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:47fu86I 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:48Anderkentfu86: work with File objects rather than strings?
15:48upwardindexAnderkent: 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:49Anderkentah, sorry, I was thinking clojure not clojurescript. Don't know how clojurescript does uberjars (what does it even mean for clojurescript to uberjar?)
15:49fu86Anderkent: 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:50Anderkent,(file "foo" "bar" "zip")
15:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: file in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:50vmarcinkohlship: 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:51Anderkent,(clojure.java.io/file "foo" "bar" "zip")
15:51clojurebot#<File foo/bar/zip>
15:51fu86Anderkent: thanks
15:53pbostromupwardindex: you have to turn on advanced compilation to get dead code elimination
15:53Anderkentpbostrom: upwardindex: actually now I think he means that the code used to compile clj->js is contained in his *server-side* uberjar?
15:54upwardindexpbostrom: My project is :aot :all and :omit-source true, but my uberjar is still full of .js files from the goog library
15:54hiredmanvmarcinko: 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:54Anderkenthm 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:55pbostromyeah, I would think you build cljs first then uberjar the compiled js
15:57vmarcinkohiredman: 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:58pbostromupwardindex: 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:59upwardindexpbostrom: lein-cljsbuild is compiling it, I guess I’ll need to talk to emezeske about this or perhaps dnolen or cemerick
16:03pbostromupwardindex: or just read the lein-cljsbuild docs, set ':optimizations :advanced'
16:04pbostromupwardindex: https://github.com/emezeske/lein-cljsbuild/blob/1.0.2/example-projects/advanced/project.clj
16:05pbostromupwardindex: note that if you use advanced compilation you need to have externs files for any javascript libraries you are using
16:06pbostromI wish there was a way to do dead code removal without munging, but I don't think you can
16:13upwardindexpbostrom: 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:14pbostromupwardindex: I would consider that dead code, which you can remove if you enable advanced optimization
16:15pbostromit's just the way Google Closure works, which cljs doesn't have much control over
16:15pbostromother than providing an interface to configure it
16:17upwardindexpbostrom: Oh my bad. I was convinced that :optimizations only affected the output file of the build. I’ll try it right now.
16:17pbostromupwardindex: actually, maybe I'm misunderstanding the problem; can you just tell me what you have optimations set to?
16:17rasmustojustin_smith: it looks like cider #489 added jack-in for tramp buffers (8 days ago), is this something you know about?
16:18justin_smithrasmusto: no, not at all - I've just been using ssh tunnels manually for ages now
16:18upwardindexpbostrom: I was running with :simple but I’ll switch it right now to fix the problem.
16:19rasmustojustin_smith: I'm wondering if it broke my ability to cider-connect to localhost:port on a forwarded port
16:19justin_smithoh, don't know at all
16:19pbostromupwardindex: I think I see what you're saying now, those are probably the intermediate build files the compiler leaves lying around
16:19rasmustoyou just do a -connect and give it localhost and the forwarded port#, right?
16:19rasmustoregardless of whether it's a tramp buffer or not
16:19justin_smithrasmusto: yeah, exactly
16:19pbostromupwardindex: sorry for the confusion, I guess uberjar should be configured to ignore them
16:20upwardindexpbostrom: 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:24pbostromupwardindex: try :uberjar-exclusions
16:24rasmustojustin_smith: got it working, seems pretty easy now :)
16:25justin_smithcool, what was the trick - just using the forwarded port directly?
16:25pbostromupwardindex: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L348
16:26rasmustojustin_smith: yeah, just used `ssh -f <remote> -L port:localhost:port -N`, then cider-connect to localhost
16:26rasmustoit even auto-completed the port for me since I was using a tramp buffer
16:26justin_smithnice
16:27rasmustoall of this to get around funky colors in the terminal mode of emacs
16:27rasmustohaha
16:27justin_smithindeed
16:27justin_smithit handles keys better in the X11 version too though
16:27rasmustoah, that's definitely true
16:28upwardindexpbostrom: Sweet stuff, it works great!
16:32hlshipvmarcinko: Stu Sierra's blog is on the money for me, "system as transient state"
16:32hlshipYou can see how that's evolving in Twixt; there's a map of configuration details that gets passed around a modded
16:33hlshipand then used to build the running system
16:33hlshipit can be more complex than that
16:33hlshipbut always less, less, less, complex than Java and DI
16:54devnBobSchack: you around?
16:55BobSchackdevn yep
17:35bitemyapphyPiRion: client or server?
17:35hyPiRionbitemyapp: yes
17:35hyPiRionmostly server though
17:35hyPiRionor, server first, I gues.s
17:36bitemyapphyPiRion: the most unified and mature stack is Yesod + Conduit (constant space, streaming IO) where one uses Conduit for any client-side ops.
17:37bitemyappNetwork.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:37bitemyapphyPiRion: 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:38bitemyapphyPiRion: Conduit is a general purpose library for streaming IO (any sort), this http facade is just a handy client.
17:38hyPiRionalright
17:38whodidthishow do i convert json into persistentarraymap with clojurescript core
17:38whodidthisin javascript
17:39bitemyapphyPiRion: tutorial on the client (and the rest of the server-side framework) here: http://www.yesodweb.com/book/http-conduit
17:39whodidthisif possible heh, am just wondering how to plug some application state into om's render-to-str in nashorn
17:40whodidthiswhich would be AWWsome
17:40bitemyapphyPiRion: cheers :)
17:41hyPiRionbitemyapp: thanks =)
17:41hyPiRion(inc bitemyapp)
17:41lazybot⇒ 16
17:41bitemyapphyPiRion: main thing right now is an ElasticSearch client library for Haskell. I want a *really* nice one.
17:41augustlwhodidthis: would be even cooler to not convert :)
17:41bitemyapphyPiRion: you see Engelberg's slide with me and ddellacosta on it?
17:41augustlsince nashorn JS can call into the JVM
17:41bitemyappI dunno if you fav'd it on twitter or not. Amused me.
17:43augustlwhodidthis: not sure how the interop would work there, though. And if it's cljs or om that would need to support it
17:43hyPiRionbitemyapp: the instaparse one?
17:43whodidthisi was thinking about evaling the om code from jvm
17:43augustlwhodidthis: since cljs is protocol driven, I suppose it's possible to just implement the protocols for the JVM types with cljs
17:43augustlwhodidthis: yeah, so am I :)
17:44augustlwhodidthis: would be nice if cljs knew how to work with the JVM types directly when running inside nashorn
17:44whodidthisyeah im pretty bad at understanding protocol code, i guess theres no simple function
17:44augustldnolen would know, but I guess he's offline due to Clojure/west :)
17:45bitemyapphyPiRion: da
17:45whodidthissuch man
17:46hyPiRionbitemyapp: I really enjoy instaparse, but stuff I have to parse is like 4-9GB large.
17:47whodidthisotherwise 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:47hyPiRionAnd instaparse isn't able to stream the ast, at least from last time I looked at it
17:47bitemyapphyPiRion: incidentally, Haskell has very good tools for that :)
17:48bitemyapphyPiRion: cf. http://hackage.haskell.org/package/aeson
17:48gtrakcheshire can stream
17:49hyPiRionbitemyapp: that's the reason I asked you for Haskell in the first place ;)
17:49gtraki believe...
17:49bitemyapphyPiRion: see here: http://hackage.haskell.org/package/attoparsec-0.11.2.1/docs/Data-Attoparsec-Text.html
17:49gtrakaha, parsed-seq
17:49bitemyapphyPiRion: sometimes people will prototype in Parsec, then push a production version in Attoparsec, but many are comfortable just starting with Attoparsec.
17:50hyPiRionah, I see
17:50bitemyapphyPiRion: if it wasn't obvious, Aeson is written in Attoparsec.
17:51bitemyapphyPiRion: some people will do streaming parsing in Conduit though, not unheard of at all, but Conduit isn't design-wise specific to parsing.
17:51hyPiRionah
17:51bitemyappthere'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:51bitemyappbut it's similar to Conduit, constant-space streaming abstractions.
18:00danielszmulewiczHow is this even possible? java.lang.Exception: No namespace: *ns* found
18:01bitemyappgood to see clojuredocs is still stuck on 1.3
18:01hiredman,(intern '*ns* 'foo)
18:01clojurebot#<Exception java.lang.Exception: No namespace: *ns* found>
18:03danielszmulewicz,(clojure/repl/dir *ns*)
18:03clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: clojure, compiling:(NO_SOURCE_PATH:0:0)>
18:03danielszmulewicz,(clojure.repl/dir *ns*)
18:03clojurebot#<Exception java.lang.Exception: No namespace: *ns* found>
18:03danielszmulewicz,*ns*
18:03clojurebot#<Namespace sandbox>
18:03Bronsaclojure.repl/dir is a macro
18:03hiredmandir is dumb, us ns-publics
18:03hiredmanuse
18:04danielszmulewiczhiredman: dumb indeed. Thanks.
18:05no6is it possible to overload anonymous functions?
18:06gtrakno6: arities, yes.
18:06Bronsano6: not using the #() syntax though
18:06technomancy,((fn ([] :no) ([_] :yes)) :overloaded?)
18:06clojurebot:yes
18:06gtrak,((fn ([x] x)) 4)
18:06clojurebot4
18:08gtrak,((fn wat ([] (wat 0)) ([x] x)) )
18:08clojurebot0
18:09no6as in, (fn ([x] (* x 2)) ([x y] (apply * [x y]))) ?
18:09hyPiRion,(map (fn wat ([[x]] x) ([[x & r]] r)) [[1] [1 2] [1 2 3]])
18:09clojurebot#<CompilerException java.lang.RuntimeException: Can't have 2 overloads with same arity, compiling:(NO_SOURCE_PATH:0:0)>
18:10gtrakboooo
18:11no6thanks
18:15danielszmulewiczI 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:16hiredmanfirst thing is, are you sure you need them?
18:17danielszmulewiczhiredman: When I'm asked if I'm sure, I always start to doubt.
18:17clojurebotGabh mo leithscéal?
18:17hiredmanI hear about people doing that kind of thing, but in however many years of using clojure I never have
18:18`cbpdanielszmulewicz: your own utility library. Not that that is a very popular solution
18:18justin_smithdanielszmulewicz: you can require the lib in a dev lein profile
18:18danielszmulewiczhiredman: Vinyasa has specialized in that kind of thing. Injecting >pprint, >doc, >source etc. in all namespaces.
18:19danielszmulewiczjustin_smith: Yep.
18:19hiredmanclojure will load the first user.clj it finds on the classpath
18:20hiredmanlein has the ability to specify profiles at the user level, so you have dependencies and plugins that get added everywhere
18:20`cbpOh i guess I misunderstood "always"
18:22danielszmulewiczhiredman: 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:26hiredmandanielszmulewicz: 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:27hiredmanwhich I guess would explain why I never use `source`, I would use emacs's jump to definition
18:29danielszmulewiczhiredman: 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:30hiredmandanielszmulewicz: sure, I am just musing aloud on why some people feel the need for things that I never have had a need for
18:34danielszmulewiczDoes the trick too: (defun dir-ns ()
18:34danielszmulewicz (interactive)
18:34danielszmulewicz (cider-interactive-eval "(>pprint (keys (ns-publics *ns*)))"))
18:35danielszmulewiczhiredman: Sure, jump to source is priceless.
18:45arohneris there a clojure/west room?
18:45arohnerand does anyone have a link to the mal source?
18:46technomancyhttp://p.hagelb.org/mal.gif
18:46arohnertechnomancy: ha
18:46technomancythat's all I got, sorry
18:46dsrxtechnomancy: clutch
18:47jcsimsarohner: https://github.com/kanaka/mal
18:48arohnerjcsims: thanks!
18:48arrdemlolz
18:48jcsimsarohner: np
18:49jcsimstechnomancy: that gif works reall well for the question
18:50dsrxthat was about the most perfect use of mal.gif i've seen
18:50arrdemit seems that erc-images doesn't support animated gifs..
18:50arrdemI'm sad
18:50turbofailis that from firefly or castle?
18:51jcsimsfirefly
18:51technomancyarrdem: did they ever add scaling?
18:51turbofailhm. i guess he does look younger there
18:51arrdemtechnomancy: it's in there, but I didn't get it to work
18:52arrdemtechnomancy: I've only got it turned on in here and in -social because of getting slammed with shock pics :c
18:52technomancycan't be too cautious
18:52technomancygifs on repeat would probably get pretty tedious anyway
18:53dsrxcould do click^Wselect to play
19:30brehauthuh. no finite domains in core.logic for cljs. thats a pain
20:31mheldI have a list of maps, how do I convert it into a single map?
20:32brehautmerge or merge-with
20:32brehautperhaps with a reduce
20:32mheldapply merge works!
20:32mheldthere we go
20:33mheldthere must be a better way but it works
20:33AimHereJust so long as you don't have a clash of keys
20:34mheld(apply merge (map (fn [k] {k (k config)}) [:db :user :password]))
20:35mheldoh, I guess I could've done some sort of get
20:35AimHereThat looks like a job for reduce, though most things are a job for reduce
20:36AimHere(reduce #(fn [m k] (assoc m k (k config))) {} [:db :user :password])
20:36mheldthat's probably the right way to do it
20:37AimHere(#(zipmap % (map (fn [k] (k config)) %)) [:db :user :password])
20:38mheldhah even better
20:38AimHereTMTOWTDI
20:38mheldgracias
21:18krasI 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:18kraszp is the zipper here
21:19krasHow do I go right from the first node which satisfies this
21:24scottjDid 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:28scottjactually 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:26rpmd30Does anyone have experience with clojure and storm version v0.9.1?
22:31brehaut~anyone
22:31clojurebotJust 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:31brehaut(in saying that, clojurewest is happening so answers may be thin on the ground)
22:35rpmd30That makes sense thank you
22:45pdkclojurebot you always know what's best for me
22:52kopasetikanyone here planning on going to lambda jam?
22:53FrozenlockWhat's happening at clojurewest? What am I missing for-yet-another-year?
22:56bostonaholic@kopasetik went to Lambda Jam last year and I'll be attending again
22:56zspencerbostonaholic: I'm planning on attending this year. Looks more interactive than normal confs.
22:57bostonaholicyeah, the "Jams" were awesome hands-on projects. working with super smart people
22:57pdkwhen is it scheduled
22:57bostonaholicwatching Joe Armstrong pair on Elixir for the first time was awesome
22:57kopasetikcool, it looks like it's a great opportunity to learn more about clojure via hands-on sessions
22:58bostonaholicI did the clojure workshop on "
22:58kopasetiklambdajam is in chicago july 22-23
22:58bostonaholicmacros" and it helped a lot
22:58bostonaholicwoops
22:59bostonaholicand the "Jams" were focused on AI and machine learning. language agnostic
22:59bostonaholichttp://www.lambdajam.com/
22:59zspencerSee, that's my kind of party. Programming with cool people on fun problems
23:00bostonaholicyup
23:00bostonaholiclearn you some haskell/scala/erlang whatevs
23:00zspencerHaskell, Erlang, Clojure are my list
23:01zspencerclojure seems tob e winning the "Hey, UI programming may not suck anymore" battle
23:01bostonaholicI'm over learning haskell
23:01bostonaholicElixir would be fun to tinker with
23:01zspencerbostonaholic: oh? why?
23:01bostonaholicyeah, writing ClojureScript with Reagent has been amazing
23:02zspencerI was poking at OM; I like the notions that REACT professes
23:03kopasetik!macro
23:03zspencerMaybe tonight is a Reagent and IPA night
23:03kopasetikjust seeing what the bot does here
23:04arrdem~source
23:04bostonaholic@zspencer heh
23:04patrickodis "Clojure Programming" by O'Reilly still a good resource 2 years later (http://amzn.to/1rrpCn6) ?
23:04bostonaholicnot 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:05brehautpatrickod: yes, i think so
23:05zspencerSo, I'm torn. I actually really like JSX syntax for the dom definition
23:05zspencerand reagent looks reasonable in that regard
23:05patrickodthe other book that people seem to recommend highly is "The Joy of Clojure"
23:05zspencerI'll withold judgement for now
23:05brehautthe joy of clojure is excellent
23:05brehautpatrickod: but its drinking from the clojure firehose
23:06patrickodtoo much too soon eh?
23:06brehautpatrickod: it depends on your background
23:06patrickodwhat sort of background does it favour?
23:06brehautpatrickod: ideally you have some sort of lisp and or functional programming experience
23:07brehautdoesnt have to be heaps
23:07patrickodno lisp background. i try to keep my python pure though :)
23:07brehauthaving a dynamic language background can work with it
23:08brehautdepends how fast you pick up languages
23:08brehautit wont hold your hand
23:08arrdemI learned from JoC
23:08arrdemand bugging amalloy and techn0mancy and others in chan.
23:09brehautas did I, JoC is a great book
23:09brehautFogus’s Functional Javascript makes a great primer for JoC
23:09wafi think JoC has a new edition coming out in the next few weeks
23:10brehautthat sounds right
23:10brehautthe publisher has an associated deal
23:10MC-Escherichiai 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:14brehautpatrickod: 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:16arrdembrehaut: 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:16arrdemthere was a solid three weeks that I was totally paralyzed by the lack of side-effects :P
23:16brehauthaha
23:17patrickodI've been trying to familiarize myself with clojure by writing a very simple project with it the last while
23:17brehautthats a good approach
23:17patrickodbut I feel like I'm just haphazardly discovering some of clojure's ideas / features
23:17arrdempatrickod: I mean.. that's the best you can do
23:17arrdempatrickod: and your first code is gonna be crap :P
23:17brehautpatrickod: have you read clojure.org ?
23:17brehautits terse yes but it does cover everything
23:17patrickodarrdem I'm reading a style guide here on GH trying to make it look less so
23:18arrdempatrickod: awesome.
23:18patrickodbrehaut I've kept clojure.org open throughout the process but not sat down to exhaustively read it
23:18arrdemclojure.org could use a lot of work....
23:18arrdemthe cheat sheet is the only thing that I ever used heavily
23:18brehautpatrickod: 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:19patrickodI've been taking inspiration from the clojars.org source code as "idiomatic"
23:19arrdempatrickod: what are you looking to do in Clojure?
23:20patrickodat the moment I'm writing a small SMS service using Twilio as the provider
23:20patrickodbasically it listens for inbound webhooks, decides what to do, and spits it out to Twilio again
23:20brehautthat seems like a decent first project
23:20patrickodit's an SMS tumblr. You send an SMS in and a random recipient in the group receives it on the other side
23:20brehautring etc and clj-http
23:20arrdemdefinitely
23:20patrickods/tumblr/tumbler*
23:21arrdemit just means I won't share the weird stuff I've built with Clojure because it isn't relevant :P
23:22arrdembut if you want a "how not to api" and "how to refactor a first clojure project", :P
23:22arrdemhttps://github.com/jphackworth/cryptick/pull/5
23:22brehautarrdem: 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:23brehautand like much of the clojure documentation it favors brevity
23:23arrdembrehaut: 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:23brehautarrdem: right, but a language reference is different to api documentation
23:23brehautits certainly a blurry distinction with a lisp
23:24brehautbut nevertheless
23:24arrdembrehaut: IMO clojure as a language needs a spec, this being equivalent to docs over the entire ST:
23:24arrdem*STL
23:24arrdemtake with a grain of salt the size of a brick
23:24arrdemand a shot of vodka
23:26brehautarrdem: i think theres an interesting dualism to the design of most lisps that makes a formal spec an interesting and problematic challenge
23:26brehautin practise most of the the language is bootstrapped
23:27arrdemyarp
23:27brehautso 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:27arrdemIMO you hide the latter and spec the former
23:27arrdemI don't consider "clojure" to be the kernel that's used in bootstrapping
23:27arrdemI consider "clojure" to be the STL that I work with on a daily basis
23:27brehautright, and that would also force implementation details to end up being specs
23:28brehautbut then you end up with just an API document which is less interesting as a spec than in another language
23:28arrdemI disagree. It would seem to me that by writing an API spec you may canonize "first platform" idiosyncracies..
23:28arrdembut you make it easier for nth platforms to match the first
23:28brehaut(and infact if you look at the doctypes for a lot of the bigger features like deftype it _is_ specced
23:29arrdemmy 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:30arrdemwhich is meaningless on Clojurescript
23:30arrdemby no means do I pretend to offer informed argument on any of this
23:30arrdemyou're way more senior than I am
23:30arrdemthis is just what sticks out to me.
23:30brehautyeah that cljx thing is interesting; good old trade offs
23:31brehautclojure and clojurescript would be much worse in a lot of ways if they obscured the host
23:31brehautbut but exposing it, there are definate problems to deal with
23:31brehautanyway i need to head
23:32MC-Escherichiain 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:55Frozenlockbostonaholic: Om hurts my brain :-p
23:55arrdembraaaaaaaaainz
23:56bostonaholicgive Reagent a shot
23:56FrozenlockThat's what I'm using
23:56bostonaholicI can't say if I like it better because I haven't tried Om, but I do like Reagent
23:57Frozenlock-> because Om hurts my brainzzz!
23:57zspencerYea, initial pass today is "Reagent looks nicer than om"
23:57zspencerBut it could just be the compelling examples
23:58FrozenlockThose two are great with Reagent https://github.com/alandipert/storage-atom https://github.com/Frozenlock/historian (probably with Om too)
23:58FrozenlockBtw, let me know if there's a more advanced undo library, I haven't found any :-/
23:59bostonaholicwow, historian looks cool