#clojure logs

2013-09-20

00:13coventryIs there a history to (aset) not being called (aset!), despite mutating its argument?
00:16brehautcoventry: i would assume that its a) accidental b) implied because you are dealing with a mutable structure anyway.
00:16brehautcoventry: however, ! does not mean the same thing it does in say scheme; in clojure its specifically not safe for retrying
00:17brehautcoventry: (eg in the context of a transaction)
00:17brehauteg send (to an agent) is safe but swap! (on an atom) is not
00:19coventryAh, right. Thanks.
00:36iamjarvowhat is the simples way to get Time.now ? using clj-time?
00:37jared314(now)
00:39iamjarvojared314: thanks
00:39iamjarvoi should update all the stack overflow threads haha
00:42indigo(later)
00:50indigo,(now)
00:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: now in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:51jared314(clj-time.core/now)
00:51indigoAh yes, of course
00:53havenwoodJust an aside, but really liked Clojure's `time` function :D so implemented it in Ruby for a bit of sweet benchmarking sugar: https://gist.github.com/havenwood/6632658
00:54havenwoodWas curious why `time` reports "msecs" instead of typical "ms" initialism. Is there a logic behind it or just happenstance?
00:55havenwoodhttps://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L3493-3501
01:12iamjarvothoughts on the day-name fuction ?http://pastie.org/private/x7cfwbrjaditm3ibpphvpg
01:13iamjarvowasnt sure if i should pass it in or just calculate it when called
01:15chordok fine you guys don't want to help me make starcraft clone in clojure
01:15chordI'll do it myself
01:15chordwhats the best link to start learning clojure
01:16jared314iamjarvo: I thought there were constants for weekdays
01:17iamjarvojared314: note sure i googled and didnt find anything
01:17iamjarvoi didnt find the (now) because i was looking at a fork i think
01:22jared314iamjarvo: Sorry, I was thinking java (.getWeekdays (java.text.DateFormatSymbols.))
01:25jared314iamjarvo: you could do an (aget (.getWeekdays (java.text.DateFormatSymbols.)) (day-of-week (now)))
01:27iamjarvoseems less clean
01:28jared314i also think it has an off by one error on my part
01:28iamjarvoi guess it can be wrapped in a function
01:28iamjarvoahh i see
01:31chordi need starcraft
01:31chordsomeone help me make it
01:32iamjarvojared314: what is the web app development ecosystem like with clojure?
01:33Apage43i just run the commercial distribution of starcraft
01:34chordapage43 but starcraft 2 sucks shit
01:34chordwe need to make a true spiritual successor to starcraft
01:36jared314iamjarvo: can't answer that. I use enlive, composure, dieter, and friend (when I have to)
01:36iamjarvoahh i see
01:37jared314iamjarvo: i have not used pedestal yet, so it may be good
01:37iamjarvowhat do you use the language for?
01:38jared314iamjarvo: i'm still working on that
01:38iamjarvokk
01:56jared314iamjarvo: (.toString (now) "EEEE")
01:58iamjarvowill get the weekday?
01:59jared314(.toString (now) "EEEE") ;=> "Friday"
01:59iamjarvowhat is the "EEEE" about?
01:59jared314http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
02:36ddellacostahmm, I'm not going to be able to call reduce on a (CLJS) PushbackReader, am I?
02:39ddellacostaI guess it has to implement...IPersistentCollection?
02:39ddellacostahmm
02:40jared314ISeqable?
02:43jared314you could try extend-type with ISeqable
02:43ddellacostajared314: yah, is that it? In any case, I'll just use a loop/recur, but I was thinking it would have been nice to reduce.
02:43Apage43ddellacosta: what behavior are you expecting, exactly?
02:43Apage43There might be something that does what you want
02:44ddellacostaApage43: ah, I just wanted to avoid using a loop/recur structure since I'm basically reading through all the strings in a edn-formatted string and converting them to a vector of maps.
02:44Apage43repeatedly might be handy here
02:45ddellacostaApage43: I mean, it's not like it's particularly bad, I just prefer reduce when I can use it. But since I'm not dealing with a collection it doesn't make much sense…I suppose I could extend StringPushbackReader but not sure it's worth it.
02:45Apage43&(doc repeatedly)
02:45lazybot⇒ "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
02:45Apage43or whatever the heck
02:45ddellacostaApage43: ah, interesting...
02:46ddellacostaApage43: so, I can kind of imagine how I would use that, expect for the part where I conj each successive result to an existing vector. Seems like I'd end up with a similar construction to a loop/recur pattern, if I'm not mistaken.
02:47ddellacostaanyways, I'm probably trying too hard to get something cleaner than it really needs to be.
02:47Apage43(into your-vector (take-while (still-have-stuff?) (repeatedly (get-stuff))))
02:48Apage43actually that's kind of bad
02:49Apage43(into your-vector (take-while identity (repeatedly #(if (more-stuff?) (get-stuff)))))
02:49Apage43perhaps
02:50Apage43no idea what I'm on about here, I'm just barfing code
02:50ddellacostaApage43: haha…
02:50ddellacostaApage43: no, I appreciate the attempts. I have to absorb these techniques and see if they are applicable.
02:51Apage43anyway (into collection other-collection) will conj all the things in other-collection into collection and return it
02:51Apage43,(into [1 2 3] [4 5])
02:51clojurebot[1 2 3 4 5]
02:51Apage43,(into (list 1 2 3) [4 5])
02:51clojurebot(5 4 1 2 3)
02:51Apage43using reduce on the inside
02:53borkdudeIs there something for edn datastructures which prints nested datastructures like a tree/directory structure like this? http://mbraak.github.io/jqTree/#introduction
02:55Apage43if it's just for personal inspection, there's clojure.inspector/inspect-tree, but it's a semi-clunky swing thing, not a html pretty-viewer
02:56borkdudeApage43 normal text would be ok too, just from the repl
02:56Apage43clojure.pprint/pprint ?
02:56borkdudeI often need to search in a list of maps, which gets hard when they are printed all on the same line for example
02:56borkdudethen this would be useful
02:56Apage43you want pprint
02:57Apage43also lives in clojure.repl
02:57borkdudeApage43 sure, but say I have a list of maps with 100 keyvals each, how do I print them nicely?
02:57Apage43ah
02:57borkdude10 keyvals each is more realistic sorry
02:57Apage43are they all the -same- keyvals in each map, and how many are there? If yes, and not many, clojure.pprint/print-table might be what you're after
02:58borkdudepretty much the same keys yes
02:58jared314are you talking about the json on the left, or the collapsable widget on the right?
02:58ddellacostaApage43: so, going back to your example, the main issue is this part: #(if (more-stuff?) (get-stuff)). The "get-stuff" function is mutating the actual thing it's getting data out of. It doesn't know it's done until it gets a nil (or throws an error, if you don't turn that off. I mean, it's a PushbackReader.
02:59Apage43yeah
02:59Apage43I'd write
02:59ddellacostaApage43: otherwise, that is an awesome way to do it. :-p
03:00Apage43(take-while identity (repeatedly #(read {:eof false} your-reader)))
03:00borkdudehmm print table works, I think only when the first maps contains all the "columns"
03:00Apage43or, more correctly
03:00borkdudejared314 on the left would be ok
03:00ddellacostaApage43: the thing is, I'm already returning nil…shouldn't that fail out as is? Confused by how repeatedly behaves in that case.
03:01Apage43(let [eof-sentinel (Object.)] (take-while #(not= eof-sentinel %) (repeatedly #(read {:eof eof-sentinel} your-reader))))
03:01Apage43if you want to be able to read false
03:01Apage43ddellacosta: yeah, nil works as well as false
03:02borkdudeyesterday I had a case in which false should be treated as a value, instead of nontruthy.. very confusing
03:03ddellacostaApage43: thanks, I'm starting to get it. Very helpful!
03:03borkdudehttps://github.com/myfreeweb/clj-configurator/pull/2
03:04Apage43heh, that Object. sentinel truck probably doesn't work in CLJS though
03:04Apage43but if you don't need to read falsy things, you should be fine
03:07Apage43borkdude: In the past I've just copied print-table and modified it. It's a nifty piece of code to look at anyway
03:07Apage43https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/print_table.clj
03:08Apage43you'll also notice you can hand it a list of keys
03:08Apage43(print-table [:k1 :k2 :k3] list-of-maps) will print a table with those keys
03:08borkdudeApage43 ah you can pass the keys you want to see… this is what I need… again ;)
03:08Apage43(and only those keys, so its nice for getting a filtered view)
03:09borkdude,(clojure.pprint/print-table [:dog :goo :extra] [{ :dog 123 :goo 123} {:dog 123 :goo " dude" :extra 4}])
03:09clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint>
03:09borkdudenice
03:10ddellacostaApage43: don't think it's gonna work. repeatedly is lazy and returns an infinite sequence, and take-while expects a collection. But, there is probably a related technique I can use. Will keep playing with it.
03:12Apage43take-while is lazy
03:12hashcatHi, Can I get a return type and parameter types of a function?
03:12Apage43it only realizes one more element than it passes out
03:13hashcatIt may be (type-parameters +) [Int,Int]
03:14ddellacostaApage43: hmm, okay, I see.
03:14ddellacostaApage43: yes, clearly I can pass take-while an infinite lazy sequence. Hmm. So it is something up with the way I'm doing this...
03:16Apage43(cf +) => (Fn [t/AnyInteger * -> t/AnyInteger] [Number * -> Number])
03:16Apage43(in clojure.core.typed, anyhow)
03:17hashcatApage43: Thanks a lot, I've tried meta and reflect for several hours
03:18Apage43well, that again, is only a feature of clojure.core.typed, an optional type system as a clojure *library*
03:18Apage43not part of the core
03:18ddellacostaApage43: there we go: (into [] (take-while #(not= nil %) (repeatedly #(cljs.reader/read my-reader false nil false))))
03:19Apage43regular clojure is not statically typed
03:19Apage43aww yeah!
03:20hashcatdid that mean I can't get valid parameters of a function in core lang?
03:20Apage43I haven't really touched cljs much, glad it worked
03:20Apage43hashcat: correct
03:20Apage43other than by looking at its docs
03:20ddellacostaApage43: yeah, thanks very much, again. :-) This is much nicer than what I had before, and still easy to read.
03:21hashcatApage43: thanks again, I'm trying to generate a valid expression of clojure code randomly :)
03:21Apage43huh
03:21Apage43interesting problem
03:22borkdudecould it be that the github app fetches commits from other branches in the background?
03:23borkdudeI mean, I never pulled or fetched commits from some branch I was not working on, yet I could reset to the head of the most recent commit which I didn't pull in
03:23Apage43i have no context for that comment, but I think it does something like that
03:23Apage43basically the equivalent of typing "git remote update"
03:23Apage43which fetches all branches from all remotes
03:24borkdudenice, thanks
03:25Apage43a bit of a guess, but I figure the messages it pops up telling me there are new commits on a project it's tracking come from somewhere
03:26borkdudeyes
03:26Apage43either a request to the github api or just actually fetches them and checks locally, both are pretty reasonable, but the fetch & check seems like it has some nice side effects
03:26borkdudegtg for a moment
04:33chordSTARCRAFT CLONE IN CLOJURE
04:33chordJOIN ME MY FRIENDS
04:39chordis anyone going to answer my call?
04:45ddellacostachord: lead by example
04:46chordi'm not an expert at clojure :(
04:46ddellacostachord: well, then I guess you've got some studyin' and practicin' to do! Good luck.
04:47ddellacostachord: anyways, sounds like a great way to become an expert, huh?
04:50chordddellacosta: you going to train me in clojure?
04:50ddellacostachord: no
04:50ddellacostachord: although, I'll consider it if you pay me enough
04:51clgvchord: there are pretty decent books that can give you a headstart learning clojure ;)
04:53chordclgv: what is the best book to start learning clojure
04:53chordddellacosta: train me in clojure and you get part control of starcraft clone that should pay
04:54clgvchord: the most up-to-date good book is imo "Clojure Programming"
04:54chordclgv: do I have to pay for that?
04:55clgvchord: it costs only around 30 euro. yeah you have to otherwise Chas will haunt you :P
04:56chordclgv: nope not paying
04:56chordclgv: fuck it too late already searching for warez
05:01chordclgv: can you find me a download copy of the book for free
05:02clgvchord: definitely not!
05:02chordclgv: why not
05:04Apage43I'll find one for $36 US ;)
05:06clgvApage43: I rounded up the price I found on amazon ;)
05:06muhoooh for fuck's sake, latest nrepl.el bound C-c C-c and screwed me over, i was using it as a prefix for a bunch of commands
05:06muhoo(local-unset-key (kbd "C-c C-c")) isn't working
05:07Apage43I was looking at o'reilly. And noticed they'll deliver it straight to my Dropbox, which is nifty
05:11seangrov`ddellacosta: ping
05:12ddellacostaseangrov`: pong
05:12ddellacostaseangrov`: what's up?
05:18seangrov`ddellacosta: Curious to hear your idea (or get some couter-ideas) on our pre-clojure cup idea
05:19ddellacostaseangrov`: sure, definitely! Would love to hear.
05:21seangrov`ddellacosta: Our team is all traveling the actualy ClojureCup days, but we're thinking about taking two days beforehand to do it on our own. Thinking about building an open-source error reporting service (airbrake, errbit) and cljs library so that errors are reported to a clojure server that matches it to the correct source map, so you can collect client-side errors from users in production code and trace it back to the original code.
05:22schmirmuhoo: try (define-key nrepl-mode-map (kbd "C-c C-c") nil)
05:23ddellacostaseangrov`: how does this part work: "so that errors are reported to a clojure server that matches it to the correct source map…" does this mean you send the source map along with it, or it's sent at CLJS compilation/registration/whatever time, or am I fundamentally misunderstanding?
05:24seangrov`On deploy, you would send the sourcemap and a random hash (or deterministic) to the error reporting server
05:24seangrov`Then in clojurescript, you would report variables with a try/catch and the same hash
05:24seangrov`The hash would be written at deploy time via some lein plugin
05:24ddellacostaseangrov`: I see, the hash is your application key?
05:24seangrov`It's the source version
05:25ddellacostaah, okay, gotcha...
05:26ddellacostaseangrov`: I like it. So, am I correct that a source map is going to help you even if you are using advanced compilation? I still haven't played around with them yet.
05:28seangrov`ddellacosta: Exactly
05:28seangrov`So you can use them in production, but not expose your code to clients
05:28ddellacostaseangrov`: I don't have any good criticisms or additional thoughts at the moment. Will let it settle for a bit. I think it would definitely be useful to catch edge-case runtime errors that are hard to simulate/test on your own.
05:29seangrov`And now you get visibility into client-side errors with trace-backs to the original code (and version of the code) that cuased them
05:29ddellacostaseangrov`: along those lines, it would be great to get instance data back as well, but that could be pretty tricky depending on what is secure/private/etc.
05:30ddellacostayou'd want to anonymize anything like that. For an initial version I can see that you would just want to avoid that completely I suppose.
05:31clj_newb_2345does clojure have any "erlang" style shared nothing programming style for clojure progs that run across multiple JVMs (on different machines)?
05:31seangrov`ddellacosta: I think getting browser version, etc is fine
05:31clj_newb_2345if so, what is a good tutorial / list of libraries
05:33ddellacostaseangrov`: yeah, I was talking more about debugging data…but that is problematic on a number of levels. Unfortunately, without seeing the specific data that triggered an error that can be hard. Conversely, if you *don't* sanitize/encrypt the errors you get back from the client over the wire, you may be violating privacy/etc. But I'm probably way over thinking it--we are always super concerned about these kinds of things, is why.
05:34seangrov`ddellacosta: (super-try ... (catch (report "message" {:data :you-care-about})))
05:35clgvclj_newb_2345: there was a lib for distribute refs using zookeeper. but apart from that I do not remember anything significant
05:35ddellacostaseangrov`: yeah, so, that would be the app developers responsibility? I suppose that makes sense...
05:40noidiclj_newb_2345, https://github.com/liebke/avout this is the lib clgv mentioned
05:42mercwithamouthwhat framework(s) do you guys like? i'm looking at compojure but i see there haven't been any updates in 4 months
05:44seangrov`ddellacosta: Just optional data to be sent if desired
05:45ddellacostamercwithamouth: compojure is pretty simple and stable at the moment.
05:45scottjmercwithamouth: compojure is highly recommended. maybe also checkout pedestal.
05:45philar #luminius #pedestal
05:46mercwithamouthddellacosta: hmmm good to hear! i haven't heard of pedestal...taking a look now
05:46ddellacostaseangrov`: gotcha. In any case, this sounds like it could be a nice service, one I would potentially be interested in!
06:05sm0keHow can i run my project such that it hot reloads changes,...and restarts if necessary?
06:06mpenetclj_newb_2345: there is exoref too for something more lightweight
06:16tadywkAhem
06:16tadywkis this on?
06:18clj_newb_2345clgv, noidi: thanks
06:19tadywkquit
06:19tadywkhah!
06:19tadywkIRC fail
06:26chordeveryone here is dumb or stupid?
06:31clgvchord: making friends on the fast track? :P
06:32chordclgv: you can't have friends without having enemies
06:33chordthe bad comes with the good
07:24sm0kehello i am using httpkit why there is no on-open event?
07:32bordatouehello, is anyone having problem with clj-getopts "0.0.2", I have added it to my class path and still couldn't load it using (require 'clj-getopts ) from repl. Getting FileNotFoundExcep ; any suggestions
07:33sm0kebordatoue: did you do 'lein deps'?
07:34bordatouesm0ke: yes, it appears in the classpath when i exec lein classpath
07:55wei_how do I get a long timestamp from an #inst?
07:59wei_,(.getTime #inst "2013-09-20T08:21:33.128-00:00")
07:59clojurebot#<SecurityException java.lang.SecurityException: denied>
08:03bordatouesay if I have a library clj-getopts , how do I know the name of its class to load in repl
08:06TEttingerbordatoue, it's probably in the docs for the clojure lib you are using
08:06TEttingerclj-getopts
08:07TEttingerand you'll probably need the ns (namespace) not the class
08:07bordatoueTEttinger, I couldn't find the doc for some libraries I've downloaded from clojar. For example clj-getopts
08:08bordatoueTEttinger, I need to know what I have to load in the name space for a library downloaded from clojar. Is there any way to find out list of namespace that is applicable for a library
08:08TEttingerit looks like that is an outdated lib, not sure yet
08:08francis_wolkeGoogIing didn't turn up any PL channels on IRC. Would anyone know an appropriate place to ask " From a technical standpoint are there any reasons to not use s-expressions
08:08francis_wolke when desgining a programming language?. More concretely, is there anything
08:08francis_wolke you lose the ability to express that another syntactical scheme offers?"
08:10TEttingergaaaah
08:10TEttingerhttps://github.com/kognate/clj-getopt
08:10TEttingerfrancis_wolke, s-exps are really handy for any language that uses macros.
08:11TEttingerif you don'y have macros, eh, they're still very powerful
08:11bordatoueTEttinger, in the readme file author doesn't say anything about loading a .clj file
08:11TEttinger(ns clj-getopts.core
08:11TEttingerit's kinda a badly named github repo
08:12francis_wolkeTEttinger: Indeed. However, people continue to create languages that don't use sexps. I am essentially trying to find out if there is any legitimate technical reason for doing so - other than "ease of implementation" or "readability"
08:12bordatoueTEttinger, how did you find it out
08:12TEttingerbordatoue, looked at the first line of the source
08:12augustlfrancis_wolke: I hear "but the customer is able to read my Java/Groovy/Ruby/.. code" a lot :)
08:12TEttingerhttps://github.com/kognate/clj-getopt/blob/master/src/clj_getopts/example.clj
08:12bordatoueTEttinger, nice
08:13bordatoueTEttinger, I was thinking about listing in files in .jar and then trying it in repl
08:13TEttingerheh, you can also extract a jar
08:13TEttingerthe folders correspond to parts of namespaces
08:14bordatoueTEttinger, looking at the source for a library to figure out the loading class isn't always possible
08:14TEttingeryeah, but clojure often has source in the jar
08:14bordatoueTEttinger, even when you do uberjar
08:14TEttingernot sure
08:15TEttingerI think it can be set in project.clj
08:15bordatoueTEttinger:, thanks very much
08:15TEttingerno prob
08:16TEttingerset up my grandpa's old computer with a new HD, no dust, and linux mint, giving it to someone who only uses the internet, and will love not getting viruses through email
08:17TEttinger(older less technical relative)
08:19TEttingerI feel good about helping two people tonight
08:25seangrov`How can I test if something is a boolean?
08:26seangrov`I explicitely want to check for boolean
08:26Bronsaseangrov` boolean as opposed to Boolean?
08:32mpenet,(instance? Boolean "a")
08:32clojurebotfalse
08:33hyPiRion(some-fn true? false?) is also nice, I think
08:33hyPiRion,(let [boolean? (some-fn true? false?)] (map boolean? [true false :a 1 "ten"]))
08:33clojurebot(true true false false false)
08:34Bronsa#{true false
08:34Bronsa#{true false}
08:34mpenet,(contains? #{true false} false)
08:34clojurebottrue
08:34mpenet:)
08:34hyPiRionBronsa: was about to say that (#{true false} false) returns false :)
08:35hyPiRion,(contains? #{true false} (Boolean. true))
08:35clojurebottrue
08:35mpenetbut instance? seems like the same choice
08:35mpenetsane*
08:35hyPiRionwhat
08:35hyPiRion,(true? (Boolean. true))
08:35clojurebotfalse
08:35mpenetthe Boolean constructor is evil
08:36Bronsa:|
08:36Bronsaoh.
08:36hyPiRionI love it. It makes wonderful problems
08:36BronsahyPiRion: true is a Boolean/TYPE
08:36Bronsapersistentcollections box their items
08:37mpenet,(Boolean/valueOf false)
08:37clojurebotfalse
08:37mpenet"Returns a Boolean instance representing the specified boolean value." I wonder what's the use for this
08:37mpenet
08:37hyPiRionBronsa: ?
08:38hyPiRion,#{(Boolean. false) false}
08:38clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: false>
08:38sm0keguys any good intro to core.async?
08:38hyPiRion,(false? (first #{(Boolean. false)}))
08:38clojurebotfalse
08:38mpenetsm0ke: https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj this is relatively good
08:39BronsahyPiRion: false? tests for Boolean/FALSE that is a boolean not a Boolean
08:39Bronsawhen you put a boolean in a collection, it get boxed to a Boolean
08:40sm0kempenet: anything on the background for lib? i mean is it like golang model? csp? actor model? etc..some literature with examples would have been nice
08:41BronsahyPiRion: I'm not sure anymore of what I just said.
08:41sm0kewell i see its full of useful comments anyways
08:42sm0kealso is avout still in development? or any other project for distributed states?
08:43hyPiRionBronsa: I think I know the reason. (Boolean. true/false) returns a new boolean, whereas false and true gets boxed to Boolean/TRUE and Boolean/FALSE
08:44hyPiRion,(identical? Boolean/FALSE (Boolean. false))
08:44clojurebotfalse
08:44hyPiRion,(identical? Boolean/FALSE (Boolean/valueOf false))
08:44clojurebottrue
08:44BronsaI see
08:48mpenetsm0ke: it's modeled after golang and csp yes
08:50mpenetsm0ke: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html
08:50sm0kempenet: thanks!
08:53seangrov`Looking for a cleaner way of mapping and filtering: https://www.refheap.com/184e1baa1b12bbb59056286ff
08:53seangrov`Any suggestions?
08:56hyPiRion(for [[coordinate present?] (map vector coordinates is-present) :when present?] coordinate)
08:59seangrov`hyPiRion: that seems nice
09:03scottj(set (filter second (map vector all-coordinates present-coordinates))) ; does this work?
09:05scottjnevermind
09:05hyPiRionno, you'd have to unwrap the vector again
09:05mercwithamouthexit
09:06silasdaviswhen you have side-effecty stuff like in cheshire (add-encoder java.net.URL encode-str)
09:06silasdaviswhere's a nice place to put it
09:06silasdavisany principals?
09:06silasdavisles
09:09grnhi! what do you think about basing a startup on clojure?
09:11`cbpsilasdavis: I just put it in an init function of some sort
09:11hyPiRiongrn: I think it's smart, but be prepared to hire people not knowing Clojure, and that you may need to train them up after they're signed
09:11hyPiRion*they've
09:11`cbpsilasdavis: like somewhere inside -main
09:14jstewgrn: Basing a startup around a technology is probably a bad idea. Pick the right tool for the job. That being said, clojure might be the right tool for you.
09:15prof-freud\part
09:15prof-freudgah
09:15hyPiRionoh yeah
09:18p14ngrn: http://www.paulgraham.com/avg.html
09:18p14nmay be of interest
09:24sm0kehello which logging api is used commonly?
09:24sm0kein clojure?
09:25mdrogalissm0ke: It gets abstracted over. See clojure.tools.logging
09:25mdrogalisThe underlying library doesn't matter.
09:25sm0kethanks agains
09:30silasdavisin require I can't do (clojure [java.io :as io] [set :as set])
09:30silasdavisis there a concise way of adding subpackages?
09:31silasdavisseems I can't do (clojure (java [io :as io]))
09:33rurumateI want to do this: (-> [] (when (= 1 2) (conj 12)), but the result should never contain nil
09:33rurumate,(-> [] (when (= 1 2) (conj 12))
09:33clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:33rurumate,(-> [] (when (= 1 2) (conj 12)))
09:33clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$conj>
09:34rurumate(-> [] (conj (when (= 1 2) 12)))
09:34rurumate,(-> [] (conj (when (= 1 2) 12)))
09:34clojurebot[nil]
09:34rurumatesorry, that was what I meant
09:35rurumatethis is possible:
09:35rurumate,(-> [] (concat (when (= 1 2) [12])))
09:35clojurebot()
09:35rurumatebut it creates a vector around 12, which is a waste
09:37sm0kehello i have a (condp = v .....) block where i want v to match either (1) (2 or 3)(default)..the ugly part is how do i match(2 or 3) without repeating myself?
09:37silasdavisI think that your best option, nil can represent an empty sequence, but seems like you want it to represent a zero-length element
09:38sm0kei still dont understand why clojure doesnt have pattern matching?
09:38silasdaviswhich would give you difficulties when you really want to conj a nil element
09:38rurumatesm0ke: there is https://github.com/clojure/core.match
09:39rurumateso, is there a way to do a "conditional conj"? (like described above)
09:40rurumatesomething like (defn cconj [coll x] (if x (conj coll x) coll))
09:40silasdavisrurumate, you could write one, but I think the concat version is better
09:41rurumatethere should be something available here, imo. maybe flatland/useful has something
09:41silasdavisrurumate, are you worried about time or space?
09:42silasdavisI doubt they're very different
09:42silasdavisin fact I suspect the vector version might be faster
09:42silasdavisbenchmark it
09:42rurumatesilasdavis: both, of course; creating a vector without need is a waste of both
09:42silasdavisrurumate, cconj introduces an additional branch, and means your reader has to look up cconj
09:43silasdavisso the human time complexity is much worse
09:43rurumatesilasdavis: ok, then I guess I'm worried about space and gc here
09:44silasdavisyou could nil squeeze the final collection afterwards
09:44silasdavisor on consumption
09:44silasdaviswith a reducer
09:44silasdavis(remove nil? coll)
09:45xeqi&(cond-> [] (= 1 2) (concat [12]))
09:45lazybotjava.lang.RuntimeException: Unable to resolve symbol: cond-> in this context
09:45xeqi,(cond-> [] (= 1 2) (concat [12]))
09:45clojurebot[]
09:45mercwithamouthhrmm can someone explain 'reduce' to me like you would to a 5 year old? =P
09:45mercwithamouth(reduce max [0 -3 10 59])
09:45hitekihi
09:46mercwithamouth&(reduce max [0 -3 310 3144])
09:46lazybot⇒ 3144
09:46mercwithamouth&(max [0 -3 310 3144])
09:46lazybot⇒ [0 -3 310 3144]
09:46zakwilsonThat's probably not the best use case, as apply has the same result.
09:47zakwilsonReduce is "do something with the first two elements of this sequence, then the result of that and the next element and so un until you run out of elements"
09:48mercwithamouthzakwilson: ahh i see
09:48silasdavismercwithamouth, so you have an accumulator which is like a blank piece of tracing paper. You have a collection which is like a series of pictures. You get handed each picture in turn and you are allowed to trace parts of them on to your tracing paper one at a time. At the end you give me your tracing paper.
09:49zakwilsonThere's also an optional argument to use as a starting value, in which case reduce starts with that value and the first element instead of the first and secont.
09:49mercwithamouthsilasdavis: so basically reduce is like saying "give me a little bit at a time" ?
09:49xeqimercwithamouth: Imagine you have a a bunch of pieces of cake. As a 5 year old you want the biggest piece. So you pick up the first two and choose the biggest. You set the small one down and pick up the next piece of cake and choose the biggest of the two in your hands. Repeat until all the pieces are looked at
09:49silasdavismap and reduce both give one element at a time to the function they are called with
09:50mercwithamouthxeqi: ah hah...now that makes perfect sense.
09:50zakwilsonmercwithamouth: no. The key point of reduce is that it holds on to the value produced by the last application of the function.
09:50mercwithamouthyeah map i'm used to from ruby...i've never used 'reduce'
09:50xeqimercwithamouth: reduce is called inject in ruby fwiw
09:50silasdavisruby's inject is reduce
09:50tbaldridgewhich is a horrible name for reduce, btw
09:51silasdavisactually it aliases reduce too
09:51mercwithamouthah...gotcha. i do know 'inject'
09:51silasdavisI prefer foldl
09:53mercwithamouthsilasdavis: i'm slightly familiar with foldl/foldr from my scala stint. Is fold better performance wise?
09:54zakwilsonIf + only took two arguments, you might want a sum function that takes more and you would define it with reduce.
09:54zakwilson,(reduce + [1 2 3 4 5 6])
09:54clojurebot21
09:56silasdavismercwithamouth, foldl == reduce and recurses on the function result, foldr recurses in the argument
09:57silasdavisthis may have an impact on stack space because you may be able to calculate intermediate results in some places
09:57silasdavismind you I don't think real world implementation of foldl/reduce actually niavely recurse so it's probably irrelevant
09:57mercwithamouthi see ...a little. Cool
10:00silasdavis(+ 1 (+ 2 (+ 3 4)))) vs (+ (+ (+ 1 2) 3) 4)
10:00silasdavisfoldr is the first one, foldl is the other more familiar one
10:01mercwithamouthahh thats better
10:01silasdavisfor (fold<r/l> + [1 2 3 4])
10:02silasdavisfoldr has to recurse to the end of the list in the argument before any + application can return
10:03mercwithamouthi gotcha...much more expensive
10:04BigTomnoob emacs/nrepl question
10:04mercwithamouthare there any plus sides to foldr?
10:04BigTomif I use C-c C-k I often get a clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: in this context error
10:05BigTomIf I work through the indicated symbols with C-c C-e it will eventually comile
10:06BigTomany thoughts on what I'm doing wrong?
10:06silasdavismercwithamouth, so I don't know the details in clojure but in principle foldr can work on infinite lazy lists, which foldl can't. Clojure reduce is more general than foldl foldr though I think, since it can do lazy lists and exploit reducible expressions
10:06silasdavisI don't know how that works exactly
10:06xeqiBigTom: are you refering to a var that gets defined lower in the file?
10:06BigTomyes
10:07BigTomwell, a defn
10:08xeqiclojure executes in order, so when you C-c C-k, that reference will error, but the file continues evaling and adds your refered-to var. Then when you C-c C-e the var exists and the reference works
10:08xeqiyou should either move the function up or use ##(doc declare)
10:08lazybot⇒ "Macro ([& names]); defs the supplied var names with no bindings, useful for making forward declarations."
10:08silasdavismercwithamouth, you can create a foldl from foldr: http://www.haskell.org/haskellwiki/Foldl_as_foldr
10:09BigTomxeqi: OK, thanks, thought it might be something like that but couldn't find it
10:10BigTomIs that true whenever compiling? or just in the repl?
10:10mercwithamouthhaskell...scary
10:10xeqiBigTom: all the time
10:11mercwithamouththough admittingly they have some of the best documentation for functional concepts
10:11BigTomxeqi: Cheers
10:13mercwithamouthok emacs-live has really grown on me. i'm very tempted to put ruby away 100% for a few months and take the dive. I'm a hobbyist programmer so i would definitely be able to do so.
10:20silasdavismercwithamouth, do it, I've done a few projects in ruby, and it has it's nice elements, but it just tends to get too complicated (clojure people like to talk about complected) even if you try to be safe
10:21silasdavisruby does have some of the best dryness though
10:21silasdavisbut when you've monkey-patched the eigenclass of something one too many times. Pain.
10:22Pupnik_dryness?
10:22mercwithamouthDont Repeat Yourself
10:22mercwithamouthDRY
10:22Pupnik_ah
10:30mercwithamouthso what sorts of projects do you all work on with clojure? I think i asked this a while ago before giving clojure a shot
10:33zakwilsonI've used Clojure to make a batch photo processor, to attempt to reverse-engineer a file format using genetic programming, to make a few web apps, to write a somewhat novel text classifier (and connect it to an http API and a chat bot, among other things).
10:33zakwilsonOh, and a blurry photo detector, and a crude image similarity test.
10:37mercwithamouthzakwilson: hmm interesting stuff!
10:37jstewRuby's a pretty good Object Oriented langage that even borrows some ideas from lisp. Disclaimer: I'm a full time Rubyist learning clojure.
10:37mercwithamouthi want to write an 'assistant' that crawls the web and gathers info on whatever topics you want while you're off doing something else
10:38mercwithamouthjstew: how do you like it so far?
10:39zakwilsonhttps://github.com/zakwilson <-- most of the stuff I mentioned is here. Be warned that it may be less impressive than it sounded, and some of it is probably old and broken
10:39teromI've written mostly some data integration stuff for business use, like one tool pulling data out from a web service and then generating a report with some graphs and mailing it. Maybe not so sexy or cool, but proves that Clojure is very useful for my use. :)
10:39jstewmercwithamouth: It's... fun! It's been hard wrapping my head around FP concepts. Other than that, the syntax is a lot smaller than Ruby's, and like Ruby, there are many ways to solve a problem in clojure.
10:40jstewmercwithamouth: I've not done anything more than euler, clojure koans, 99 lisp problems, 4clojure, my own toy web apps, etc. IOW, nothingsuper useful yet.
10:42mercwithamouthi really have to start tackling euler...i run from math. that has to stop
10:43zakwilsonI never really took to OOP, so I'm always a little lost as to what to say to people who say "I know OOP and I'm not sure how to approach FP".
10:43jstewmercwithamouth: That makes two of us. The nice thing about it is that you really have to work at writing performant code. It's different than just pounding out an MVC app for sure.
10:44jstewmercwithamouth: If math is not your thing, I hear of a lot of people solving google code jam problems in clojure. They're more "real world" than theoretical.
10:45`cbpI'll have to disagree with that a bit :P
10:45mercwithamouthjstew: i'll take a look but i really do want/need to step my ability to solve math related problems
10:46mercwithamouthon that note it's time to disappear for a while
10:46jstew`cbp: Indeed. My "real world" is not everyone elses.
10:46`cbpcode jam has a lot of probability, combinatorics, number theory and geometry problems
10:48jstewInteresting. I did not know that. Now I'm a little more interested in it.
10:49zakwilsonThe problem I tend to have with high-level math a lot of times is that it tends to use a lot of dense terminology and symbols. The same ideas expressed in Scheme wouldn't make my eyes glaze over.
10:50zakwilson(and expressed in APL, they probably would)
10:54bordatoueif i have a list of keys for example (:k1 :k2 :k3) that maps to a map {:k1 1 :k2 2 :k3 3 :k4 4 :k5 5}, is there a idiomatic way to print the associated value for the keys present in the list.
10:55`cbpbordatoue: select-keys
10:56bordatouecbp: thanks,
10:57`cbpor (juxt :k1 :k2 :k3)
10:58bordatoue`cbp: is there way to format it using print
10:59`cbpbordatoue: what do you want the print to look like?
10:59bordatoue`cbp: for example if i want the (print key\tvalue key\tvalue )
11:01`cbpbordatoue: Then you would use a doseq like (doseq [[k v] (select-keys..)] (print (str k "\t" v "\t"))
11:02bordatoue`cbp: but that will print a line for each key
11:04`cbpbordatoue: no it wont :P
11:06bordatoue`cbp: could you please tell me why, I thought doseq would iterate over the map
11:07`cbpbordatoue: have you tried it? doseq does iterate through the map but print doesnt print any newlines
11:07bordatoue`cbp: yes, i was think about py print
11:10arkhfor clojurescript, has anyone ever seen different code behavior between advanced optimizations enabled / disabled?
11:10arkhI can override a goog closure method if optimizations are disabled, but if enabled it ignores my override
11:16seangrov`arkh: What are you trying to override?
11:18arkhseangrov`: goog.fx.Dragger, the defaultAction method as described here: http://docs.closure-library.googlecode.com/git/class_goog_fx_Dragger.html
11:18arkh(aset d "defaultAction" (fn [x y] nil))
11:19arkhby default, Dragger changes the x and y position of the element it's been applied to. I can prevent that behavior if I don't use advanced optimizations but if I do, it seems to ignore the override
11:29seangrov`dnolen: Is this a good idea? If not, maybe you can mention it http://stackoverflow.com/questions/18824234/how-to-get-mappable-children-of-an-element-in-closurescript
11:30seangrov`arkh: What about (set! (.-defaultAction d) (fn [x y] nil))?
11:32seangrov`That should be picked up by the advanced compiler
11:32seangrov`arkh: Generally, be aware of when you're using strings vs property accessors, and know which will be munged and while will remain
11:35arkhseangrov`: nice, that took care of it. I thought I had understood the difference between the two but maybe I mixed the two up : / Thank you!
11:37arkhduh - makes sense, though. Of course the string would be the one that's invalidated, not the symbol
11:38dnolenseangrov`: it's probably ok but seems like gratuitous use of extend-type, I posted my preferred answer for this case
11:45BlankVerseI am trying to run a old clojure project from https://github.com/gmwils/mahoutinaction/blob/master/project.clj, uses clojure 1.2.1 ...
11:45BlankVerseon running lein deps , I get
11:45BlankVersejava.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.PersistentVector
11:52Ox6abeAnyone have experience calling leiningen from a rakefile ?
11:56llasramOx6abe: Sure, but there's nothing special about it
11:56llasram`sh "lein test"`
11:59Ox6abellasram: How about if I have the rake file in a top-level directory
12:00Ox6abe./rakefile ./lein_project/
12:00Ox6abellasram: I'm anoob
12:03silasdaviswhen is map lazy?
12:04`cbpalways :P
12:05llasramOx6abe: I'm not sure what you're asking :-)
12:06llasramLike, you have the Leiningen project in a sub directory of where you run rake?
12:06Ox6abeyes
12:06Ox6abeSorry for the confusion
12:06llasramOx6abe: Ok. Yeah, I don't think `lein` has a pre-chdir option... It might. But without that, the easy solution is to just chdir in your Rakefile
12:07llasramso in the rake task: `Dir.chdir { sh "lein whatever" }`
12:07llasram(where the `` are just me quoting the code, not part of the code itself)
12:08llasramer
12:08llasramThat is: `Dir.chdir("subdir") { sh "lein whatever" }`
12:08silasdavisif I create a map with reduce like (reduce (fn [acc x] (assoc acc :foo (f x))) coll)
12:08silasdaviscan I consume the resulting map lazily
12:08Ox6abellasram: Awesome .. You lead me on the right path <--- Literally
12:09silasdavisso that it only iterates as many times as it needs to to generate the value for the desired key?
12:09llasramOx6abe: Oh, you've given up the lefthand path?
12:09Ox6abellasram: Haha
12:11silasdavisactually is this what core.reducers are about...
12:11silasdavis?
12:12llasramsilasdavis: Er, well there's no such thing as a lazy map (in the data structure sense of "map")
12:12mdrogalissilasdavis: Reducers are about parallelization through throwing away ordering.
12:13silasdavisbut also about providing laziness in expansive and contractive operations
12:14silasdavisreduce is a contraction so I was wondering if I could get something ran the reduction as many times as necessary to yield the key-value pair requested
12:16llasramsilasdavis: Only if you explicitly short-circuit it yourself. `reducers` is lazy in that no computation happens on the input until you `reduce`, but when you do `reduce`, the entire sequence is reduced at once
12:16`cbpsilasdavis: maybe you can use reductions which is lazy
12:17silasdavis`cbp, !
12:17silasdavisthat's exactly what I want
12:17silasdavisthanks
12:17`cbpnp
12:25silasdaviscan I do any better than: (defn lget [r k] (get (first (filter #(get % k) r)) k))
12:25silasdaviswith, for example:
12:25silasdavis,(reductions (fn [acc x] (assoc acc x 1)) {} [:a :b :c :d])
12:25clojurebot({} {:a 1} {:b 1, :a 1} {:c 1, :b 1, :a 1} {:d 1, :c 1, :b 1, :a 1})
12:26silasdavis,(defn lget [r k] (get (first (filter #(get % k) r)) k))
12:26clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
12:27silasdavisguess it should be (defn lget [r k] (get (first (filter #(contains? % k) r)) k)) actually
12:33silasdavishow can I do (reduce and coll)?
12:33`cbpsilasdavis: wat
12:33justin_smith(every identity coll)
12:33silasdavisand is a macro
12:33silasdavisah
12:33justin_smith*every?
12:33rasmustosilasdavis: (fn [r k] (some #(get % k) r)) for year previous question?
12:34rasmustoyour*
12:34`cbpoh
12:34justin_smith,(every? identity [true 1 1])
12:34clojurebottrue
12:35justin_smith,(reduce #(or %1 %2) true [true 1 2 (Object.)])
12:35clojurebottrue
12:36`cbphmm does anyone know what method does a record print when its created, like (MyRecord. 1 1) will print #user.MyRecord{:a 1 :b 2} but using str on that gives me something useless about its memory address
12:37xeqi`cbp: that is the reader literal form of a record
12:38`cbpxeqi: any idea how I could get a string of that from a record?
12:39justin_smith`cbp: try pr-str
12:40rasmustowhen I do nrepl-jack-in, and run a clojure.tools.namespace.repl/refresh, it complains that it can't find a few of my classes/namespaces, and I have to c-c c-k them manually, any ideas why this is?
12:40`cbpjustin_smith: oh nice. I didn't think of that :P
12:40justin_smith((juxt str pr-str) (java.util.Date.))
12:40justin_smith,((juxt str pr-str) (java.util.Date.))
12:40clojurebot["Fri Sep 20 16:11:28 UTC 2013" "#inst \"2013-09-20T16:11:28.932-00:00\""]
12:41justin_smithseems pr-str prefers versions of a thing that can be read back in again
12:41justin_smithahh, yeah, pr-str is pr to a str, and
12:41justin_smith,(doc pr)
12:41clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
12:42justin_smithnote the last sentence
12:42`cbpI knew about it just didn't make the connection :P
12:42justin_smithahh
12:42justin_smithit is something I am still learning about personally
12:56seangrov`juxt?
12:56clojurebotjuxt is usually the right answer
12:56seangrov`clojurebot: I <3 you
12:56clojurebotPardon?
13:17pepijndevosWhat would be the correct set of functions to decide if something is a key/value thing, a sequential thing or an atomic thing?
13:18justin_smithI have a server dispatching threads for every request. I have a task that should not be carried out in more threads than I have CPUs, because things get bogged down. So This needs some task queue. What is a good rule of thumb about when agents should suffice or when I should upgrade to core.async?
13:20squidzjustin_smith: Not sure of any rules of thumb, but I would definitely try out core.async. Once you get used to it, it makes things pretty nice
13:20s4muelpepijndevos: you're looking for map? and/or seq?
13:20justin_smithI have tried it, but have not really used agents yet. I wonder if core.async totally supersedes agents, or when agents would be the simpler answer
13:21pepijndevoss4muel, probably, but there is also sequential? and associative?
13:21mdrogalisjustin_smith: It's definitely not a replacement.
13:21justin_smithmdrogalis: what are the main deciding factors between using agents or core.async?
13:21mdrogalisFor example, you can't perceive an entire queue in core.async.
13:22justin_smithahh, interesting
13:22mdrogalisjustin_smith: core.async intentionally has a very small API. Another thing you can't do with it is check if its queue is empty.
13:25pepijndevosAnything that is clojure.lang.Seqable can be looped over, right?
13:25mdrogalispepijndevos: With the loop construct specifically?
13:25mdrogalisI guess it doesn't matter - yes.
13:25pepijndevosmdrogalis, just any iteration
13:26pepijndevosI'm looking for the best way to walk some nested data
13:26mdrogalispepijndevos: Yeah, I believe that to be so.
13:26mdrogalispepijndevos: core.walk?
13:26pepijndevosdoesn;t suit my needs unfortunately
13:26pepijndevosor at least not intuitively so
13:26s4muelpepijndevos: what it implements is the 'seq' interface like rest/next/first/nth. But everything that can be seqable is not necessarily sequential. there's semantic differences between collections and sequences
13:26mdrogalisNeed to brb.
13:27pepijndevosright, a map is not sequential, but it can be seq'd
13:27coventrypepijndevos: Even if core.walk doesn't fit your situation, it might be worth taking a look at, because it has to address the same questions.
13:28pepijndevosyea, https://github.com/clojure/clojure/blob/c5673086d40f206135b99a37001c80a4016c3877/src/clj/clojure/walk.clj#L35
13:31pepijndevos&(map (juxt list? seq? coll?) [[] {} (list)])
13:31lazybot⇒ ([false false true] [false false true] [true true true])
13:34rasmustocallen: Thanks for the suggestion to use 'refresh, it forced me to clean out some stale "example" clj files that had some strange dependency loops
13:34rasmustoand now it finally works
13:41callenrasmusto: :)
13:41callenalexbaranosky: in case you missed it, I am bitemyapp.
13:42silasdavisis it possible to obtain a human-readable function definition from a clojure function?
13:42silasdavisthat is the function object itself
13:42callensilasdavis: you mean a doc string?
13:42silasdavisno
13:42coventryIs there a way to force reloading of .clj files, apart from making sure they have a newer timestamp than their .class files?
13:42callencoventry: are you using refresh?
13:43justin_smith,(clojure.repl/source clojure.repl/source)
13:43clojurebotSource not found\n
13:43justin_smithusually that works :)
13:43coventrycallen: Playing around with sleight.
13:44silasdavisI mean get some parsable clojure code from the object whose string representation is somethign like: "#<core$get_in_map$fn__9700 language_model_distribution_api.core$get_in_map$fn__9700@45662c96>"
13:44callenI thought that would end up catching your fancy.
13:44callensilasdavis: why do you want the stringly version of a function?
13:44justin_smithsilasdavis: anyway, more directly: (clojure.repl/source f)
13:44callenI'm smelling an x-y problem.
13:44coventrycallen: Yeah, it's awesome.
13:44silasdavisjustin_smith, is that going to work comp'd functions too?
13:45justin_smithprobably not, and if that is what you need, yeah, stringly typing is likely the problem
13:46rasmustocallen: another thing, how do you feel about :refer :all in test namespaces?
13:47callenrasmusto: no objections.
13:47callenno point in being unnecessarily tedious if you need to test everything anyway.
13:47silasdavisjustin_smith, stringly typing?
13:47rasmustocallen: ok, thanks again
13:47callensilasdavis: http://c2.com/cgi/wiki?StringlyTyped
13:48callensilasdavis: http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html #7
13:48silasdavisah not quite
13:49callenone of my objections to JSON is that it lends itself to stringly typed protocols. makes me mad.
13:49callenthen I end up having to use clojure.walk :(
13:49callenalexbaranosky: ^^ that's why I laughed when your presentation mentioned clojure.walk, been using it to coerce crappy JSON data.
13:50silasdavisI have a map of hierarchiacal indices, the keys to this map are functions that derive the indices. Mostly I look on all the indices without caring what the key-deriving functions are, but occasionally I do care, perhaps mostly for debug, so I was thinking I could get some rep. of the functions.
13:50silasdavisactually this might be a good place for metadata?
13:50silasdavisto label them
13:50coventrysilasdavis: Yes.
13:50silasdavisbecause I'd rather avoid polluting my map with labels
13:50callensilasdavis: sounds like it.
13:51silasdavisexcellent...
13:52callensilasdavis: in general, try to make things accessible and transparent data. functions and closures are fine, but if you find yourself poking at their entrails, you might just want data or metadata.
13:52coventryYou could probably make a macro which stuck the form and source code location in the metadata using the &env and &form variables. http://blog.jayfields.com/2011/02/clojure-and.html
13:52gleagsilasdavis: Generally, it's very difficult to serialize functions with free variables into text.
13:54silasdavisgleag, yeah I can see why that might be the case
13:54coventrycallen: If he's using it for debug info, I don't see the problem.
13:55silasdaviscould I write a macro that wraps a definition, evaluates the code in place, and then attaches the quoted code as metadata?
13:55gleagcoventry: He said "parsable".
13:55silasdavisgleag, I shoudn't have
13:56gleagThat would imply being able to read it back into an object that would perform equal functionality (for some values of "equal").
13:56silasdavissay I didn't need it to make an subsitutions
13:56coventryUsing the metadata to reconstruct the function would be pretty awful, yeah. :-)
13:56silasdavisyeah it would, I don't really need that
13:56xeqisilasdavis: have you seen https://github.com/technomancy/serializable-fn ?
13:58gleagIn Lisp-1, conceptually, most functions use free variables as form operators, thus, virtually all the subforms use free variables at least for function calls (save for operators passed as parameters, and local definitions). That sort of complicates the "read stuff back" issue since you don't know if the names are global or local. You'd probably have to pass an environment structure.
13:59silasdavisxeqi, if you closed over some local variable with that, how would it serialize?
13:59silasdavisum so like (s/fn [x] (some-other-fn x 3))
13:59silasdavisyou'd just get the symbol 'some-other-fn to eval?
14:00xeqisilasdavis: yep
14:00coventrysilasdavis: You can read the whole thing very quickly. https://github.com/technomancy/serializable-fn/blob/master/src/serializable/fn.clj
14:00gleagAlthough I suspect that the problem isn't impossible solve since Gambit Scheme managed to serialize virtually everything heap-based (not open file descriptors and other OS resources, but other than that, almost anything.)
14:01silasdavisxeqi, coventry ah yeah see that now, and thanks, just what I wanted
14:01silasdavisgleag, interesting
14:05pepijndevos$findfn [:a :b :c] [0 1 2]
14:05pepijndevosI forgot how that works :(
14:05lazybot[]
14:05`cbpslowly apparently
14:06pepijndevosI was hoping keys and vals would work on vectors, so i could do (map f (keys v) (vals v)) and have that work on both maps and vectors
14:06xeqiit is running lots of functions in sandboxes
14:07pepijndevosfor vectors keys would basically be range and vals identity
14:10ziltiI have a problem with Incanter. I have a three-column dataset loaded from a .csv. Do I have to postprocess it to use it? (sel dset 1 1) or (principal-components dset) both give me a "IllegalArgumentException No method in multimethod 'sel' for dispatch value: [incanter.core.Dataset false]" error.
14:13mdrogalispepijndevos: What behavior do you expect?
14:14ziltiAnd according to Google, no one ever had my problem.
14:14pepijndevosmdrogalis, in this particular case: https://www.refheap.com/18841
14:15pepijndevoswhich then allows me to loop over either one
14:20callenif you have a function you want to be tail recursive, and the primary binding is scalar, but you suddenly say yourself that you want to make the recursion non-tail-recursive because you roughly want to map across "children", then you probably just one a coll binding in the loop form.
14:20callenIn case anybody else runs into this. Pondering writing a blog post.
14:26pepijndevosweirdo error message
14:26pepijndevosArityException Wrong number of args (2) passed to: PersistentVector
14:26callen,([0 1 2 3] :a :lol)
14:26clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: PersistentVector>
14:26pepijndevosoh...
14:27callenI GAT YUR EXCEPTION RIGHT HURR BUDDEH
14:27pepijndevoswait wat….
14:32rasmustowhy does my nrepl buffer scroll to the middle when I hit <RET> after its a certain length?
14:34rasmustobah, it's tough to reproduce too :(
14:34mdrogalisHey guys. Anyone want to try out a small debugging utility I made? It seamlessly logs all args and return vals to fns in a ns.
14:34mdrogalishttps://gist.github.com/MichaelDrogalis/6638777
14:34mtprasmusto: there's an emacs var that controls this, sec
14:34callenmdrogalis: yes plz
14:35mtpM-x customize-var recenter-positions
14:35mdrogalisStill shaking out the bugs, but it's pretty awesome so far.
14:35mtptry nudging that around
14:35callenmdrogalis: I've needed something like this. thank you for making this.
14:35mtpmine is (bottom middle)
14:35rasmustomtp: reminds me of vim's scrolloff, thanks for the hint :)
14:35mdrogaliscallen: Sure! If you find any weird/wrong behavior, make an issue on night-vision repo.
14:35callenmdrogalis: I was talking up my love for AOP and Erlang style error handling with Dire and robert.hooke last night at the Clojure meetup :)
14:36mdrogaliscallen: Wow, people in real life talk about something I made?
14:36callenmdrogalis: yeah dude, I was using Dire/alter-var-root/AOP to explain how you could componentize error handling and make error handling code more reusable.
14:37callenmdrogalis: I'm damn tempted to do a whole Clojure talk just about AOP, robert.hooke, and Dire.
14:37callenit's your baby, but still.
14:37mdrogaliscallen: I'd be honored - go for it.
14:37calleneggscellent.
14:38callenmdrogalis: are you competing in Clojure Cup?
14:38mdrogaliscallen: I didn't have plans to. Are you?
14:39callenmdrogalis: yeah, trying to find people who are interested in my project idea. Sort of a scratch-my-own itch type thing.
14:39mdrogalisAh, I got'cha.
14:39mdrogalisI'm really not much for hackathon style things. :)
14:39callenmdrogalis: I'm not either, I just want my thing to exist and CC is stimulation to make me shove out an MVP.
14:40coventryI'll be traveling. Will be in DC and Raleigh/Durham next week. Anyone want to meet up in either place? Anything clojure-related going on?
14:40mdrogalisI'm in Philly, a bit far off I'm afraid.
14:40callenyessss ac-nrepl, make my namespace switches take 60 seconds. go for it. why not.
14:42mdrogaliscallen: Anyways, let me know if that little function can be more useful.
14:42mdrogalisI tried introspecting clojure.core. It blew up
14:42callenlol
14:42callenI don't think I'd need to do that, thankfully.
14:42mdrogalisIt's kind of fun to use against a codebase that you didn't write.
14:42mdrogalisFascilitates understanding a little faster.
14:43`cbpC-c M-n takes 60 seconds?? :O
14:44callen`cbp: ac-nrepl makes me salty.
14:44callenmdrogalis: that's a really good idea.
14:44indigoHehe... emacs :P
14:44callenyou could do whole blog posts just about ripping apart clojure libraries with night vision goggles. :)
14:44callenindigo: the solution is to just shut off ac-nrepl, not a big deal
14:45indigoJk
14:45mdrogaliscallen: And staring at the neighbors after hours!
14:45callenmdrogalis: made my snort my tea man
14:45callenme snort my*
14:45pepijndevosAnyone up for code golfing this? https://gist.github.com/pepijndevos/6580712 My attempt: https://www.refheap.com/18844
14:46`cbpWhat where are the parentheses
14:46mdrogalisHeh
14:47pepijndevosMy clojure version is more broken into pieces, but IMO the Python version is a lot simpler and faster due to the mutable result dict.
14:48pepijndevosThe clojure one does a lot of merging of dicts
14:50callenmdrogalis: oh yeah, this is nice.
14:50mdrogalisSpeaking of fast hashmap updates.. I used reducers the other night to update 1m key/val pairs on a terrible laptop
14:50mdrogalis~5s
14:50clojurebotGabh mo leithscéal?
14:50mdrogalisIts pretty greeat
14:50callenmdrogalis: now just need an un-introspect. :)
14:50mdrogaliscallen: :)
14:50callenbut yeah, loving it.
14:51mdrogalisExcellent!
14:51pepijndevosmdrogalis, how would you use reducers to speed up this function?
14:52callenpepijndevos: you could use a transient too.
14:52callenbut is speed the point? you said golf.
14:53mdrogalispepijndevos: I didn't look at it, but I wrote this guy..
14:53`cbpcould you provide sample input->output data. I'm just too dumb to do the desk checking in my mind
14:53mdrogalishttps://www.refheap.com/18846
14:53pepijndevoscallen, speed is not really the point
14:53mdrogalisAnd she is speedy as hell.
14:53callenpronouncing that "maff".
14:53pepijndevos(php-flatten {"a" [1 2] "b" {"c" 3}})
14:53pepijndevos{"b[c]" 3, "a[1]" 2, "a[0]" 1}
14:54callenthat's a cute function.
14:55pepijndevosThere is a whole python implementation of PHP's serialize, because PHP API's leak all that stuff and asume everyone uses PHP.
14:56pepijndevosI only ported this function to Clojure because I thought that in this case, local mutable state actually made the thing better.
14:57callen"better" *shrug*
15:00callengfredericks: do you still want to bring this one in or are did you end up keeping your own solution separate? https://github.com/korma/Korma/pull/102
15:00dnolenpepijndevos: why not write the exact same thing in Clojure w/ an atom?
15:01callenseems unnecessary and dirty. Pretty sure transients are a better fit.
15:01dnolencallen: no
15:01dnolencallen: you can't bash on transients
15:01dnolencallen: and local mutability is fine
15:02callenI don't think you can easily generalize something like "local mutability is fine".
15:02dnolencallen: oh but I can
15:03callenmost uses of atoms in Clojure code that I've seen are for thread-safe global state.
15:03callennot for local bashing.
15:03dnolencallen: so?
15:03callenit was my impression that in local use-cases, transients were more to the point.
15:03llasramcallen: Check the code for the `reducers` versions of `take` and `drop`
15:04dnolencallen: you have to operate on transients in functional way limiting some uses
15:04callenllasram: that's pretty cool, I had no idea something like that was idiomatic.
15:04callenllasram: I guess the lack of contention makes it viable?
15:05TimMcTransients don't allow for action at a distance.
15:05callenI know that, but we're talking about a local use case.
15:05callenI said explicitly that transients were an option for a local case where spooky action at a distance isn't needed.
15:05TimMc"Distance" can also mean "elsewhere in the call stack".
15:05llasramcallen: I'd guess that its still slower than normal JVM mutable locals, but must not be enough-so for rhickey to want to add that to the language :-)
15:06TimMcor "I don't want to destructure my returns""
15:06callenllasram: he's normally sensitive to that sort of thing, so I have to assume it didn't make enough of a difference in that context.
15:06TimMcllasram: If you want that, you can use a one-element Object array. :-P
15:06callenI'd be very surprised if that was faster than mutable locals. atoms do more work.
15:06llasramTimMc: Or proteus!
15:06callenztellman's libraries...the fire spreads...
15:07dnolenproteus just uses atoms far as I know
15:07llasramdnolen: deftype
15:08llasrammutable member
15:08dnolenllasram: ah, k
15:08TimMcThat's a good README right there.
15:08TimMc^:local makes me a little nervous
15:08callenif atoms would've sufficed, he wouldn't have needed Proteus.
15:10alfborgeWhat's the difference between these: (map parse-binding-content (-> b :content)) and (-> b :content (partial map parse-binding-content))
15:10TimMcSo this macro redefines set! and friends within its scope?
15:11llasramTimMc: if you haven't been following ztellman's recent output, see also riddley :-)
15:11alfborgeReason I ask is that I thought they were equivalent, but I only get the first to work. The latter returns a function: #<core$partial$fn__4192 clojure.core$partial$fn__4192@183648b1> which is not what I expected.
15:12amalloyalfborge: try macroexpanding it
15:12mdrogalisTime to head out. See ya guys.
15:12callenztellman's libraries are a good alternative to coffee for getting that wide-eyed feeling first thing in the morning.
15:12amalloythe latter expands to (partial (:content b) map parse-binding-content); see if you can see why
15:12rasmustoalfborge: the latter is passing in the content of b as the first argument to partial :O
15:16alfborgeThanks, I'm closer to understanding now. :)
15:19rasmustoalfborge: take a look at different examples of -> and ->> to see what they are used for
15:20alfborgerasmusto: Yes, I'm reading up on it now. Thanks.
15:21pepijndevosdnolen, yea, maybe I should....
15:21dnolenpepijndevos: whenever I see that something is more easily done locally with an atom I rarely bother with convoluted functional solutions.
15:22pepijndevos:)
15:22clojurebotIt's greek to me.
15:25dnolenpepijndevos: http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/source_map.clj#L155
15:26dnolenwith source maps similar problem
15:26dnolentree shape is good for merging, but for the final flattened output just easier to do it with a few atoms IMO
15:26pepijndevosyea, local mutable state is very convenient sometimes
15:27dnolenpepijndevos: very
15:29borkdudeHow can I search an entire project for misplaced docstring (after instead of before the arg vector) in Emacs?
15:31TimMcborkdude: There's a lein plugin for that.
15:31TimMcAh, jonase/eastwood
15:32`cbphehe i give up implementing it without mutability. This is why i did most of my code jam exercises in java :P
15:32borkdudeok thank you TimMc
15:33TimMcborkdude: You may need to exclude c.t.namespace from its dependencies if it conflicts with other plugins.
15:33borkdudec.t.?
15:33Bronsaclojure.tools.namespace
15:35borkdudeit just works, thanks
15:38callen`cbp: for shame :)
15:38saolsenAre there any clojure vector math libraries that just work on clojure vectors? Just with simple things like magnitude or dot products
15:39callensaolsen: https://github.com/mikera
15:41saolsenoh cool, didn't realise that worked with normal clojure vectors
15:42callenI'm pointing you at a person, not a repo.
15:43saolsenright, I meanth that in refernce to core.matrix
15:43saolsen*meant
15:47callenmdrogalis: running my unit tests with night vision enabled producing an EXTREME amount of output, hahahahaha
15:47callenand that's on just one namespace :)
16:02alfborgeThanks amalloy and rasmusto for the pointers to understand -> and ->> :)
16:03callenalfborge: ,,,
16:05alfborgecallen: Actually, my problem was more the fact that these are macros and not functions.
16:05callenmtp: problem? :)
16:11irctchey guys, I can't (require 'clojure.contrib.math) etc
16:11AimHereirctc > clojure.contrib has been deprecated for a while now
16:12irctcohh
16:12irctchow can I have math?
16:12`cbpirctc: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
16:13irctcahh thx, I even saw the page but somehow eluded me
16:31callencan we just...start deleting things related to contrib? :P
16:32jared314newbie macro question, (defmacro tester [a] `(inc ~(* a 2)))
16:32jared314if I pass it a number it is fine
16:33jared314if i pass it a symbol that i have defed it errors
16:33piskettiOne does not simply... delete things related to contrib B)
16:40AimHerejared314, it's not dereferencing the symbol you pass in
16:41AimHerejared314, perhaps (defmacro tester2 [a] `(inc (* ~a 2))) was what you wanted
16:41jared314AimHere, I was trying to operate on the value and then insert the value into the resulting form
16:41coventryAimHere: But why not?
16:42gfredericksjared314: the value doesn't exist at compile time
16:42AimHerejared314, remember that macros operate at compile time
16:42jared314that makes sense
16:42jared314thanks
16:42AimHereBy the time you've deffed the symbol, it's too late! You might have to use a funciton instead
16:46indigoOh PHP... the default behavior of curl_exec() is not to return the result, but to send it to stdout :|
16:47callenstrangemonad: hi friend :)
16:48strangemonadhi :)
16:52callenwhat's a good word for referring to parents and children?
16:52callena single noun for referring to the relationship would be nice for naming my functions.
16:53rasmustocallen: geneology?
16:53callenrasmusto: no, this is a hierarchical tree
16:53rasmusto;p
16:53callenfor example, I need to write a function to associate a parent with their children and vice versa.
16:54callenI'm lacking in nomenclatural fluidity today.
16:54callenbeing one of the two hard things in computer science, this is to be expected.
16:55rasmustowhat's the other one?
16:55callencache invalidation.
16:55mtpand off-by-one errors
16:55rasmustooic
17:03rasmustos/upper-case
17:04jweiss,(class (map inc :foo))
17:04clojurebotclojure.lang.LazySeq
17:04jweissweird.
17:04jweissi wouldn't expect lazy-seq to accept a non-sequence, but it does
17:05jweissor i suppose i also wouldn't expect map to accept a non-sequence
17:06coventryWhere does the evaluation of syntax-unquoted code happen in clojure's java sources? I've looked at LispReader/SyntaxQuoteReader, but all that seems to happen there is that the unquoted form gets put on a list (in sqExpandList) or returned (in SyntaxQuote).
17:08callenhave I lost my table-flipping mind? https://gist.github.com/bitemyapp/6643575
17:12coventryjared314's example really confuses me. What does it mean to say that "a" does not exist at compile time for ~(* 2 a), but that it does for ~a?
17:14callenno, that doesn't make sense.
17:15llasramcoventry: I think the point is that the unquoted value of `a` is a symbol, so the code `(* 2 ~a) expands to something plausible, while `~(* 2 a) does not
17:16marco3How do I run clojurescript with the master clojurescript branch?
17:16marco3I thought I remebered seeing a something about it, but I can't seem to find it
17:17coventryllasram: What's plausible mean here?
17:17coventrycallen: I think you could simplify that a bit with update-in.
17:18llasramcoventry: Something you'd expect to compile
17:19llasram,(let [a 'foo] `(* 2 ~a))
17:19clojurebot(clojure.core/* 2 foo)
17:19coventryllasram: Thanks, I get it now.
17:19llasram,(let [a 'foo] `~(* 2 a))
17:19clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number>
17:19callencoventry: sorta-not-really.
17:19callencoventry: I have to reify the concept of "vector - hell or highwater" into a separate fn anyway.
17:20callenhttps://gist.github.com/bitemyapp/6643736
17:29marco3found the link: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler
17:41rasmustois there a way to have leiningen use its 'read-git-head, but specify an scm url that isn't github?
17:44rasmustoI might just do it with a git hook, hmm
17:57rasmustoI ended up doing this: :tag ~(->> (slurp ".git/HEAD") (clojure.string/split-lines) first (re-matches #"^ref: (.*)") second (str ".git/") slurp)
18:02nopromptdnolen: do you still use cljs.node-repl? i can't figure out how to get it to work properly with Emacs/nREPL. it keeps prompting me for Stdin:. :/
18:02dnolennoprompt: I think I had to hack it, should probably open a proper issue on the project, Bodil
18:02dnolenis pretty responsive
18:03callenit's a good thing I don't check in REPL code.
18:03squidzdnolen: that is the reply you normally use for your clojurescript?
18:03nopromptdnolen: ah, ok. i just wanted to make sure it wasn't something i was missing. so that's normal behavior?
18:04dnolensquidz: when I'm working on some code that doesn't involve the browser it's useful
18:04dnolennoprompt: I don't remember
18:04squidzdnolen: so what do you use when you need to work with the browser?
18:04dnolensquidz: browser REPL
18:04dnolensquidz: and auto builds
18:04nopromptdnolen: i added the piggieback conf but, ehf, it still prompts me.
18:05noprompti guess i could open an issue. hoping i don't look like an idiot. :-P
18:05squidzwhat are auto builds?
18:07dnolennoprompt: people have opened issues for less compelling reasons, don't worry about it
18:07dnolensquidz: lein cljsbuild has incremental auto builds
18:07squidzoh okay thats what you meant.
18:10nopromptdnolen: FWIW i guess i could also slip in a suggestion to bump the piggieback dep version.
18:11dnolennoprompt: probably a good idea
18:27nopromptcall me immature, but i can't help but laugh when i see (:require [goog.string :as gstring])
18:28rhglol, nope its not you
18:30rhgo.0
18:31SegFaultAXrhg: 80% of the time I screw that up every time.
18:32rhghow?
18:32clojurebotwith style and grace
18:32rhgah
18:34coventryIs c.j.shell/sh still the best way to make a symlink in clojure (w/ java 6)?
18:35rhgbest? idk but it works and isnt too ugly
18:41nopromptdnolen: have you done an experiments with the CSSOM?
18:45callennoprompt: you're a sexist monster and should remove yourself from civilized socity.
18:45callensociety*
18:46rhglol
18:46nopromptcallen: not totally. i restrained myself from blowing up the logs with risque ascii art.
18:46rhgalong with half the world
18:49yedichris
18:53Raynesstopher
18:53metelluschrisstopher?
18:53RaynesYes.
18:53`cbpstop her
18:53clojurebotTitim gan éirí ort.
18:55yedihow long does it usually take strangeloop vids to go up?
18:55callen6 months
18:56callenwhich I'm pretty sure Joda Time has an alias for named, "Haha, suckers!"
19:06callennoprompt: gettin' close.
19:06nopromptcallen: really?
19:06callensorta not really.
19:06`cbp:(
19:06callennoprompt: my breaks/therapy usually involve trolling Haskell programmers and catharsis in showing off terrible code.
19:07callennoprompt: I'm knee-deep in a project that got nasty and I wasn't really given an honest appraisal upfront about it. I'm writing some nutty loop/recur stuff right now.
19:07clojurebotI don't understand.
19:07callenclojurebot: you don't need to dearie.
19:07clojurebotCool story bro.
19:07callenI know.
19:07nopromptXD
19:07callennoprompt: it's nothing on the order of say, core.async, but it's still *_*
19:07nopromptcallen: remember. mapcat.
19:08callenindigo: catenate
19:08indigoI know ;P
19:09callennoprompt: I've got clojure.walk in a couple places, loop/recur in a few others...
19:09nopromptin a month it'll be one full year of programming with clojure. last year i was mostly doing ruby and by the end of it, i was just, well, miserable.
19:09callenit's a proper mess.
19:09indigonoprompt: At least you're not doing PHP
19:09RaynesOr FRP
19:09Raynes~rimshot
19:09clojurebotBadum, *tish*
19:09callennoprompt: well, the really sucky part is that I'll never get to do any Clojure that'll be nicer. Once this franky ick project is over, I'm back to Python.
19:09callenRaynes: you checked my trolling?
19:09nopromptindigo: i've declined every oportunity to write PHP regardless of the money.
19:10RaynesYes, it was a reference to your appendage measurement context with Brain McKenna on twitter.
19:10RaynesBrian*
19:10callenBrain, how appropriate.
19:10callenHe's like the mouse from Pinky & the Brain.
19:10indigonoprompt: I really need the money :P
19:10callen"YES. WE WILL HASKELL ALL THE THINGS PINKY!"
19:10indigoSo I can buy my cool Apple toys :P
19:10callennoprompt: most times I've been offered to write PHP it's hit a new peak for my contract rate and it's never been worth it anyway.
19:10nopromptBrian McKenna. That guy.
19:10nopromptsometimes i don't know why i still follow him.
19:11callenI follow him so I can take snipes at his sanity.
19:11callenI want to see if he starts speaking in Haskell operators.
19:11nopromptwell the funny thing is the guy is like always hacking on javascript and complaining about languages sucking etc.
19:12SegFaultAXnoprompt: In fairness, Javascript sucks. A lot.
19:12callenSegFaultAX: I had to answer a coworker's question by checking the ECMA standard today.
19:12noprompti mean he could just choose not to program in javascript and most of his bitching would stop.
19:12callennoprompt: I have a buddy that writes Perl and is obsessed with Haskell on the side.
19:12SegFaultAXnoprompt: Unless, you know, it's his job.
19:12callenI think it's an allergic reaction people have to using sucky languages.
19:12SegFaultAXIt's OK to be paid to do something that you hate.
19:12callenSegFaultAX: is it?
19:13SegFaultAXcallen: Yes.
19:13nopromptSegFaultAX: well there's that i guess. still that's his choice.
19:13callenSegFaultAX: I wonder if being an African Warlord pays well...
19:13SegFaultAXnoprompt: And it's also his choice to bitch about it while he does it.
19:13SegFaultAXHe can have it both ways.
19:13nopromptSegFaultAX: this is also true.
19:13RaynesWell given that the only thing he does seem to like is Haskell and variants thereof, he probably doesn't have much choice in jobs he actually enjoys.
19:13SegFaultAXRaynes: That to.
19:14SegFaultAXNot like Haskell jobs are a dime-a-dozen.
19:14callenRaynes: he could join the Portland hipsters.
19:14callenI loved that he managed to squeeze in a "what's the problem?" into one of his tweets, almost perfectly mimicking that old saw about monads and endofunctors.
19:15rasmusto<3 portland
19:15noprompti'm happy to be living in a mostly hipster free city.
19:15callenBrian McKenna is not a person. He is an attempt by an AI researcher at making fun of his Haskell-obsessed colleagues.
19:15callenand a parrot.
19:16rhgagreed
19:16SegFaultAXnoprompt: That's a pretty douchey thing to say.
19:16nopromptSegFaultAX: how so?
19:16RaynesIt isn't, don't worry.
19:16noprompti didn't think so.
19:16callendecided to go for broke and plunge the knife in. We'll see how Parrot-man reacts.
19:17rhglol
19:17noprompthaha
19:17callenbitemyapp: .@puffnfresh @nvanderw Except for the part where thousands of applications were shipped, billions $, etc…don't you write JS for a living?
19:17SegFaultAXnoprompt: Biggotry.
19:17nopromptSegFaultAX: how so?
19:17callenTaking bets on whether he's silent after that one.
19:17RaynesOf course not.
19:17callendammit.
19:17rhgwishing...
19:18callenpuffnfresh: @bitemyapp @nvanderw argumentum ad populum. Nope, I don't write JavaScript for a living.
19:18nopromptSegFaultAX: i mean just because i do not like some faux subculture does not make me a biggot.
19:18SegFaultAXnoprompt: You're saying that you're happy to live in a city that lacks a large population of people who express themselves in a way that you find distasteful.
19:18callenSegFaultAX: he prefers the meth-heads of Central Valley. Less pretentious, but more bitey too.
19:18nopromptSegFaultAX: so i'm a biggot if i say i'm happy to live in mostly white-supremacist city too?
19:18SegFaultAXNevermind /why/ you find it distasteful (that's a separate issue)
19:18RaynesSegFaultAX: And you're saying nonsense.
19:19RaynesHe made no derogatory comments about 'hipsters', a word that is essentially meaningless at this point anyways.
19:19callenis this how hipsters defend hipsters?
19:19nopromptRaynes: thank you.
19:19callensounds like a very hipster-y argument to me.
19:19Raynesnoprompt is a confirmed hipster.
19:19nopromptcallen: ZING!
19:19RaynesHe once wore a fedora.
19:20callenSegFaultAX writes Ruby for a living. Guaranteed hipster.
19:20callenThey both burn.
19:20SegFaultAXIn SF
19:20callenIn SF.
19:20SegFaultAXcallen: Except you've met me, so you know I couldn't be further away from a hipster.
19:20SegFaultAXBut that isn't the point.
19:20callenI know. but you're burning anyway for protecting the hipsters.
19:20RaynesBecause there isn't one.
19:21SegFaultAXRaynes: We disagree, that's ok.
19:21callen#clojure #CultureWars #ohGod #makeitStop :(
19:21RaynesThis point you speak of is as flat as iOS 7.
19:21callenz-index negative infinity :(
19:21nopromptRaynes: you had to remind me. i don't wanna upgrade. ;_;
19:21`cbpM-x life-is-too-much
19:22rhgnoprompt: i am dissapoint
19:22SegFaultAXRaynes: Is your argument that since "hipster" doesn't have a concrete meaning, it can't be used in a hurtful way?
19:22callenI think Brian McKenna made a deal with the grim reaper where he dies immediately if he writes a single bug into his software.
19:23callenthat's the only explanation for the extremities of his insanity
19:23yedicallen: "noprompt: it's nothing on the order of say, core.async, but it's still *_*"
19:23yedinot a fan of core.async
19:23nopromptcallen: the meth heads aren't such a big deal until they decide to j run across the street in the dark of night and you're driving like 45 miles an hour and have to swerve out of the way.
19:23RaynesSegFaultAX: That's a different argument. I'm arguing that you're jumping on noprompt for no reason and it is bothering me on a personal level, given that I know noprompt and am utterly certain you're taking words from him and making them out to be something they definitely are not. That's all.
19:23callenyedi: nobody cares. I was complaining about annoying work stuff.
19:23TimMcOh, we're talking about hipsters now?
19:24callenTimMc: don't pitch in gasoline.
19:24RaynesI could use some lighter fluid.
19:24callenmeth-head perfume?
19:24SegFaultAXRaynes: Perhaps. The implication of "I'm happy to be" is that it is somehow better. If that wasn't the implication, why would it matter if there were or were not <insert group>?
19:24callenSo if you ever wanted programmers to fight each other like pit dogs, now we know how. Hipsters.
19:24rhgi am in #clojure?
19:25RaynesI'm happy to not live in North Korea.
19:25callenrhg: I really wonder sometimes.
19:25RaynesDoes that mean I hate North Koreans?
19:25SegFaultAXRaynes: That's not the same, you haven't identified a group of people.
19:25RaynesHow dare you say North Koreans aren't people.
19:25SegFaultAXBut "I'm happy to live in a city without any north koreans" is something else entirely.
19:25RaynesYou monster.
19:25TimMcI'm pretty sure "hipster" is just a general term for "I don't like this person and I can't defend my viewpoint".
19:25nopromptSegFaultAX: yeah i never said i hate hipsters. i just don't care to be around them.
19:25rhgcallen: good im not the only one
19:26SegFaultAXnoprompt: "Yea I never said I hate north koreans, I just don't care to be around them"
19:26callenI wouldn't want to be around them either, North Koreans kidnap people. And hipsters are smelly.
19:26RaynesOn the other hand, oh my good God who cares if he loves him some hipsters or not?
19:26rhg^
19:26RaynesThis is #clojure. Can we please move onnnnnn?
19:26SegFaultAXRaynes: Yup. But a separate issue still. :)
19:27RaynesIt isn't an issue. Go away.
19:27Raynes:p
19:27rhg#hipsters
19:27hyPiRionWelcome to #clojure-mosh-pit
19:27appendonlyi wore polos and whatever in college. a friend roped me into a small art event where we would take turns typing up a copy of a bill going through congress at the time. people probably thought i was some 'asshole hipster', but, how else could they judge me? it's an overly-broad category and as such, conveys almost no information about someone.
19:27appendonly(on a typewriter)
19:27callenappendonly: why the typewriter?
19:28RaynesTypewriters are hipster.
19:28gws"art event"
19:28TimMcTypewriters are pretty cool. I grew up with one. It was fun.
19:28appendonlycallen: it was loud and interesting. if we had a laptop it would have been a no-op
19:29callenappendonly: I think the TW blanketed you with hipster-ness.
19:29callenappendonly: I like your nick :)
19:30appendonlythe combinatorics of male fashion limit us to a few particular styles
19:30appendonlymore and more of them are hipster
19:30appendonlywell-groomed beard? game over
19:30appendonlyetc
19:31callenI wear polos. lol.
19:32RaynesI wear blue jeans and v-necks.
19:32hyPiRionWell, by today's standards, this guys is a hipster: http://www-formal.stanford.edu/jmc/jmcbw.jpg
19:32TimMchahaha
19:32hyPiRionThe glasses, the beard, the tie with weird symbols on. Man, what a hipster.
19:32rasmustohyPiRion: he was a hipster before it was cool
19:32TimMc/thread
19:33callengame over man, game over!
19:33nopromptSegFaultAX: here's the skinny: i've never met a person whom, upon fitting into my mental schema of what a hipster is, i really cared for. i've found these individuals to be generally boring and ingenuine. having these experiences my attitude towards the so-called hipster subculture is pretty negative. being unhappy in the presence of individuals you do not care for is a perfectly normal.
19:33hyPiRionMcCarthy to the rescue.
19:34rhgmove on plz
19:34rhgmhm
19:34callennoprompt: McCarthy ended the conversation.
19:34callenSegFaultAX: use Datomic!
19:34rasmustoSegFaultAX: I'm thinking about using sql for logging
19:34TimMc-> #hipster
19:34nopromptoh sorry, was typing.
19:34TimMcfor further blather
19:34nopromptcool
19:34rhgD:
19:34callenam I a hipster for using Datomic?
19:34SegFaultAXSeriously, as an industry, why haven't we moved on from eg CLF
19:35appendonlyi'm storing a large (4 billion +) collection of pointers. their values are monotonically increasing. what is a good data structure to store them in, that minimizes disk space used and has good cache locality?
19:35RaynesSegFaultAX, noprompt: http://thereisnoneed.com/
19:35nopromptRaynes: oh my fuck that's funny.
19:35SegFaultAXRaynes: Heh, I moved on like 10 minutes ago.
19:35appendonlyi only ever append values, not insert them or delete
19:35SegFaultAXRaynes: My jimmies are challenging to rustle.
19:35gwslol
19:35nopromptSegFaultAX: well i had moved on after i said i what i did.
19:36callenguys. no need for meta either.
19:36Raynescallen: wtf meta is importangt
19:36noprompti had to get callen up in here.
19:36callenyou just (reset! @converation nil)
19:36Raynes&(meta #'println)
19:36lazybot⇒ {:ns #<Namespace clojure.core>, :name println, :arglists ([& more]), :added "1.0", :static true, :doc "Same as print followed by (newline)", :line 3325, :file "clojure/core.clj"}
19:36noprompt*all allen
19:36callenconversation*
19:36nopromptdammit.
19:36nopromptnm.
19:36rasmusto,(import tang)
19:36clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: tang>
19:37hyPiRionappendonly: which pointers will be used most frequently? The last one, or is the lookup uniform?
19:37SegFaultAXnoprompt: PM'd
19:37hyPiRion*will be looked up
19:38appendonlyhyPiRion: arbitrary, typical use case will be random
19:38callenpretty sure I can rewrite this loop/recur into a reduce.
19:38callenIf so, I will be a happy person.
19:39nopromptRaynes: did that work?
19:40coventryHow can you have good cache locality with arbitrary lookups? Is there some kind of autocorrelation?
19:40appendonlycoventry: good point. the implication is that nearby values should be nearby on disk
19:41hyPiRionappendonly: I'd probably generate a 128/256-branching balanced tree for that sort of thing. There's no way you can get good cache locality with random behaviour though.
19:41hyPiRionmutable
19:41SegFaultAXcallen: Well, technically all forms of looping can be expressed as a reduction with enough pain. :)
19:42callenSegFaultAX: "with enough pain"
19:43callenSegFaultAX: I don't think you saw my wailing yesterday. It ain't pretty.
19:43appendonlyhyPiRion: what was my notion too. i think i will flatten the values at the leafs, though, because it will be densely populated
19:43coventryNearby in the sense that pointers to adjacent locations should be close? I'm curious about the application.
19:43hyPiRionappendonly: yeah, sounds like what I would've done
19:44hyPiRionNot that it's any guarantee for anything, though.
19:47appendonlycoventry: the pointers are added in increasing order
19:48noprompti just realized i've had peices of plant matter in my hair all day since pulling weeds this morning.
19:48nopromptthe horror.
19:48callenoh dude, I think I just converted it to a reduce.
19:49callenfoldl ftfw.
19:49callennoprompt: plant hipster.
19:49nopromptah dammit.
19:49callenonly hipsters care about plants. and trees. and green things.
19:49callenonly hipsters do anything other than suck soda and watch netflix.
19:49nopromptcallen: i care about getting to my frakin' orange tree w/o being molested by weeds.
19:50`cbpI am not ready for this image
19:52callengod that was deeply satisfying.
19:52callenconverted it to a reduce and the code is shorter and cleaner!
19:52technomancycan we move on to calling people hepcats yet?
19:52technomancyI've been saving up jokes.
19:53callendyslexic heaps of cats?
19:54technomancyhttps://en.wikipedia.org/wiki/Hepcat
19:54callenI know what a hepcat is, I'm just not a funny person :(
19:54technomancyoh oops
19:55callentechnomancy: do you keep bookmarks or links of all the webcomics you read?
19:55callenI need a better source of obscure references and library names. Naming things is hard.
19:56technomancyit's all up here
19:56nopromptcallen: you need a name?
19:56technomancythat said, ohnorobot.com is an invaluable resource
19:57nopromptcallen: what does the lib do?
19:57callennoprompt: anticipating future needs. I've had problems before.
19:57callensorry, nothing to name right now :)
19:57callennoprompt: but you'll be the first person I ping next time!
19:57noprompti'm working on something called "aoede"
19:58nopromptcause that sounds cool.
19:58callenso you...don't want anyone to use it?
19:58nopromptthe moons of jupiter have cool names.
19:58technomancyalmost fully dvorak-homerow
20:01callenI think can just make this whole program nested reduces and be done with it.
20:01`cbpshould just use java
20:01callen`cbp: I keel you
20:01noprompttechnomancy: my laptop keyboard is damaged because of my failed dvorak attempt. ;_;
20:02callenit's not worth being disabled when you use somebody elses keyboard.
20:02callenwhat if I have to desperately hack the Gibson before my friends are caught by corrupt government agents?!
20:04technomancyalways carry a hardware-dvorak mechanical keyboard with you on your escapades
20:04coventrySomehow, I can type fairly fluently in either layout.
20:06rasmustocallen: ahh, refresh is still biting me. Is there a special way to load up all project clj files when I first start the repl?
20:06callenrasmusto: ...all?
20:07rasmustocallen: er, I have a "core" file that has dependencies on a bunch of files
20:07callenoh I see, you have a default namespace.
20:07callenLeiningen has that.
20:07callenswitch to the namespace, then refresh.
20:08rasmustooh... I've been using the user ns all along, hmm
20:08callenI don't use (ns user)
20:08callenI didn't know that was significant or unusual, sorry.
20:09callenrasmusto: my repl inner loop looks like: tardis.storage-test> (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]])
20:09callenrasmusto: the content thereof being an emacs macro I jam on whenever I need nuke the universe.
20:09rasmusto"unable to resolve symbol: require in this context" ahh
20:09callenI put defs for experimental data in my test namespaces so they're there post refresh.
20:10rasmustoI'm seriously questioning my sanity atm, how did I ever have this working
20:12rasmustocallen: hm, I do the (require '[c.t.n.r]) (refresh) thing, and it still complains about one of my namespaces not existing
20:12callenrasmusto: https://github.com/bitemyapp/dotfiles/blob/master/.emacs.d/clojure/clojure-config.el#L48-L62
20:12callenrasmusto: which one? is it in your user profiles :dependencies? are you overriding the user profile in your project.clj?
20:12rasmustocallen: its one in my src dir
20:13callenwell that's on your ns decl and classpath man.
20:13callennothing to do with refresh.
20:13callenunless you ghosted a namespace it's trying to refresh or something. I don't know.
20:14rasmustoI hope I didn't ghost anything ;o
20:16callenrasmusto: you're not giving me much to work with here.
20:16rasmustocallen: hm, my classpath has projroot/src in it
20:17rasmustobut not its subdirectories
20:17coventryrasmusto: That's the way it ought to be.
20:17rasmustocoventry: okay, that's what I thought, since that's the lein template default
20:18rasmustocallen: you've helped enough, I'm just stumbling over something dumb
20:21callenrasmusto: I hope you figure it out, and when you do, please report back. :)
20:21rasmustocallen: absolutely, I think it has something to do with merged profiles and requires in my dev profile and too much stuff going on this friday and hipsters
20:22callenrasmusto: my world is filled with '(reduce reduce reduce reduce reduce) today ;)
20:24akurilin2Is doseq the right macro to use for going through a collection and using it for side-effects, or is there a better choice?
20:25rasmustoakurilin2: doseq is the right one
20:25callenakurilin2: on the nose.
20:25akurilin2rasmusto, callen, great, thank you gentlemen.
20:26rasmustoakurilin2: happy friday
20:26akurilin2rasmusto, I never know how to respond to that one.
20:26rasmustoclojurebot: happy friday
20:26clojurebotIt's greek to me.
20:27rasmustoakurilin2: yeah, idk. I don't normally talk like that, I'm just in a weird mood today
20:27rasmustoakurilin2: I think it was the iced coffee and condensed milk I had for lunch
20:28akurilin2rasmusto, doesn't sound too bad unless that's the only thing you had for lunch.
20:28rasmustoI had pho too
20:29TEttingerMSG madness?
20:29akurilin2Style talk: I get the impression that using let leads to higher readability when doing steps of operations that depend on each other. Should I feel bad for not threading everything as much as possible?
20:29callenpho is expensive broth. I do not understand it.
20:29callenakurilin2: Using let that way is fine. that's why it's the default instead of parallel let.
20:30callenakurilin2: if it's going to some extreme then you part out functions and destructure binding from the functions.
20:31akurilin2callen, is there a more idiomatic / recommended alternative to a thick let vector that I should at least consider? I'm just wondering if I'm missing out on something great since I don't know any better..
20:35akurilin2It's not really pressing, but I tend to get pretty obsessive over making the most out of the language.
20:36rasmustocallen: yeah, I prefer ramen, but it's a bit too heavy for a lunch
20:39callenakurilin2: it's just splitting off child functions.
20:40mmarczykdnolen: ping?
20:41akurilin2callen, that's fair.
20:42callenhella.
20:42callenakurilin2: I wish you could see my code right now, lol.
20:42akurilin2callen, as in, good or bad?
20:43callenakurilin2: best described using a quote from the horror sci-fi movie Event Horizon, "She tore a hole in our universe, a gateway to another dimension. A dimension of pure chaos. Pure... evil."
20:44callenakurilin2: with a sprinkling of, http://www.youtube.com/watch?v=Vmn9asN-8AE
20:44akurilin2callen, I love that video.
20:49callenakurilin2: but seriously. this code. THIS. CODE.
20:51rasmustocallen: ahhhh, its something
20:52rasmustoeither :aot, :main, or :profiles {:dev ...} in project.clj
20:52akurilin2I guess the next question is: did you make that happen, or can you point a finger, or are you planning to pay for that later?
20:52rasmustothat's messing me up
20:52coventryMy vote is it's clojure's fault and we should all go back to making starcraft clones in Haskell.
20:53rasmustocoventry: I think it's :aot :O
20:53rasmustooh no, it's :main, hmmm
21:01mmarczyka little advert:
21:01mmarczykdrop-in replacements for Clojure(Script)'s sorted maps and sets with transient variants and support for logarithmic time rank queries via clojure.core/nth -- https://github.com/michalmarczyk/avl.clj https://clojars.org/avl.clj
21:02mmarczykperf mostly on a par with the built-in versions
21:02rasmustocallen: :main ^:skip-aot {{my-main-ns}} may have fixed my issues
21:04callenrasmusto: weird. well then.
21:33dnolenmmarczyk: that's pretty cool!
21:35mmarczykdnolen: :-)
21:43dnolenI think we're in a good spot, just need to clean up the writing and add diagrams
21:44dnolenwe should also do the benchmarks a bit more rigorously
21:45mmarczykre: avl.clj, it's nice to see perf superior to the built-ins in some benchmarks on the Clojure side
21:45mmarczyknot a huge difference, but still; also, where the built-ins win, that's also not by a large margin
22:09mklappstuhlusing clojure.java.jdbc - is there a way to print a query instead of execute it or the like?
22:10gfredericksmklappstuhl: a non-answer is have you used honeysql?
22:10mklappstuhlnope, but I appreciate the headsup
22:11`cbpmklappstuhl: are you using jdbc/query?
22:11`cbpor with-connection
22:14mklappstuhl`cbp: actually something like this before: (sql/insert! db :stock day-data))
22:20callenmklappstuhl: http://github.com/bitemyapp/blackwater
22:20callenmklappstuhl: also if you use Korma, there's a sql-only macro.
22:20callenmklappstuhl: http://sqlkorma.com/
22:20callenmklappstuhl: blackwater works with c.j.j and Korma.
22:21callenmklappstuhl: have fun :)
22:21mklappstuhlcallen: thanks for the hints, I'll look at them later, right now I'm trying to keep deps low in order to 'get it' :)
22:23callenmklappstuhl: just read the code to c.j.j theb
22:23callenthen*
22:23callenmklappstuhl: you really should look at Korma though, it does precisely what you want.
22:23callenmklappstuhl: there's no inherent value to be gained in what I think you're angling at.
22:27`cbpmklappstuhl: hi sorry went afk for a bit. There's no way to print the sql atm with what you're using
22:27`cbpI think there's a jira ticket from like 2 years ago that asked for that
22:28`cbpmklappstuhl: If you used jdbc/query then the little dsl basically gets evalled to sql though
22:31mklappstuhl`cbp: thank you
22:31mklappstuhlcallen: I actually went with your advice and am taking a look at korma atm
22:33mklappstuhlhaving a problem defining two related entities though since both are used in the definitions and one has to go first
22:34danielszmulewiczI have a namespace I want to exclude from reloading (in a Stuart Sierra's reloaded setup). I'm reading about disable-reload!. I can't figure out where to call it. Everything fails.
22:36mgaaremklappstuhl: you can forward-declare both of them
22:37danielszmulewiczOK. I figured it out.
22:37danielszmulewiczCalled it from within the excluded namespace.
22:39mmarczykdanielszmulewicz: presumably you can also call it at the REPL or from project.clj's :repl-options {:init ...} with lein (or an init function you call yourself if you have one) so as to avoid depending on tools.namespace in your actual production code
22:39danielszmulewiczmmarczyk: Makes sense. Thank you.
22:39mmarczyknp
22:40callendanielszmulewicz: exclamation mark usually means "point and aim"
22:40callenmore poetically: "Point, aim, and pray"
22:40danielszmulewiczcallen: :-)
23:10mklappstuhlhow do I reload my current namespace and all the things required in it?
23:13chordis anyone here actually using clojure for something significant
23:14coventryYeah, I'm making a starcraft clone. I expect it to solve world hunger and cure cancer.
23:15mklappstuhlcoventry: cool, me too
23:16mklappstuhlis there a way to stop runtime execution in clojure similiar to ruby's pry gem?
23:17`cbpi use clojure at work to make pretty charts about stuff
23:19coventrymklappstuhl: There is the ritz debugger, and George Jahad's macro (see here https://coderwall.com/p/xayyvq). Nothing very fancy at this point.
23:29scottjWhat was the aurora thing ibdknox demoed at strangeloop? the mentions on twitter aren't very revealing
23:59Apage43happy little tries