2013-09-20
| 00:13 | coventry | Is there a history to (aset) not being called (aset!), despite mutating its argument? |
| 00:16 | brehaut | coventry: i would assume that its a) accidental b) implied because you are dealing with a mutable structure anyway. |
| 00:16 | brehaut | coventry: however, ! does not mean the same thing it does in say scheme; in clojure its specifically not safe for retrying |
| 00:17 | brehaut | coventry: (eg in the context of a transaction) |
| 00:17 | brehaut | eg send (to an agent) is safe but swap! (on an atom) is not |
| 00:19 | coventry | Ah, right. Thanks. |
| 00:36 | iamjarvo | what is the simples way to get Time.now ? using clj-time? |
| 00:37 | jared314 | (now) |
| 00:39 | iamjarvo | jared314: thanks |
| 00:39 | iamjarvo | i should update all the stack overflow threads haha |
| 00:42 | indigo | (later) |
| 00:50 | indigo | ,(now) |
| 00:50 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: now in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 00:51 | jared314 | (clj-time.core/now) |
| 00:51 | indigo | Ah yes, of course |
| 00:53 | havenwood | Just 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:54 | havenwood | Was curious why `time` reports "msecs" instead of typical "ms" initialism. Is there a logic behind it or just happenstance? |
| 00:55 | havenwood | https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L3493-3501 |
| 01:12 | iamjarvo | thoughts on the day-name fuction ?http://pastie.org/private/x7cfwbrjaditm3ibpphvpg |
| 01:13 | iamjarvo | wasnt sure if i should pass it in or just calculate it when called |
| 01:15 | chord | ok fine you guys don't want to help me make starcraft clone in clojure |
| 01:15 | chord | I'll do it myself |
| 01:15 | chord | whats the best link to start learning clojure |
| 01:16 | jared314 | iamjarvo: I thought there were constants for weekdays |
| 01:17 | iamjarvo | jared314: note sure i googled and didnt find anything |
| 01:17 | iamjarvo | i didnt find the (now) because i was looking at a fork i think |
| 01:22 | jared314 | iamjarvo: Sorry, I was thinking java (.getWeekdays (java.text.DateFormatSymbols.)) |
| 01:25 | jared314 | iamjarvo: you could do an (aget (.getWeekdays (java.text.DateFormatSymbols.)) (day-of-week (now))) |
| 01:27 | iamjarvo | seems less clean |
| 01:28 | jared314 | i also think it has an off by one error on my part |
| 01:28 | iamjarvo | i guess it can be wrapped in a function |
| 01:28 | iamjarvo | ahh i see |
| 01:31 | chord | i need starcraft |
| 01:31 | chord | someone help me make it |
| 01:32 | iamjarvo | jared314: what is the web app development ecosystem like with clojure? |
| 01:33 | Apage43 | i just run the commercial distribution of starcraft |
| 01:34 | chord | apage43 but starcraft 2 sucks shit |
| 01:34 | chord | we need to make a true spiritual successor to starcraft |
| 01:36 | jared314 | iamjarvo: can't answer that. I use enlive, composure, dieter, and friend (when I have to) |
| 01:36 | iamjarvo | ahh i see |
| 01:37 | jared314 | iamjarvo: i have not used pedestal yet, so it may be good |
| 01:37 | iamjarvo | what do you use the language for? |
| 01:38 | jared314 | iamjarvo: i'm still working on that |
| 01:38 | iamjarvo | kk |
| 01:56 | jared314 | iamjarvo: (.toString (now) "EEEE") |
| 01:58 | iamjarvo | will get the weekday? |
| 01:59 | jared314 | (.toString (now) "EEEE") ;=> "Friday" |
| 01:59 | iamjarvo | what is the "EEEE" about? |
| 01:59 | jared314 | http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html |
| 02:36 | ddellacosta | hmm, I'm not going to be able to call reduce on a (CLJS) PushbackReader, am I? |
| 02:39 | ddellacosta | I guess it has to implement...IPersistentCollection? |
| 02:39 | ddellacosta | hmm |
| 02:40 | jared314 | ISeqable? |
| 02:43 | jared314 | you could try extend-type with ISeqable |
| 02:43 | ddellacosta | jared314: 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:43 | Apage43 | ddellacosta: what behavior are you expecting, exactly? |
| 02:43 | Apage43 | There might be something that does what you want |
| 02:44 | ddellacosta | Apage43: 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:44 | Apage43 | repeatedly might be handy here |
| 02:45 | ddellacosta | Apage43: 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:45 | Apage43 | &(doc repeatedly) |
| 02:45 | lazybot | ⇒ "([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:45 | Apage43 | or whatever the heck |
| 02:45 | ddellacosta | Apage43: ah, interesting... |
| 02:46 | ddellacosta | Apage43: 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:47 | ddellacosta | anyways, I'm probably trying too hard to get something cleaner than it really needs to be. |
| 02:47 | Apage43 | (into your-vector (take-while (still-have-stuff?) (repeatedly (get-stuff)))) |
| 02:48 | Apage43 | actually that's kind of bad |
| 02:49 | Apage43 | (into your-vector (take-while identity (repeatedly #(if (more-stuff?) (get-stuff))))) |
| 02:49 | Apage43 | perhaps |
| 02:50 | Apage43 | no idea what I'm on about here, I'm just barfing code |
| 02:50 | ddellacosta | Apage43: haha… |
| 02:50 | ddellacosta | Apage43: no, I appreciate the attempts. I have to absorb these techniques and see if they are applicable. |
| 02:51 | Apage43 | anyway (into collection other-collection) will conj all the things in other-collection into collection and return it |
| 02:51 | Apage43 | ,(into [1 2 3] [4 5]) |
| 02:51 | clojurebot | [1 2 3 4 5] |
| 02:51 | Apage43 | ,(into (list 1 2 3) [4 5]) |
| 02:51 | clojurebot | (5 4 1 2 3) |
| 02:51 | Apage43 | using reduce on the inside |
| 02:53 | borkdude | Is there something for edn datastructures which prints nested datastructures like a tree/directory structure like this? http://mbraak.github.io/jqTree/#introduction |
| 02:55 | Apage43 | if 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:56 | borkdude | Apage43 normal text would be ok too, just from the repl |
| 02:56 | Apage43 | clojure.pprint/pprint ? |
| 02:56 | borkdude | I often need to search in a list of maps, which gets hard when they are printed all on the same line for example |
| 02:56 | borkdude | then this would be useful |
| 02:56 | Apage43 | you want pprint |
| 02:57 | Apage43 | also lives in clojure.repl |
| 02:57 | borkdude | Apage43 sure, but say I have a list of maps with 100 keyvals each, how do I print them nicely? |
| 02:57 | Apage43 | ah |
| 02:57 | borkdude | 10 keyvals each is more realistic sorry |
| 02:57 | Apage43 | are 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:58 | borkdude | pretty much the same keys yes |
| 02:58 | jared314 | are you talking about the json on the left, or the collapsable widget on the right? |
| 02:58 | ddellacosta | Apage43: 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:59 | Apage43 | yeah |
| 02:59 | Apage43 | I'd write |
| 02:59 | ddellacosta | Apage43: otherwise, that is an awesome way to do it. :-p |
| 03:00 | Apage43 | (take-while identity (repeatedly #(read {:eof false} your-reader))) |
| 03:00 | borkdude | hmm print table works, I think only when the first maps contains all the "columns" |
| 03:00 | Apage43 | or, more correctly |
| 03:00 | borkdude | jared314 on the left would be ok |
| 03:00 | ddellacosta | Apage43: the thing is, I'm already returning nil…shouldn't that fail out as is? Confused by how repeatedly behaves in that case. |
| 03:01 | Apage43 | (let [eof-sentinel (Object.)] (take-while #(not= eof-sentinel %) (repeatedly #(read {:eof eof-sentinel} your-reader)))) |
| 03:01 | Apage43 | if you want to be able to read false |
| 03:01 | Apage43 | ddellacosta: yeah, nil works as well as false |
| 03:02 | borkdude | yesterday I had a case in which false should be treated as a value, instead of nontruthy.. very confusing |
| 03:03 | ddellacosta | Apage43: thanks, I'm starting to get it. Very helpful! |
| 03:03 | borkdude | https://github.com/myfreeweb/clj-configurator/pull/2 |
| 03:04 | Apage43 | heh, that Object. sentinel truck probably doesn't work in CLJS though |
| 03:04 | Apage43 | but if you don't need to read falsy things, you should be fine |
| 03:07 | Apage43 | borkdude: In the past I've just copied print-table and modified it. It's a nifty piece of code to look at anyway |
| 03:07 | Apage43 | https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/print_table.clj |
| 03:08 | Apage43 | you'll also notice you can hand it a list of keys |
| 03:08 | Apage43 | (print-table [:k1 :k2 :k3] list-of-maps) will print a table with those keys |
| 03:08 | borkdude | Apage43 ah you can pass the keys you want to see… this is what I need… again ;) |
| 03:08 | Apage43 | (and only those keys, so its nice for getting a filtered view) |
| 03:09 | borkdude | ,(clojure.pprint/print-table [:dog :goo :extra] [{ :dog 123 :goo 123} {:dog 123 :goo " dude" :extra 4}]) |
| 03:09 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.pprint> |
| 03:09 | borkdude | nice |
| 03:10 | ddellacosta | Apage43: 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:12 | Apage43 | take-while is lazy |
| 03:12 | hashcat | Hi, Can I get a return type and parameter types of a function? |
| 03:12 | Apage43 | it only realizes one more element than it passes out |
| 03:13 | hashcat | It may be (type-parameters +) [Int,Int] |
| 03:14 | ddellacosta | Apage43: hmm, okay, I see. |
| 03:14 | ddellacosta | Apage43: 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:16 | Apage43 | (cf +) => (Fn [t/AnyInteger * -> t/AnyInteger] [Number * -> Number]) |
| 03:16 | Apage43 | (in clojure.core.typed, anyhow) |
| 03:17 | hashcat | Apage43: Thanks a lot, I've tried meta and reflect for several hours |
| 03:18 | Apage43 | well, that again, is only a feature of clojure.core.typed, an optional type system as a clojure *library* |
| 03:18 | Apage43 | not part of the core |
| 03:18 | ddellacosta | Apage43: there we go: (into [] (take-while #(not= nil %) (repeatedly #(cljs.reader/read my-reader false nil false)))) |
| 03:19 | Apage43 | regular clojure is not statically typed |
| 03:19 | Apage43 | aww yeah! |
| 03:20 | hashcat | did that mean I can't get valid parameters of a function in core lang? |
| 03:20 | Apage43 | I haven't really touched cljs much, glad it worked |
| 03:20 | Apage43 | hashcat: correct |
| 03:20 | Apage43 | other than by looking at its docs |
| 03:20 | ddellacosta | Apage43: yeah, thanks very much, again. :-) This is much nicer than what I had before, and still easy to read. |
| 03:21 | hashcat | Apage43: thanks again, I'm trying to generate a valid expression of clojure code randomly :) |
| 03:21 | Apage43 | huh |
| 03:21 | Apage43 | interesting problem |
| 03:22 | borkdude | could it be that the github app fetches commits from other branches in the background? |
| 03:23 | borkdude | I 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:23 | Apage43 | i have no context for that comment, but I think it does something like that |
| 03:23 | Apage43 | basically the equivalent of typing "git remote update" |
| 03:23 | Apage43 | which fetches all branches from all remotes |
| 03:24 | borkdude | nice, thanks |
| 03:25 | Apage43 | a 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:26 | borkdude | yes |
| 03:26 | Apage43 | either 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:26 | borkdude | gtg for a moment |
| 04:33 | chord | STARCRAFT CLONE IN CLOJURE |
| 04:33 | chord | JOIN ME MY FRIENDS |
| 04:39 | chord | is anyone going to answer my call? |
| 04:45 | ddellacosta | chord: lead by example |
| 04:46 | chord | i'm not an expert at clojure :( |
| 04:46 | ddellacosta | chord: well, then I guess you've got some studyin' and practicin' to do! Good luck. |
| 04:47 | ddellacosta | chord: anyways, sounds like a great way to become an expert, huh? |
| 04:50 | chord | ddellacosta: you going to train me in clojure? |
| 04:50 | ddellacosta | chord: no |
| 04:50 | ddellacosta | chord: although, I'll consider it if you pay me enough |
| 04:51 | clgv | chord: there are pretty decent books that can give you a headstart learning clojure ;) |
| 04:53 | chord | clgv: what is the best book to start learning clojure |
| 04:53 | chord | ddellacosta: train me in clojure and you get part control of starcraft clone that should pay |
| 04:54 | clgv | chord: the most up-to-date good book is imo "Clojure Programming" |
| 04:54 | chord | clgv: do I have to pay for that? |
| 04:55 | clgv | chord: it costs only around 30 euro. yeah you have to otherwise Chas will haunt you :P |
| 04:56 | chord | clgv: nope not paying |
| 04:56 | chord | clgv: fuck it too late already searching for warez |
| 05:01 | chord | clgv: can you find me a download copy of the book for free |
| 05:02 | clgv | chord: definitely not! |
| 05:02 | chord | clgv: why not |
| 05:04 | Apage43 | I'll find one for $36 US ;) |
| 05:06 | clgv | Apage43: I rounded up the price I found on amazon ;) |
| 05:06 | muhoo | oh 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:06 | muhoo | (local-unset-key (kbd "C-c C-c")) isn't working |
| 05:07 | Apage43 | I was looking at o'reilly. And noticed they'll deliver it straight to my Dropbox, which is nifty |
| 05:11 | seangrov` | ddellacosta: ping |
| 05:12 | ddellacosta | seangrov`: pong |
| 05:12 | ddellacosta | seangrov`: what's up? |
| 05:18 | seangrov` | ddellacosta: Curious to hear your idea (or get some couter-ideas) on our pre-clojure cup idea |
| 05:19 | ddellacosta | seangrov`: sure, definitely! Would love to hear. |
| 05:21 | seangrov` | 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:22 | schmir | muhoo: try (define-key nrepl-mode-map (kbd "C-c C-c") nil) |
| 05:23 | ddellacosta | seangrov`: 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:24 | seangrov` | On deploy, you would send the sourcemap and a random hash (or deterministic) to the error reporting server |
| 05:24 | seangrov` | Then in clojurescript, you would report variables with a try/catch and the same hash |
| 05:24 | seangrov` | The hash would be written at deploy time via some lein plugin |
| 05:24 | ddellacosta | seangrov`: I see, the hash is your application key? |
| 05:24 | seangrov` | It's the source version |
| 05:25 | ddellacosta | ah, okay, gotcha... |
| 05:26 | ddellacosta | seangrov`: 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:28 | seangrov` | ddellacosta: Exactly |
| 05:28 | seangrov` | So you can use them in production, but not expose your code to clients |
| 05:28 | ddellacosta | seangrov`: 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:29 | seangrov` | 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:29 | ddellacosta | seangrov`: 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:30 | ddellacosta | you'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:31 | clj_newb_2345 | does clojure have any "erlang" style shared nothing programming style for clojure progs that run across multiple JVMs (on different machines)? |
| 05:31 | seangrov` | ddellacosta: I think getting browser version, etc is fine |
| 05:31 | clj_newb_2345 | if so, what is a good tutorial / list of libraries |
| 05:33 | ddellacosta | seangrov`: 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:34 | seangrov` | ddellacosta: (super-try ... (catch (report "message" {:data :you-care-about}))) |
| 05:35 | clgv | clj_newb_2345: there was a lib for distribute refs using zookeeper. but apart from that I do not remember anything significant |
| 05:35 | ddellacosta | seangrov`: yeah, so, that would be the app developers responsibility? I suppose that makes sense... |
| 05:40 | noidi | clj_newb_2345, https://github.com/liebke/avout this is the lib clgv mentioned |
| 05:42 | mercwithamouth | what framework(s) do you guys like? i'm looking at compojure but i see there haven't been any updates in 4 months |
| 05:44 | seangrov` | ddellacosta: Just optional data to be sent if desired |
| 05:45 | ddellacosta | mercwithamouth: compojure is pretty simple and stable at the moment. |
| 05:45 | scottj | mercwithamouth: compojure is highly recommended. maybe also checkout pedestal. |
| 05:45 | philar | #luminius #pedestal |
| 05:46 | mercwithamouth | ddellacosta: hmmm good to hear! i haven't heard of pedestal...taking a look now |
| 05:46 | ddellacosta | seangrov`: gotcha. In any case, this sounds like it could be a nice service, one I would potentially be interested in! |
| 06:05 | sm0ke | How can i run my project such that it hot reloads changes,...and restarts if necessary? |
| 06:06 | mpenet | clj_newb_2345: there is exoref too for something more lightweight |
| 06:16 | tadywk | Ahem |
| 06:16 | tadywk | is this on? |
| 06:18 | clj_newb_2345 | clgv, noidi: thanks |
| 06:19 | tadywk | quit |
| 06:19 | tadywk | hah! |
| 06:19 | tadywk | IRC fail |
| 06:26 | chord | everyone here is dumb or stupid? |
| 06:31 | clgv | chord: making friends on the fast track? :P |
| 06:32 | chord | clgv: you can't have friends without having enemies |
| 06:33 | chord | the bad comes with the good |
| 07:24 | sm0ke | hello i am using httpkit why there is no on-open event? |
| 07:32 | bordatoue | hello, 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:33 | sm0ke | bordatoue: did you do 'lein deps'? |
| 07:34 | bordatoue | sm0ke: yes, it appears in the classpath when i exec lein classpath |
| 07:55 | wei_ | how do I get a long timestamp from an #inst? |
| 07:59 | wei_ | ,(.getTime #inst "2013-09-20T08:21:33.128-00:00") |
| 07:59 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 08:03 | bordatoue | say if I have a library clj-getopts , how do I know the name of its class to load in repl |
| 08:06 | TEttinger | bordatoue, it's probably in the docs for the clojure lib you are using |
| 08:06 | TEttinger | clj-getopts |
| 08:07 | TEttinger | and you'll probably need the ns (namespace) not the class |
| 08:07 | bordatoue | TEttinger, I couldn't find the doc for some libraries I've downloaded from clojar. For example clj-getopts |
| 08:08 | bordatoue | TEttinger, 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:08 | TEttinger | it looks like that is an outdated lib, not sure yet |
| 08:08 | francis_wolke | GoogIing 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:08 | francis_wolke | when desgining a programming language?. More concretely, is there anything |
| 08:08 | francis_wolke | you lose the ability to express that another syntactical scheme offers?" |
| 08:10 | TEttinger | gaaaah |
| 08:10 | TEttinger | https://github.com/kognate/clj-getopt |
| 08:10 | TEttinger | francis_wolke, s-exps are really handy for any language that uses macros. |
| 08:11 | TEttinger | if you don'y have macros, eh, they're still very powerful |
| 08:11 | bordatoue | TEttinger, in the readme file author doesn't say anything about loading a .clj file |
| 08:11 | TEttinger | (ns clj-getopts.core |
| 08:11 | TEttinger | it's kinda a badly named github repo |
| 08:12 | francis_wolke | TEttinger: 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:12 | bordatoue | TEttinger, how did you find it out |
| 08:12 | TEttinger | bordatoue, looked at the first line of the source |
| 08:12 | augustl | francis_wolke: I hear "but the customer is able to read my Java/Groovy/Ruby/.. code" a lot :) |
| 08:12 | TEttinger | https://github.com/kognate/clj-getopt/blob/master/src/clj_getopts/example.clj |
| 08:12 | bordatoue | TEttinger, nice |
| 08:13 | bordatoue | TEttinger, I was thinking about listing in files in .jar and then trying it in repl |
| 08:13 | TEttinger | heh, you can also extract a jar |
| 08:13 | TEttinger | the folders correspond to parts of namespaces |
| 08:14 | bordatoue | TEttinger, looking at the source for a library to figure out the loading class isn't always possible |
| 08:14 | TEttinger | yeah, but clojure often has source in the jar |
| 08:14 | bordatoue | TEttinger, even when you do uberjar |
| 08:14 | TEttinger | not sure |
| 08:15 | TEttinger | I think it can be set in project.clj |
| 08:15 | bordatoue | TEttinger:, thanks very much |
| 08:15 | TEttinger | no prob |
| 08:16 | TEttinger | set 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:17 | TEttinger | (older less technical relative) |
| 08:19 | TEttinger | I feel good about helping two people tonight |
| 08:25 | seangrov` | How can I test if something is a boolean? |
| 08:26 | seangrov` | I explicitely want to check for boolean |
| 08:26 | Bronsa | seangrov` boolean as opposed to Boolean? |
| 08:32 | mpenet | ,(instance? Boolean "a") |
| 08:32 | clojurebot | false |
| 08:33 | hyPiRion | (some-fn true? false?) is also nice, I think |
| 08:33 | hyPiRion | ,(let [boolean? (some-fn true? false?)] (map boolean? [true false :a 1 "ten"])) |
| 08:33 | clojurebot | (true true false false false) |
| 08:34 | Bronsa | #{true false |
| 08:34 | Bronsa | #{true false} |
| 08:34 | mpenet | ,(contains? #{true false} false) |
| 08:34 | clojurebot | true |
| 08:34 | mpenet | :) |
| 08:34 | hyPiRion | Bronsa: was about to say that (#{true false} false) returns false :) |
| 08:35 | hyPiRion | ,(contains? #{true false} (Boolean. true)) |
| 08:35 | clojurebot | true |
| 08:35 | mpenet | but instance? seems like the same choice |
| 08:35 | mpenet | sane* |
| 08:35 | hyPiRion | what |
| 08:35 | hyPiRion | ,(true? (Boolean. true)) |
| 08:35 | clojurebot | false |
| 08:35 | mpenet | the Boolean constructor is evil |
| 08:36 | Bronsa | :| |
| 08:36 | Bronsa | oh. |
| 08:36 | hyPiRion | I love it. It makes wonderful problems |
| 08:36 | Bronsa | hyPiRion: true is a Boolean/TYPE |
| 08:36 | Bronsa | persistentcollections box their items |
| 08:37 | mpenet | ,(Boolean/valueOf false) |
| 08:37 | clojurebot | false |
| 08:37 | mpenet | "Returns a Boolean instance representing the specified boolean value." I wonder what's the use for this |
| 08:37 | mpenet | |
| 08:37 | hyPiRion | Bronsa: ? |
| 08:38 | hyPiRion | ,#{(Boolean. false) false} |
| 08:38 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: false> |
| 08:38 | sm0ke | guys any good intro to core.async? |
| 08:38 | hyPiRion | ,(false? (first #{(Boolean. false)})) |
| 08:38 | clojurebot | false |
| 08:38 | mpenet | sm0ke: https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj this is relatively good |
| 08:39 | Bronsa | hyPiRion: false? tests for Boolean/FALSE that is a boolean not a Boolean |
| 08:39 | Bronsa | when you put a boolean in a collection, it get boxed to a Boolean |
| 08:40 | sm0ke | mpenet: 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:41 | Bronsa | hyPiRion: I'm not sure anymore of what I just said. |
| 08:41 | sm0ke | well i see its full of useful comments anyways |
| 08:42 | sm0ke | also is avout still in development? or any other project for distributed states? |
| 08:43 | hyPiRion | Bronsa: 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:44 | hyPiRion | ,(identical? Boolean/FALSE (Boolean. false)) |
| 08:44 | clojurebot | false |
| 08:44 | hyPiRion | ,(identical? Boolean/FALSE (Boolean/valueOf false)) |
| 08:44 | clojurebot | true |
| 08:44 | Bronsa | I see |
| 08:48 | mpenet | sm0ke: it's modeled after golang and csp yes |
| 08:50 | mpenet | sm0ke: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html |
| 08:50 | sm0ke | mpenet: thanks! |
| 08:53 | seangrov` | Looking for a cleaner way of mapping and filtering: https://www.refheap.com/184e1baa1b12bbb59056286ff |
| 08:53 | seangrov` | Any suggestions? |
| 08:56 | hyPiRion | (for [[coordinate present?] (map vector coordinates is-present) :when present?] coordinate) |
| 08:59 | seangrov` | hyPiRion: that seems nice |
| 09:03 | scottj | (set (filter second (map vector all-coordinates present-coordinates))) ; does this work? |
| 09:05 | scottj | nevermind |
| 09:05 | hyPiRion | no, you'd have to unwrap the vector again |
| 09:05 | mercwithamouth | exit |
| 09:06 | silasdavis | when you have side-effecty stuff like in cheshire (add-encoder java.net.URL encode-str) |
| 09:06 | silasdavis | where's a nice place to put it |
| 09:06 | silasdavis | any principals? |
| 09:06 | silasdavis | les |
| 09:09 | grn | hi! what do you think about basing a startup on clojure? |
| 09:11 | `cbp | silasdavis: I just put it in an init function of some sort |
| 09:11 | hyPiRion | grn: 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:11 | hyPiRion | *they've |
| 09:11 | `cbp | silasdavis: like somewhere inside -main |
| 09:14 | jstew | grn: 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:15 | prof-freud | \part |
| 09:15 | prof-freud | gah |
| 09:15 | hyPiRion | oh yeah |
| 09:18 | p14n | grn: http://www.paulgraham.com/avg.html |
| 09:18 | p14n | may be of interest |
| 09:24 | sm0ke | hello which logging api is used commonly? |
| 09:24 | sm0ke | in clojure? |
| 09:25 | mdrogalis | sm0ke: It gets abstracted over. See clojure.tools.logging |
| 09:25 | mdrogalis | The underlying library doesn't matter. |
| 09:25 | sm0ke | thanks agains |
| 09:30 | silasdavis | in require I can't do (clojure [java.io :as io] [set :as set]) |
| 09:30 | silasdavis | is there a concise way of adding subpackages? |
| 09:31 | silasdavis | seems I can't do (clojure (java [io :as io])) |
| 09:33 | rurumate | I want to do this: (-> [] (when (= 1 2) (conj 12)), but the result should never contain nil |
| 09:33 | rurumate | ,(-> [] (when (= 1 2) (conj 12)) |
| 09:33 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 09:33 | rurumate | ,(-> [] (when (= 1 2) (conj 12))) |
| 09:33 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$conj> |
| 09:34 | rurumate | (-> [] (conj (when (= 1 2) 12))) |
| 09:34 | rurumate | ,(-> [] (conj (when (= 1 2) 12))) |
| 09:34 | clojurebot | [nil] |
| 09:34 | rurumate | sorry, that was what I meant |
| 09:35 | rurumate | this is possible: |
| 09:35 | rurumate | ,(-> [] (concat (when (= 1 2) [12]))) |
| 09:35 | clojurebot | () |
| 09:35 | rurumate | but it creates a vector around 12, which is a waste |
| 09:37 | sm0ke | hello 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:37 | silasdavis | I think that your best option, nil can represent an empty sequence, but seems like you want it to represent a zero-length element |
| 09:38 | sm0ke | i still dont understand why clojure doesnt have pattern matching? |
| 09:38 | silasdavis | which would give you difficulties when you really want to conj a nil element |
| 09:38 | rurumate | sm0ke: there is https://github.com/clojure/core.match |
| 09:39 | rurumate | so, is there a way to do a "conditional conj"? (like described above) |
| 09:40 | rurumate | something like (defn cconj [coll x] (if x (conj coll x) coll)) |
| 09:40 | silasdavis | rurumate, you could write one, but I think the concat version is better |
| 09:41 | rurumate | there should be something available here, imo. maybe flatland/useful has something |
| 09:41 | silasdavis | rurumate, are you worried about time or space? |
| 09:42 | silasdavis | I doubt they're very different |
| 09:42 | silasdavis | in fact I suspect the vector version might be faster |
| 09:42 | silasdavis | benchmark it |
| 09:42 | rurumate | silasdavis: both, of course; creating a vector without need is a waste of both |
| 09:42 | silasdavis | rurumate, cconj introduces an additional branch, and means your reader has to look up cconj |
| 09:43 | silasdavis | so the human time complexity is much worse |
| 09:43 | rurumate | silasdavis: ok, then I guess I'm worried about space and gc here |
| 09:44 | silasdavis | you could nil squeeze the final collection afterwards |
| 09:44 | silasdavis | or on consumption |
| 09:44 | silasdavis | with a reducer |
| 09:44 | silasdavis | (remove nil? coll) |
| 09:45 | xeqi | &(cond-> [] (= 1 2) (concat [12])) |
| 09:45 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: cond-> in this context |
| 09:45 | xeqi | ,(cond-> [] (= 1 2) (concat [12])) |
| 09:45 | clojurebot | [] |
| 09:45 | mercwithamouth | hrmm can someone explain 'reduce' to me like you would to a 5 year old? =P |
| 09:45 | mercwithamouth | (reduce max [0 -3 10 59]) |
| 09:45 | hiteki | hi |
| 09:46 | mercwithamouth | &(reduce max [0 -3 310 3144]) |
| 09:46 | lazybot | ⇒ 3144 |
| 09:46 | mercwithamouth | &(max [0 -3 310 3144]) |
| 09:46 | lazybot | ⇒ [0 -3 310 3144] |
| 09:46 | zakwilson | That's probably not the best use case, as apply has the same result. |
| 09:47 | zakwilson | Reduce 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:48 | mercwithamouth | zakwilson: ahh i see |
| 09:48 | silasdavis | mercwithamouth, 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:49 | zakwilson | There'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:49 | mercwithamouth | silasdavis: so basically reduce is like saying "give me a little bit at a time" ? |
| 09:49 | xeqi | mercwithamouth: 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:49 | silasdavis | map and reduce both give one element at a time to the function they are called with |
| 09:50 | mercwithamouth | xeqi: ah hah...now that makes perfect sense. |
| 09:50 | zakwilson | mercwithamouth: no. The key point of reduce is that it holds on to the value produced by the last application of the function. |
| 09:50 | mercwithamouth | yeah map i'm used to from ruby...i've never used 'reduce' |
| 09:50 | xeqi | mercwithamouth: reduce is called inject in ruby fwiw |
| 09:50 | silasdavis | ruby's inject is reduce |
| 09:50 | tbaldridge | which is a horrible name for reduce, btw |
| 09:51 | silasdavis | actually it aliases reduce too |
| 09:51 | mercwithamouth | ah...gotcha. i do know 'inject' |
| 09:51 | silasdavis | I prefer foldl |
| 09:53 | mercwithamouth | silasdavis: i'm slightly familiar with foldl/foldr from my scala stint. Is fold better performance wise? |
| 09:54 | zakwilson | If + only took two arguments, you might want a sum function that takes more and you would define it with reduce. |
| 09:54 | zakwilson | ,(reduce + [1 2 3 4 5 6]) |
| 09:54 | clojurebot | 21 |
| 09:56 | silasdavis | mercwithamouth, foldl == reduce and recurses on the function result, foldr recurses in the argument |
| 09:57 | silasdavis | this may have an impact on stack space because you may be able to calculate intermediate results in some places |
| 09:57 | silasdavis | mind you I don't think real world implementation of foldl/reduce actually niavely recurse so it's probably irrelevant |
| 09:57 | mercwithamouth | i see ...a little. Cool |
| 10:00 | silasdavis | (+ 1 (+ 2 (+ 3 4)))) vs (+ (+ (+ 1 2) 3) 4) |
| 10:00 | silasdavis | foldr is the first one, foldl is the other more familiar one |
| 10:01 | mercwithamouth | ahh thats better |
| 10:01 | silasdavis | for (fold<r/l> + [1 2 3 4]) |
| 10:02 | silasdavis | foldr has to recurse to the end of the list in the argument before any + application can return |
| 10:03 | mercwithamouth | i gotcha...much more expensive |
| 10:04 | BigTom | noob emacs/nrepl question |
| 10:04 | mercwithamouth | are there any plus sides to foldr? |
| 10:04 | BigTom | if 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:05 | BigTom | If I work through the indicated symbols with C-c C-e it will eventually comile |
| 10:06 | BigTom | any thoughts on what I'm doing wrong? |
| 10:06 | silasdavis | mercwithamouth, 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:06 | silasdavis | I don't know how that works exactly |
| 10:06 | xeqi | BigTom: are you refering to a var that gets defined lower in the file? |
| 10:06 | BigTom | yes |
| 10:07 | BigTom | well, a defn |
| 10:08 | xeqi | clojure 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:08 | xeqi | you should either move the function up or use ##(doc declare) |
| 10:08 | lazybot | ⇒ "Macro ([& names]); defs the supplied var names with no bindings, useful for making forward declarations." |
| 10:08 | silasdavis | mercwithamouth, you can create a foldl from foldr: http://www.haskell.org/haskellwiki/Foldl_as_foldr |
| 10:09 | BigTom | xeqi: OK, thanks, thought it might be something like that but couldn't find it |
| 10:10 | BigTom | Is that true whenever compiling? or just in the repl? |
| 10:10 | mercwithamouth | haskell...scary |
| 10:10 | xeqi | BigTom: all the time |
| 10:11 | mercwithamouth | though admittingly they have some of the best documentation for functional concepts |
| 10:11 | BigTom | xeqi: Cheers |
| 10:13 | mercwithamouth | ok 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:20 | silasdavis | mercwithamouth, 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:21 | silasdavis | ruby does have some of the best dryness though |
| 10:21 | silasdavis | but when you've monkey-patched the eigenclass of something one too many times. Pain. |
| 10:22 | Pupnik_ | dryness? |
| 10:22 | mercwithamouth | Dont Repeat Yourself |
| 10:22 | mercwithamouth | DRY |
| 10:22 | Pupnik_ | ah |
| 10:30 | mercwithamouth | so 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:33 | zakwilson | I'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:33 | zakwilson | Oh, and a blurry photo detector, and a crude image similarity test. |
| 10:37 | mercwithamouth | zakwilson: hmm interesting stuff! |
| 10:37 | jstew | Ruby's a pretty good Object Oriented langage that even borrows some ideas from lisp. Disclaimer: I'm a full time Rubyist learning clojure. |
| 10:37 | mercwithamouth | i 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:38 | mercwithamouth | jstew: how do you like it so far? |
| 10:39 | zakwilson | https://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:39 | terom | I'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:39 | jstew | mercwithamouth: 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:40 | jstew | mercwithamouth: 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:42 | mercwithamouth | i really have to start tackling euler...i run from math. that has to stop |
| 10:43 | zakwilson | I 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:43 | jstew | mercwithamouth: 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:44 | jstew | mercwithamouth: 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 | `cbp | I'll have to disagree with that a bit :P |
| 10:45 | mercwithamouth | jstew: i'll take a look but i really do want/need to step my ability to solve math related problems |
| 10:46 | mercwithamouth | on that note it's time to disappear for a while |
| 10:46 | jstew | `cbp: Indeed. My "real world" is not everyone elses. |
| 10:46 | `cbp | code jam has a lot of probability, combinatorics, number theory and geometry problems |
| 10:48 | jstew | Interesting. I did not know that. Now I'm a little more interested in it. |
| 10:49 | zakwilson | The 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:50 | zakwilson | (and expressed in APL, they probably would) |
| 10:54 | bordatoue | if 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 | `cbp | bordatoue: select-keys |
| 10:56 | bordatoue | cbp: thanks, |
| 10:57 | `cbp | or (juxt :k1 :k2 :k3) |
| 10:58 | bordatoue | `cbp: is there way to format it using print |
| 10:59 | `cbp | bordatoue: what do you want the print to look like? |
| 10:59 | bordatoue | `cbp: for example if i want the (print key\tvalue key\tvalue ) |
| 11:01 | `cbp | bordatoue: Then you would use a doseq like (doseq [[k v] (select-keys..)] (print (str k "\t" v "\t")) |
| 11:02 | bordatoue | `cbp: but that will print a line for each key |
| 11:04 | `cbp | bordatoue: no it wont :P |
| 11:06 | bordatoue | `cbp: could you please tell me why, I thought doseq would iterate over the map |
| 11:07 | `cbp | bordatoue: have you tried it? doseq does iterate through the map but print doesnt print any newlines |
| 11:07 | bordatoue | `cbp: yes, i was think about py print |
| 11:10 | arkh | for clojurescript, has anyone ever seen different code behavior between advanced optimizations enabled / disabled? |
| 11:10 | arkh | I can override a goog closure method if optimizations are disabled, but if enabled it ignores my override |
| 11:16 | seangrov` | arkh: What are you trying to override? |
| 11:18 | arkh | seangrov`: goog.fx.Dragger, the defaultAction method as described here: http://docs.closure-library.googlecode.com/git/class_goog_fx_Dragger.html |
| 11:18 | arkh | (aset d "defaultAction" (fn [x y] nil)) |
| 11:19 | arkh | by 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:29 | seangrov` | 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:30 | seangrov` | arkh: What about (set! (.-defaultAction d) (fn [x y] nil))? |
| 11:32 | seangrov` | That should be picked up by the advanced compiler |
| 11:32 | seangrov` | arkh: Generally, be aware of when you're using strings vs property accessors, and know which will be munged and while will remain |
| 11:35 | arkh | seangrov`: 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:37 | arkh | duh - makes sense, though. Of course the string would be the one that's invalidated, not the symbol |
| 11:38 | dnolen | seangrov`: it's probably ok but seems like gratuitous use of extend-type, I posted my preferred answer for this case |
| 11:45 | BlankVerse | I am trying to run a old clojure project from https://github.com/gmwils/mahoutinaction/blob/master/project.clj, uses clojure 1.2.1 ... |
| 11:45 | BlankVerse | on running lein deps , I get |
| 11:45 | BlankVerse | java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.PersistentVector |
| 11:52 | Ox6abe | Anyone have experience calling leiningen from a rakefile ? |
| 11:56 | llasram | Ox6abe: Sure, but there's nothing special about it |
| 11:56 | llasram | `sh "lein test"` |
| 11:59 | Ox6abe | llasram: How about if I have the rake file in a top-level directory |
| 12:00 | Ox6abe | ./rakefile ./lein_project/ |
| 12:00 | Ox6abe | llasram: I'm anoob |
| 12:03 | silasdavis | when is map lazy? |
| 12:04 | `cbp | always :P |
| 12:05 | llasram | Ox6abe: I'm not sure what you're asking :-) |
| 12:06 | llasram | Like, you have the Leiningen project in a sub directory of where you run rake? |
| 12:06 | Ox6abe | yes |
| 12:06 | Ox6abe | Sorry for the confusion |
| 12:06 | llasram | Ox6abe: 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:07 | llasram | so in the rake task: `Dir.chdir { sh "lein whatever" }` |
| 12:07 | llasram | (where the `` are just me quoting the code, not part of the code itself) |
| 12:08 | llasram | er |
| 12:08 | llasram | That is: `Dir.chdir("subdir") { sh "lein whatever" }` |
| 12:08 | silasdavis | if I create a map with reduce like (reduce (fn [acc x] (assoc acc :foo (f x))) coll) |
| 12:08 | silasdavis | can I consume the resulting map lazily |
| 12:08 | Ox6abe | llasram: Awesome .. You lead me on the right path <--- Literally |
| 12:09 | silasdavis | so that it only iterates as many times as it needs to to generate the value for the desired key? |
| 12:09 | llasram | Ox6abe: Oh, you've given up the lefthand path? |
| 12:09 | Ox6abe | llasram: Haha |
| 12:11 | silasdavis | actually is this what core.reducers are about... |
| 12:11 | silasdavis | ? |
| 12:12 | llasram | silasdavis: Er, well there's no such thing as a lazy map (in the data structure sense of "map") |
| 12:12 | mdrogalis | silasdavis: Reducers are about parallelization through throwing away ordering. |
| 12:13 | silasdavis | but also about providing laziness in expansive and contractive operations |
| 12:14 | silasdavis | reduce 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:16 | llasram | silasdavis: 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 | `cbp | silasdavis: maybe you can use reductions which is lazy |
| 12:17 | silasdavis | `cbp, ! |
| 12:17 | silasdavis | that's exactly what I want |
| 12:17 | silasdavis | thanks |
| 12:17 | `cbp | np |
| 12:25 | silasdavis | can I do any better than: (defn lget [r k] (get (first (filter #(get % k) r)) k)) |
| 12:25 | silasdavis | with, for example: |
| 12:25 | silasdavis | ,(reductions (fn [acc x] (assoc acc x 1)) {} [:a :b :c :d]) |
| 12:25 | clojurebot | ({} {:a 1} {:b 1, :a 1} {:c 1, :b 1, :a 1} {:d 1, :c 1, :b 1, :a 1}) |
| 12:26 | silasdavis | ,(defn lget [r k] (get (first (filter #(get % k) r)) k)) |
| 12:26 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 12:27 | silasdavis | guess it should be (defn lget [r k] (get (first (filter #(contains? % k) r)) k)) actually |
| 12:33 | silasdavis | how can I do (reduce and coll)? |
| 12:33 | `cbp | silasdavis: wat |
| 12:33 | justin_smith | (every identity coll) |
| 12:33 | silasdavis | and is a macro |
| 12:33 | silasdavis | ah |
| 12:33 | justin_smith | *every? |
| 12:33 | rasmusto | silasdavis: (fn [r k] (some #(get % k) r)) for year previous question? |
| 12:34 | rasmusto | your* |
| 12:34 | `cbp | oh |
| 12:34 | justin_smith | ,(every? identity [true 1 1]) |
| 12:34 | clojurebot | true |
| 12:35 | justin_smith | ,(reduce #(or %1 %2) true [true 1 2 (Object.)]) |
| 12:35 | clojurebot | true |
| 12:36 | `cbp | hmm 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:37 | xeqi | `cbp: that is the reader literal form of a record |
| 12:38 | `cbp | xeqi: any idea how I could get a string of that from a record? |
| 12:39 | justin_smith | `cbp: try pr-str |
| 12:40 | rasmusto | when 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 | `cbp | justin_smith: oh nice. I didn't think of that :P |
| 12:40 | justin_smith | ((juxt str pr-str) (java.util.Date.)) |
| 12:40 | justin_smith | ,((juxt str pr-str) (java.util.Date.)) |
| 12:40 | clojurebot | ["Fri Sep 20 16:11:28 UTC 2013" "#inst \"2013-09-20T16:11:28.932-00:00\""] |
| 12:41 | justin_smith | seems pr-str prefers versions of a thing that can be read back in again |
| 12:41 | justin_smith | ahh, yeah, pr-str is pr to a str, and |
| 12:41 | justin_smith | ,(doc pr) |
| 12:41 | clojurebot | "([] [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:42 | justin_smith | note the last sentence |
| 12:42 | `cbp | I knew about it just didn't make the connection :P |
| 12:42 | justin_smith | ahh |
| 12:42 | justin_smith | it is something I am still learning about personally |
| 12:56 | seangrov` | juxt? |
| 12:56 | clojurebot | juxt is usually the right answer |
| 12:56 | seangrov` | clojurebot: I <3 you |
| 12:56 | clojurebot | Pardon? |
| 13:17 | pepijndevos | What would be the correct set of functions to decide if something is a key/value thing, a sequential thing or an atomic thing? |
| 13:18 | justin_smith | I 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:20 | squidz | justin_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:20 | s4muel | pepijndevos: you're looking for map? and/or seq? |
| 13:20 | justin_smith | I 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:21 | pepijndevos | s4muel, probably, but there is also sequential? and associative? |
| 13:21 | mdrogalis | justin_smith: It's definitely not a replacement. |
| 13:21 | justin_smith | mdrogalis: what are the main deciding factors between using agents or core.async? |
| 13:21 | mdrogalis | For example, you can't perceive an entire queue in core.async. |
| 13:22 | justin_smith | ahh, interesting |
| 13:22 | mdrogalis | justin_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:25 | pepijndevos | Anything that is clojure.lang.Seqable can be looped over, right? |
| 13:25 | mdrogalis | pepijndevos: With the loop construct specifically? |
| 13:25 | mdrogalis | I guess it doesn't matter - yes. |
| 13:25 | pepijndevos | mdrogalis, just any iteration |
| 13:26 | pepijndevos | I'm looking for the best way to walk some nested data |
| 13:26 | mdrogalis | pepijndevos: Yeah, I believe that to be so. |
| 13:26 | mdrogalis | pepijndevos: core.walk? |
| 13:26 | pepijndevos | doesn;t suit my needs unfortunately |
| 13:26 | pepijndevos | or at least not intuitively so |
| 13:26 | s4muel | pepijndevos: 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:26 | mdrogalis | Need to brb. |
| 13:27 | pepijndevos | right, a map is not sequential, but it can be seq'd |
| 13:27 | coventry | pepijndevos: 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:28 | pepijndevos | yea, https://github.com/clojure/clojure/blob/c5673086d40f206135b99a37001c80a4016c3877/src/clj/clojure/walk.clj#L35 |
| 13:31 | pepijndevos | &(map (juxt list? seq? coll?) [[] {} (list)]) |
| 13:31 | lazybot | ⇒ ([false false true] [false false true] [true true true]) |
| 13:34 | rasmusto | callen: 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:34 | rasmusto | and now it finally works |
| 13:41 | callen | rasmusto: :) |
| 13:41 | callen | alexbaranosky: in case you missed it, I am bitemyapp. |
| 13:42 | silasdavis | is it possible to obtain a human-readable function definition from a clojure function? |
| 13:42 | silasdavis | that is the function object itself |
| 13:42 | callen | silasdavis: you mean a doc string? |
| 13:42 | silasdavis | no |
| 13:42 | coventry | Is there a way to force reloading of .clj files, apart from making sure they have a newer timestamp than their .class files? |
| 13:42 | callen | coventry: are you using refresh? |
| 13:43 | justin_smith | ,(clojure.repl/source clojure.repl/source) |
| 13:43 | clojurebot | Source not found\n |
| 13:43 | justin_smith | usually that works :) |
| 13:43 | coventry | callen: Playing around with sleight. |
| 13:44 | silasdavis | I 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:44 | callen | I thought that would end up catching your fancy. |
| 13:44 | callen | silasdavis: why do you want the stringly version of a function? |
| 13:44 | justin_smith | silasdavis: anyway, more directly: (clojure.repl/source f) |
| 13:44 | callen | I'm smelling an x-y problem. |
| 13:44 | coventry | callen: Yeah, it's awesome. |
| 13:44 | silasdavis | justin_smith, is that going to work comp'd functions too? |
| 13:45 | justin_smith | probably not, and if that is what you need, yeah, stringly typing is likely the problem |
| 13:46 | rasmusto | callen: another thing, how do you feel about :refer :all in test namespaces? |
| 13:47 | callen | rasmusto: no objections. |
| 13:47 | callen | no point in being unnecessarily tedious if you need to test everything anyway. |
| 13:47 | silasdavis | justin_smith, stringly typing? |
| 13:47 | rasmusto | callen: ok, thanks again |
| 13:47 | callen | silasdavis: http://c2.com/cgi/wiki?StringlyTyped |
| 13:48 | callen | silasdavis: http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html #7 |
| 13:48 | silasdavis | ah not quite |
| 13:49 | callen | one of my objections to JSON is that it lends itself to stringly typed protocols. makes me mad. |
| 13:49 | callen | then I end up having to use clojure.walk :( |
| 13:49 | callen | alexbaranosky: ^^ that's why I laughed when your presentation mentioned clojure.walk, been using it to coerce crappy JSON data. |
| 13:50 | silasdavis | I 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:50 | silasdavis | actually this might be a good place for metadata? |
| 13:50 | silasdavis | to label them |
| 13:50 | coventry | silasdavis: Yes. |
| 13:50 | silasdavis | because I'd rather avoid polluting my map with labels |
| 13:50 | callen | silasdavis: sounds like it. |
| 13:51 | silasdavis | excellent... |
| 13:52 | callen | silasdavis: 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:52 | coventry | You 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:52 | gleag | silasdavis: Generally, it's very difficult to serialize functions with free variables into text. |
| 13:54 | silasdavis | gleag, yeah I can see why that might be the case |
| 13:54 | coventry | callen: If he's using it for debug info, I don't see the problem. |
| 13:55 | silasdavis | could I write a macro that wraps a definition, evaluates the code in place, and then attaches the quoted code as metadata? |
| 13:55 | gleag | coventry: He said "parsable". |
| 13:55 | silasdavis | gleag, I shoudn't have |
| 13:56 | gleag | That would imply being able to read it back into an object that would perform equal functionality (for some values of "equal"). |
| 13:56 | silasdavis | say I didn't need it to make an subsitutions |
| 13:56 | coventry | Using the metadata to reconstruct the function would be pretty awful, yeah. :-) |
| 13:56 | silasdavis | yeah it would, I don't really need that |
| 13:56 | xeqi | silasdavis: have you seen https://github.com/technomancy/serializable-fn ? |
| 13:58 | gleag | In 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:59 | silasdavis | xeqi, if you closed over some local variable with that, how would it serialize? |
| 13:59 | silasdavis | um so like (s/fn [x] (some-other-fn x 3)) |
| 13:59 | silasdavis | you'd just get the symbol 'some-other-fn to eval? |
| 14:00 | xeqi | silasdavis: yep |
| 14:00 | coventry | silasdavis: You can read the whole thing very quickly. https://github.com/technomancy/serializable-fn/blob/master/src/serializable/fn.clj |
| 14:00 | gleag | Although 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:01 | silasdavis | xeqi, coventry ah yeah see that now, and thanks, just what I wanted |
| 14:01 | silasdavis | gleag, interesting |
| 14:05 | pepijndevos | $findfn [:a :b :c] [0 1 2] |
| 14:05 | pepijndevos | I forgot how that works :( |
| 14:05 | lazybot | [] |
| 14:05 | `cbp | slowly apparently |
| 14:06 | pepijndevos | I 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:06 | xeqi | it is running lots of functions in sandboxes |
| 14:07 | pepijndevos | for vectors keys would basically be range and vals identity |
| 14:10 | zilti | I 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:13 | mdrogalis | pepijndevos: What behavior do you expect? |
| 14:14 | zilti | And according to Google, no one ever had my problem. |
| 14:14 | pepijndevos | mdrogalis, in this particular case: https://www.refheap.com/18841 |
| 14:15 | pepijndevos | which then allows me to loop over either one |
| 14:20 | callen | if 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:20 | callen | In case anybody else runs into this. Pondering writing a blog post. |
| 14:26 | pepijndevos | weirdo error message |
| 14:26 | pepijndevos | ArityException Wrong number of args (2) passed to: PersistentVector |
| 14:26 | callen | ,([0 1 2 3] :a :lol) |
| 14:26 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: PersistentVector> |
| 14:26 | pepijndevos | oh... |
| 14:27 | callen | I GAT YUR EXCEPTION RIGHT HURR BUDDEH |
| 14:27 | pepijndevos | wait wat…. |
| 14:32 | rasmusto | why does my nrepl buffer scroll to the middle when I hit <RET> after its a certain length? |
| 14:34 | rasmusto | bah, it's tough to reproduce too :( |
| 14:34 | mdrogalis | Hey 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:34 | mdrogalis | https://gist.github.com/MichaelDrogalis/6638777 |
| 14:34 | mtp | rasmusto: there's an emacs var that controls this, sec |
| 14:34 | callen | mdrogalis: yes plz |
| 14:35 | mtp | M-x customize-var recenter-positions |
| 14:35 | mdrogalis | Still shaking out the bugs, but it's pretty awesome so far. |
| 14:35 | mtp | try nudging that around |
| 14:35 | callen | mdrogalis: I've needed something like this. thank you for making this. |
| 14:35 | mtp | mine is (bottom middle) |
| 14:35 | rasmusto | mtp: reminds me of vim's scrolloff, thanks for the hint :) |
| 14:35 | mdrogalis | callen: Sure! If you find any weird/wrong behavior, make an issue on night-vision repo. |
| 14:35 | callen | mdrogalis: 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:36 | mdrogalis | callen: Wow, people in real life talk about something I made? |
| 14:36 | callen | mdrogalis: 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:37 | callen | mdrogalis: I'm damn tempted to do a whole Clojure talk just about AOP, robert.hooke, and Dire. |
| 14:37 | callen | it's your baby, but still. |
| 14:37 | mdrogalis | callen: I'd be honored - go for it. |
| 14:37 | callen | eggscellent. |
| 14:38 | callen | mdrogalis: are you competing in Clojure Cup? |
| 14:38 | mdrogalis | callen: I didn't have plans to. Are you? |
| 14:39 | callen | mdrogalis: yeah, trying to find people who are interested in my project idea. Sort of a scratch-my-own itch type thing. |
| 14:39 | mdrogalis | Ah, I got'cha. |
| 14:39 | mdrogalis | I'm really not much for hackathon style things. :) |
| 14:39 | callen | mdrogalis: I'm not either, I just want my thing to exist and CC is stimulation to make me shove out an MVP. |
| 14:40 | coventry | I'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:40 | mdrogalis | I'm in Philly, a bit far off I'm afraid. |
| 14:40 | callen | yessss ac-nrepl, make my namespace switches take 60 seconds. go for it. why not. |
| 14:42 | mdrogalis | callen: Anyways, let me know if that little function can be more useful. |
| 14:42 | mdrogalis | I tried introspecting clojure.core. It blew up |
| 14:42 | callen | lol |
| 14:42 | callen | I don't think I'd need to do that, thankfully. |
| 14:42 | mdrogalis | It's kind of fun to use against a codebase that you didn't write. |
| 14:42 | mdrogalis | Fascilitates understanding a little faster. |
| 14:43 | `cbp | C-c M-n takes 60 seconds?? :O |
| 14:44 | callen | `cbp: ac-nrepl makes me salty. |
| 14:44 | callen | mdrogalis: that's a really good idea. |
| 14:44 | indigo | Hehe... emacs :P |
| 14:44 | callen | you could do whole blog posts just about ripping apart clojure libraries with night vision goggles. :) |
| 14:44 | callen | indigo: the solution is to just shut off ac-nrepl, not a big deal |
| 14:45 | indigo | Jk |
| 14:45 | mdrogalis | callen: And staring at the neighbors after hours! |
| 14:45 | callen | mdrogalis: made my snort my tea man |
| 14:45 | callen | me snort my* |
| 14:45 | pepijndevos | Anyone up for code golfing this? https://gist.github.com/pepijndevos/6580712 My attempt: https://www.refheap.com/18844 |
| 14:46 | `cbp | What where are the parentheses |
| 14:46 | mdrogalis | Heh |
| 14:47 | pepijndevos | My 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:48 | pepijndevos | The clojure one does a lot of merging of dicts |
| 14:50 | callen | mdrogalis: oh yeah, this is nice. |
| 14:50 | mdrogalis | Speaking of fast hashmap updates.. I used reducers the other night to update 1m key/val pairs on a terrible laptop |
| 14:50 | mdrogalis | ~5s |
| 14:50 | clojurebot | Gabh mo leithscéal? |
| 14:50 | mdrogalis | Its pretty greeat |
| 14:50 | callen | mdrogalis: now just need an un-introspect. :) |
| 14:50 | mdrogalis | callen: :) |
| 14:50 | callen | but yeah, loving it. |
| 14:51 | mdrogalis | Excellent! |
| 14:51 | pepijndevos | mdrogalis, how would you use reducers to speed up this function? |
| 14:52 | callen | pepijndevos: you could use a transient too. |
| 14:52 | callen | but is speed the point? you said golf. |
| 14:53 | mdrogalis | pepijndevos: I didn't look at it, but I wrote this guy.. |
| 14:53 | `cbp | could you provide sample input->output data. I'm just too dumb to do the desk checking in my mind |
| 14:53 | mdrogalis | https://www.refheap.com/18846 |
| 14:53 | pepijndevos | callen, speed is not really the point |
| 14:53 | mdrogalis | And she is speedy as hell. |
| 14:53 | callen | pronouncing that "maff". |
| 14:53 | pepijndevos | (php-flatten {"a" [1 2] "b" {"c" 3}}) |
| 14:53 | pepijndevos | {"b[c]" 3, "a[1]" 2, "a[0]" 1} |
| 14:54 | callen | that's a cute function. |
| 14:55 | pepijndevos | There is a whole python implementation of PHP's serialize, because PHP API's leak all that stuff and asume everyone uses PHP. |
| 14:56 | pepijndevos | I only ported this function to Clojure because I thought that in this case, local mutable state actually made the thing better. |
| 14:57 | callen | "better" *shrug* |
| 15:00 | callen | gfredericks: 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:00 | dnolen | pepijndevos: why not write the exact same thing in Clojure w/ an atom? |
| 15:01 | callen | seems unnecessary and dirty. Pretty sure transients are a better fit. |
| 15:01 | dnolen | callen: no |
| 15:01 | dnolen | callen: you can't bash on transients |
| 15:01 | dnolen | callen: and local mutability is fine |
| 15:02 | callen | I don't think you can easily generalize something like "local mutability is fine". |
| 15:02 | dnolen | callen: oh but I can |
| 15:03 | callen | most uses of atoms in Clojure code that I've seen are for thread-safe global state. |
| 15:03 | callen | not for local bashing. |
| 15:03 | dnolen | callen: so? |
| 15:03 | callen | it was my impression that in local use-cases, transients were more to the point. |
| 15:03 | llasram | callen: Check the code for the `reducers` versions of `take` and `drop` |
| 15:04 | dnolen | callen: you have to operate on transients in functional way limiting some uses |
| 15:04 | callen | llasram: that's pretty cool, I had no idea something like that was idiomatic. |
| 15:04 | callen | llasram: I guess the lack of contention makes it viable? |
| 15:05 | TimMc | Transients don't allow for action at a distance. |
| 15:05 | callen | I know that, but we're talking about a local use case. |
| 15:05 | callen | I said explicitly that transients were an option for a local case where spooky action at a distance isn't needed. |
| 15:05 | TimMc | "Distance" can also mean "elsewhere in the call stack". |
| 15:05 | llasram | callen: 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:06 | TimMc | or "I don't want to destructure my returns"" |
| 15:06 | callen | llasram: 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:06 | TimMc | llasram: If you want that, you can use a one-element Object array. :-P |
| 15:06 | callen | I'd be very surprised if that was faster than mutable locals. atoms do more work. |
| 15:06 | llasram | TimMc: Or proteus! |
| 15:06 | callen | ztellman's libraries...the fire spreads... |
| 15:07 | dnolen | proteus just uses atoms far as I know |
| 15:07 | llasram | dnolen: deftype |
| 15:08 | llasram | mutable member |
| 15:08 | dnolen | llasram: ah, k |
| 15:08 | TimMc | That's a good README right there. |
| 15:08 | TimMc | ^:local makes me a little nervous |
| 15:08 | callen | if atoms would've sufficed, he wouldn't have needed Proteus. |
| 15:10 | alfborge | What's the difference between these: (map parse-binding-content (-> b :content)) and (-> b :content (partial map parse-binding-content)) |
| 15:10 | TimMc | So this macro redefines set! and friends within its scope? |
| 15:11 | llasram | TimMc: if you haven't been following ztellman's recent output, see also riddley :-) |
| 15:11 | alfborge | Reason 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:12 | amalloy | alfborge: try macroexpanding it |
| 15:12 | mdrogalis | Time to head out. See ya guys. |
| 15:12 | callen | ztellman's libraries are a good alternative to coffee for getting that wide-eyed feeling first thing in the morning. |
| 15:12 | amalloy | the latter expands to (partial (:content b) map parse-binding-content); see if you can see why |
| 15:12 | rasmusto | alfborge: the latter is passing in the content of b as the first argument to partial :O |
| 15:16 | alfborge | Thanks, I'm closer to understanding now. :) |
| 15:19 | rasmusto | alfborge: take a look at different examples of -> and ->> to see what they are used for |
| 15:20 | alfborge | rasmusto: Yes, I'm reading up on it now. Thanks. |
| 15:21 | pepijndevos | dnolen, yea, maybe I should.... |
| 15:21 | dnolen | pepijndevos: whenever I see that something is more easily done locally with an atom I rarely bother with convoluted functional solutions. |
| 15:22 | pepijndevos | :) |
| 15:22 | clojurebot | It's greek to me. |
| 15:25 | dnolen | pepijndevos: http://github.com/clojure/clojurescript/blob/master/src/clj/cljs/source_map.clj#L155 |
| 15:26 | dnolen | with source maps similar problem |
| 15:26 | dnolen | tree shape is good for merging, but for the final flattened output just easier to do it with a few atoms IMO |
| 15:26 | pepijndevos | yea, local mutable state is very convenient sometimes |
| 15:27 | dnolen | pepijndevos: very |
| 15:29 | borkdude | How can I search an entire project for misplaced docstring (after instead of before the arg vector) in Emacs? |
| 15:31 | TimMc | borkdude: There's a lein plugin for that. |
| 15:31 | TimMc | Ah, jonase/eastwood |
| 15:32 | `cbp | hehe i give up implementing it without mutability. This is why i did most of my code jam exercises in java :P |
| 15:32 | borkdude | ok thank you TimMc |
| 15:33 | TimMc | borkdude: You may need to exclude c.t.namespace from its dependencies if it conflicts with other plugins. |
| 15:33 | borkdude | c.t.? |
| 15:33 | Bronsa | clojure.tools.namespace |
| 15:35 | borkdude | it just works, thanks |
| 15:38 | callen | `cbp: for shame :) |
| 15:38 | saolsen | Are there any clojure vector math libraries that just work on clojure vectors? Just with simple things like magnitude or dot products |
| 15:39 | callen | saolsen: https://github.com/mikera |
| 15:41 | saolsen | oh cool, didn't realise that worked with normal clojure vectors |
| 15:42 | callen | I'm pointing you at a person, not a repo. |
| 15:43 | saolsen | right, I meanth that in refernce to core.matrix |
| 15:43 | saolsen | *meant |
| 15:47 | callen | mdrogalis: running my unit tests with night vision enabled producing an EXTREME amount of output, hahahahaha |
| 15:47 | callen | and that's on just one namespace :) |
| 16:02 | alfborge | Thanks amalloy and rasmusto for the pointers to understand -> and ->> :) |
| 16:03 | callen | alfborge: ,,, |
| 16:05 | alfborge | callen: Actually, my problem was more the fact that these are macros and not functions. |
| 16:05 | callen | mtp: problem? :) |
| 16:11 | irctc | hey guys, I can't (require 'clojure.contrib.math) etc |
| 16:11 | AimHere | irctc > clojure.contrib has been deprecated for a while now |
| 16:12 | irctc | ohh |
| 16:12 | irctc | how can I have math? |
| 16:12 | `cbp | irctc: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go |
| 16:13 | irctc | ahh thx, I even saw the page but somehow eluded me |
| 16:31 | callen | can we just...start deleting things related to contrib? :P |
| 16:32 | jared314 | newbie macro question, (defmacro tester [a] `(inc ~(* a 2))) |
| 16:32 | jared314 | if I pass it a number it is fine |
| 16:33 | jared314 | if i pass it a symbol that i have defed it errors |
| 16:33 | pisketti | One does not simply... delete things related to contrib B) |
| 16:40 | AimHere | jared314, it's not dereferencing the symbol you pass in |
| 16:41 | AimHere | jared314, perhaps (defmacro tester2 [a] `(inc (* ~a 2))) was what you wanted |
| 16:41 | jared314 | AimHere, I was trying to operate on the value and then insert the value into the resulting form |
| 16:41 | coventry | AimHere: But why not? |
| 16:42 | gfredericks | jared314: the value doesn't exist at compile time |
| 16:42 | AimHere | jared314, remember that macros operate at compile time |
| 16:42 | jared314 | that makes sense |
| 16:42 | jared314 | thanks |
| 16:42 | AimHere | By the time you've deffed the symbol, it's too late! You might have to use a funciton instead |
| 16:46 | indigo | Oh PHP... the default behavior of curl_exec() is not to return the result, but to send it to stdout :| |
| 16:47 | callen | strangemonad: hi friend :) |
| 16:48 | strangemonad | hi :) |
| 16:52 | callen | what's a good word for referring to parents and children? |
| 16:52 | callen | a single noun for referring to the relationship would be nice for naming my functions. |
| 16:53 | rasmusto | callen: geneology? |
| 16:53 | callen | rasmusto: no, this is a hierarchical tree |
| 16:53 | rasmusto | ;p |
| 16:53 | callen | for example, I need to write a function to associate a parent with their children and vice versa. |
| 16:54 | callen | I'm lacking in nomenclatural fluidity today. |
| 16:54 | callen | being one of the two hard things in computer science, this is to be expected. |
| 16:55 | rasmusto | what's the other one? |
| 16:55 | callen | cache invalidation. |
| 16:55 | mtp | and off-by-one errors |
| 16:55 | rasmusto | oic |
| 17:03 | rasmusto | s/upper-case |
| 17:04 | jweiss | ,(class (map inc :foo)) |
| 17:04 | clojurebot | clojure.lang.LazySeq |
| 17:04 | jweiss | weird. |
| 17:04 | jweiss | i wouldn't expect lazy-seq to accept a non-sequence, but it does |
| 17:05 | jweiss | or i suppose i also wouldn't expect map to accept a non-sequence |
| 17:06 | coventry | Where 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:08 | callen | have I lost my table-flipping mind? https://gist.github.com/bitemyapp/6643575 |
| 17:12 | coventry | jared314'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:14 | callen | no, that doesn't make sense. |
| 17:15 | llasram | coventry: 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:16 | marco3 | How do I run clojurescript with the master clojurescript branch? |
| 17:16 | marco3 | I thought I remebered seeing a something about it, but I can't seem to find it |
| 17:17 | coventry | llasram: What's plausible mean here? |
| 17:17 | coventry | callen: I think you could simplify that a bit with update-in. |
| 17:18 | llasram | coventry: Something you'd expect to compile |
| 17:19 | llasram | ,(let [a 'foo] `(* 2 ~a)) |
| 17:19 | clojurebot | (clojure.core/* 2 foo) |
| 17:19 | coventry | llasram: Thanks, I get it now. |
| 17:19 | llasram | ,(let [a 'foo] `~(* 2 a)) |
| 17:19 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number> |
| 17:19 | callen | coventry: sorta-not-really. |
| 17:19 | callen | coventry: I have to reify the concept of "vector - hell or highwater" into a separate fn anyway. |
| 17:20 | callen | https://gist.github.com/bitemyapp/6643736 |
| 17:29 | marco3 | found the link: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler |
| 17:41 | rasmusto | is there a way to have leiningen use its 'read-git-head, but specify an scm url that isn't github? |
| 17:44 | rasmusto | I might just do it with a git hook, hmm |
| 17:57 | rasmusto | I ended up doing this: :tag ~(->> (slurp ".git/HEAD") (clojure.string/split-lines) first (re-matches #"^ref: (.*)") second (str ".git/") slurp) |
| 18:02 | noprompt | dnolen: 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:02 | dnolen | noprompt: I think I had to hack it, should probably open a proper issue on the project, Bodil |
| 18:02 | dnolen | is pretty responsive |
| 18:03 | callen | it's a good thing I don't check in REPL code. |
| 18:03 | squidz | dnolen: that is the reply you normally use for your clojurescript? |
| 18:03 | noprompt | dnolen: ah, ok. i just wanted to make sure it wasn't something i was missing. so that's normal behavior? |
| 18:04 | dnolen | squidz: when I'm working on some code that doesn't involve the browser it's useful |
| 18:04 | dnolen | noprompt: I don't remember |
| 18:04 | squidz | dnolen: so what do you use when you need to work with the browser? |
| 18:04 | dnolen | squidz: browser REPL |
| 18:04 | dnolen | squidz: and auto builds |
| 18:04 | noprompt | dnolen: i added the piggieback conf but, ehf, it still prompts me. |
| 18:05 | noprompt | i guess i could open an issue. hoping i don't look like an idiot. :-P |
| 18:05 | squidz | what are auto builds? |
| 18:07 | dnolen | noprompt: people have opened issues for less compelling reasons, don't worry about it |
| 18:07 | dnolen | squidz: lein cljsbuild has incremental auto builds |
| 18:07 | squidz | oh okay thats what you meant. |
| 18:10 | noprompt | dnolen: FWIW i guess i could also slip in a suggestion to bump the piggieback dep version. |
| 18:11 | dnolen | noprompt: probably a good idea |
| 18:27 | noprompt | call me immature, but i can't help but laugh when i see (:require [goog.string :as gstring]) |
| 18:28 | rhg | lol, nope its not you |
| 18:30 | rhg | o.0 |
| 18:31 | SegFaultAX | rhg: 80% of the time I screw that up every time. |
| 18:32 | rhg | how? |
| 18:32 | clojurebot | with style and grace |
| 18:32 | rhg | ah |
| 18:34 | coventry | Is c.j.shell/sh still the best way to make a symlink in clojure (w/ java 6)? |
| 18:35 | rhg | best? idk but it works and isnt too ugly |
| 18:41 | noprompt | dnolen: have you done an experiments with the CSSOM? |
| 18:45 | callen | noprompt: you're a sexist monster and should remove yourself from civilized socity. |
| 18:45 | callen | society* |
| 18:46 | rhg | lol |
| 18:46 | noprompt | callen: not totally. i restrained myself from blowing up the logs with risque ascii art. |
| 18:46 | rhg | along with half the world |
| 18:49 | yedi | chris |
| 18:53 | Raynes | stopher |
| 18:53 | metellus | chrisstopher? |
| 18:53 | Raynes | Yes. |
| 18:53 | `cbp | stop her |
| 18:53 | clojurebot | Titim gan éirí ort. |
| 18:55 | yedi | how long does it usually take strangeloop vids to go up? |
| 18:55 | callen | 6 months |
| 18:56 | callen | which I'm pretty sure Joda Time has an alias for named, "Haha, suckers!" |
| 19:06 | callen | noprompt: gettin' close. |
| 19:06 | noprompt | callen: really? |
| 19:06 | callen | sorta not really. |
| 19:06 | `cbp | :( |
| 19:06 | callen | noprompt: my breaks/therapy usually involve trolling Haskell programmers and catharsis in showing off terrible code. |
| 19:07 | callen | noprompt: 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:07 | clojurebot | I don't understand. |
| 19:07 | callen | clojurebot: you don't need to dearie. |
| 19:07 | clojurebot | Cool story bro. |
| 19:07 | callen | I know. |
| 19:07 | noprompt | XD |
| 19:07 | callen | noprompt: it's nothing on the order of say, core.async, but it's still *_* |
| 19:07 | noprompt | callen: remember. mapcat. |
| 19:08 | callen | indigo: catenate |
| 19:08 | indigo | I know ;P |
| 19:09 | callen | noprompt: I've got clojure.walk in a couple places, loop/recur in a few others... |
| 19:09 | noprompt | in 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:09 | callen | it's a proper mess. |
| 19:09 | indigo | noprompt: At least you're not doing PHP |
| 19:09 | Raynes | Or FRP |
| 19:09 | Raynes | ~rimshot |
| 19:09 | clojurebot | Badum, *tish* |
| 19:09 | callen | noprompt: 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:09 | callen | Raynes: you checked my trolling? |
| 19:09 | noprompt | indigo: i've declined every oportunity to write PHP regardless of the money. |
| 19:10 | Raynes | Yes, it was a reference to your appendage measurement context with Brain McKenna on twitter. |
| 19:10 | Raynes | Brian* |
| 19:10 | callen | Brain, how appropriate. |
| 19:10 | callen | He's like the mouse from Pinky & the Brain. |
| 19:10 | indigo | noprompt: I really need the money :P |
| 19:10 | callen | "YES. WE WILL HASKELL ALL THE THINGS PINKY!" |
| 19:10 | indigo | So I can buy my cool Apple toys :P |
| 19:10 | callen | noprompt: 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:10 | noprompt | Brian McKenna. That guy. |
| 19:10 | noprompt | sometimes i don't know why i still follow him. |
| 19:11 | callen | I follow him so I can take snipes at his sanity. |
| 19:11 | callen | I want to see if he starts speaking in Haskell operators. |
| 19:11 | noprompt | well the funny thing is the guy is like always hacking on javascript and complaining about languages sucking etc. |
| 19:12 | SegFaultAX | noprompt: In fairness, Javascript sucks. A lot. |
| 19:12 | callen | SegFaultAX: I had to answer a coworker's question by checking the ECMA standard today. |
| 19:12 | noprompt | i mean he could just choose not to program in javascript and most of his bitching would stop. |
| 19:12 | callen | noprompt: I have a buddy that writes Perl and is obsessed with Haskell on the side. |
| 19:12 | SegFaultAX | noprompt: Unless, you know, it's his job. |
| 19:12 | callen | I think it's an allergic reaction people have to using sucky languages. |
| 19:12 | SegFaultAX | It's OK to be paid to do something that you hate. |
| 19:12 | callen | SegFaultAX: is it? |
| 19:13 | SegFaultAX | callen: Yes. |
| 19:13 | noprompt | SegFaultAX: well there's that i guess. still that's his choice. |
| 19:13 | callen | SegFaultAX: I wonder if being an African Warlord pays well... |
| 19:13 | SegFaultAX | noprompt: And it's also his choice to bitch about it while he does it. |
| 19:13 | SegFaultAX | He can have it both ways. |
| 19:13 | noprompt | SegFaultAX: this is also true. |
| 19:13 | Raynes | Well 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:13 | SegFaultAX | Raynes: That to. |
| 19:14 | SegFaultAX | Not like Haskell jobs are a dime-a-dozen. |
| 19:14 | callen | Raynes: he could join the Portland hipsters. |
| 19:14 | callen | I 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:15 | rasmusto | <3 portland |
| 19:15 | noprompt | i'm happy to be living in a mostly hipster free city. |
| 19:15 | callen | Brian McKenna is not a person. He is an attempt by an AI researcher at making fun of his Haskell-obsessed colleagues. |
| 19:15 | callen | and a parrot. |
| 19:16 | rhg | agreed |
| 19:16 | SegFaultAX | noprompt: That's a pretty douchey thing to say. |
| 19:16 | noprompt | SegFaultAX: how so? |
| 19:16 | Raynes | It isn't, don't worry. |
| 19:16 | noprompt | i didn't think so. |
| 19:16 | callen | decided to go for broke and plunge the knife in. We'll see how Parrot-man reacts. |
| 19:17 | rhg | lol |
| 19:17 | noprompt | haha |
| 19:17 | callen | bitemyapp: .@puffnfresh @nvanderw Except for the part where thousands of applications were shipped, billions $, etc…don't you write JS for a living? |
| 19:17 | SegFaultAX | noprompt: Biggotry. |
| 19:17 | noprompt | SegFaultAX: how so? |
| 19:17 | callen | Taking bets on whether he's silent after that one. |
| 19:17 | Raynes | Of course not. |
| 19:17 | callen | dammit. |
| 19:17 | rhg | wishing... |
| 19:18 | callen | puffnfresh: @bitemyapp @nvanderw argumentum ad populum. Nope, I don't write JavaScript for a living. |
| 19:18 | noprompt | SegFaultAX: i mean just because i do not like some faux subculture does not make me a biggot. |
| 19:18 | SegFaultAX | noprompt: 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:18 | callen | SegFaultAX: he prefers the meth-heads of Central Valley. Less pretentious, but more bitey too. |
| 19:18 | noprompt | SegFaultAX: so i'm a biggot if i say i'm happy to live in mostly white-supremacist city too? |
| 19:18 | SegFaultAX | Nevermind /why/ you find it distasteful (that's a separate issue) |
| 19:18 | Raynes | SegFaultAX: And you're saying nonsense. |
| 19:19 | Raynes | He made no derogatory comments about 'hipsters', a word that is essentially meaningless at this point anyways. |
| 19:19 | callen | is this how hipsters defend hipsters? |
| 19:19 | noprompt | Raynes: thank you. |
| 19:19 | callen | sounds like a very hipster-y argument to me. |
| 19:19 | Raynes | noprompt is a confirmed hipster. |
| 19:19 | noprompt | callen: ZING! |
| 19:19 | Raynes | He once wore a fedora. |
| 19:20 | callen | SegFaultAX writes Ruby for a living. Guaranteed hipster. |
| 19:20 | callen | They both burn. |
| 19:20 | SegFaultAX | In SF |
| 19:20 | callen | In SF. |
| 19:20 | SegFaultAX | callen: Except you've met me, so you know I couldn't be further away from a hipster. |
| 19:20 | SegFaultAX | But that isn't the point. |
| 19:20 | callen | I know. but you're burning anyway for protecting the hipsters. |
| 19:20 | Raynes | Because there isn't one. |
| 19:21 | SegFaultAX | Raynes: We disagree, that's ok. |
| 19:21 | callen | #clojure #CultureWars #ohGod #makeitStop :( |
| 19:21 | Raynes | This point you speak of is as flat as iOS 7. |
| 19:21 | callen | z-index negative infinity :( |
| 19:21 | noprompt | Raynes: you had to remind me. i don't wanna upgrade. ;_; |
| 19:21 | `cbp | M-x life-is-too-much |
| 19:22 | rhg | noprompt: i am dissapoint |
| 19:22 | SegFaultAX | Raynes: Is your argument that since "hipster" doesn't have a concrete meaning, it can't be used in a hurtful way? |
| 19:22 | callen | I think Brian McKenna made a deal with the grim reaper where he dies immediately if he writes a single bug into his software. |
| 19:23 | callen | that's the only explanation for the extremities of his insanity |
| 19:23 | yedi | callen: "noprompt: it's nothing on the order of say, core.async, but it's still *_*" |
| 19:23 | yedi | not a fan of core.async |
| 19:23 | noprompt | callen: 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:23 | Raynes | SegFaultAX: 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:23 | callen | yedi: nobody cares. I was complaining about annoying work stuff. |
| 19:23 | TimMc | Oh, we're talking about hipsters now? |
| 19:24 | callen | TimMc: don't pitch in gasoline. |
| 19:24 | Raynes | I could use some lighter fluid. |
| 19:24 | callen | meth-head perfume? |
| 19:24 | SegFaultAX | Raynes: 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:24 | callen | So if you ever wanted programmers to fight each other like pit dogs, now we know how. Hipsters. |
| 19:24 | rhg | i am in #clojure? |
| 19:25 | Raynes | I'm happy to not live in North Korea. |
| 19:25 | callen | rhg: I really wonder sometimes. |
| 19:25 | Raynes | Does that mean I hate North Koreans? |
| 19:25 | SegFaultAX | Raynes: That's not the same, you haven't identified a group of people. |
| 19:25 | Raynes | How dare you say North Koreans aren't people. |
| 19:25 | SegFaultAX | But "I'm happy to live in a city without any north koreans" is something else entirely. |
| 19:25 | Raynes | You monster. |
| 19:25 | TimMc | I'm pretty sure "hipster" is just a general term for "I don't like this person and I can't defend my viewpoint". |
| 19:25 | noprompt | SegFaultAX: yeah i never said i hate hipsters. i just don't care to be around them. |
| 19:25 | rhg | callen: good im not the only one |
| 19:26 | SegFaultAX | noprompt: "Yea I never said I hate north koreans, I just don't care to be around them" |
| 19:26 | callen | I wouldn't want to be around them either, North Koreans kidnap people. And hipsters are smelly. |
| 19:26 | Raynes | On the other hand, oh my good God who cares if he loves him some hipsters or not? |
| 19:26 | rhg | ^ |
| 19:26 | Raynes | This is #clojure. Can we please move onnnnnn? |
| 19:26 | SegFaultAX | Raynes: Yup. But a separate issue still. :) |
| 19:27 | Raynes | It isn't an issue. Go away. |
| 19:27 | Raynes | :p |
| 19:27 | rhg | #hipsters |
| 19:27 | hyPiRion | Welcome to #clojure-mosh-pit |
| 19:27 | appendonly | i 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:27 | appendonly | (on a typewriter) |
| 19:27 | callen | appendonly: why the typewriter? |
| 19:28 | Raynes | Typewriters are hipster. |
| 19:28 | gws | "art event" |
| 19:28 | TimMc | Typewriters are pretty cool. I grew up with one. It was fun. |
| 19:28 | appendonly | callen: it was loud and interesting. if we had a laptop it would have been a no-op |
| 19:29 | callen | appendonly: I think the TW blanketed you with hipster-ness. |
| 19:29 | callen | appendonly: I like your nick :) |
| 19:30 | appendonly | the combinatorics of male fashion limit us to a few particular styles |
| 19:30 | appendonly | more and more of them are hipster |
| 19:30 | appendonly | well-groomed beard? game over |
| 19:30 | appendonly | etc |
| 19:31 | callen | I wear polos. lol. |
| 19:32 | Raynes | I wear blue jeans and v-necks. |
| 19:32 | hyPiRion | Well, by today's standards, this guys is a hipster: http://www-formal.stanford.edu/jmc/jmcbw.jpg |
| 19:32 | TimMc | hahaha |
| 19:32 | hyPiRion | The glasses, the beard, the tie with weird symbols on. Man, what a hipster. |
| 19:32 | rasmusto | hyPiRion: he was a hipster before it was cool |
| 19:32 | TimMc | /thread |
| 19:33 | callen | game over man, game over! |
| 19:33 | noprompt | SegFaultAX: 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:33 | hyPiRion | McCarthy to the rescue. |
| 19:34 | rhg | move on plz |
| 19:34 | rhg | mhm |
| 19:34 | callen | noprompt: McCarthy ended the conversation. |
| 19:34 | callen | SegFaultAX: use Datomic! |
| 19:34 | rasmusto | SegFaultAX: I'm thinking about using sql for logging |
| 19:34 | TimMc | -> #hipster |
| 19:34 | noprompt | oh sorry, was typing. |
| 19:34 | TimMc | for further blather |
| 19:34 | noprompt | cool |
| 19:34 | rhg | D: |
| 19:34 | callen | am I a hipster for using Datomic? |
| 19:34 | SegFaultAX | Seriously, as an industry, why haven't we moved on from eg CLF |
| 19:35 | appendonly | i'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:35 | Raynes | SegFaultAX, noprompt: http://thereisnoneed.com/ |
| 19:35 | noprompt | Raynes: oh my fuck that's funny. |
| 19:35 | SegFaultAX | Raynes: Heh, I moved on like 10 minutes ago. |
| 19:35 | appendonly | i only ever append values, not insert them or delete |
| 19:35 | SegFaultAX | Raynes: My jimmies are challenging to rustle. |
| 19:35 | gws | lol |
| 19:35 | noprompt | SegFaultAX: well i had moved on after i said i what i did. |
| 19:36 | callen | guys. no need for meta either. |
| 19:36 | Raynes | callen: wtf meta is importangt |
| 19:36 | noprompt | i had to get callen up in here. |
| 19:36 | callen | you just (reset! @converation nil) |
| 19:36 | Raynes | &(meta #'println) |
| 19:36 | lazybot | ⇒ {: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:36 | noprompt | *all allen |
| 19:36 | callen | conversation* |
| 19:36 | noprompt | dammit. |
| 19:36 | noprompt | nm. |
| 19:36 | rasmusto | ,(import tang) |
| 19:36 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: tang> |
| 19:37 | hyPiRion | appendonly: which pointers will be used most frequently? The last one, or is the lookup uniform? |
| 19:37 | SegFaultAX | noprompt: PM'd |
| 19:37 | hyPiRion | *will be looked up |
| 19:38 | appendonly | hyPiRion: arbitrary, typical use case will be random |
| 19:38 | callen | pretty sure I can rewrite this loop/recur into a reduce. |
| 19:38 | callen | If so, I will be a happy person. |
| 19:39 | noprompt | Raynes: did that work? |
| 19:40 | coventry | How can you have good cache locality with arbitrary lookups? Is there some kind of autocorrelation? |
| 19:40 | appendonly | coventry: good point. the implication is that nearby values should be nearby on disk |
| 19:41 | hyPiRion | appendonly: 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:41 | hyPiRion | mutable |
| 19:41 | SegFaultAX | callen: Well, technically all forms of looping can be expressed as a reduction with enough pain. :) |
| 19:42 | callen | SegFaultAX: "with enough pain" |
| 19:43 | callen | SegFaultAX: I don't think you saw my wailing yesterday. It ain't pretty. |
| 19:43 | appendonly | hyPiRion: what was my notion too. i think i will flatten the values at the leafs, though, because it will be densely populated |
| 19:43 | coventry | Nearby in the sense that pointers to adjacent locations should be close? I'm curious about the application. |
| 19:43 | hyPiRion | appendonly: yeah, sounds like what I would've done |
| 19:44 | hyPiRion | Not that it's any guarantee for anything, though. |
| 19:47 | appendonly | coventry: the pointers are added in increasing order |
| 19:48 | noprompt | i just realized i've had peices of plant matter in my hair all day since pulling weeds this morning. |
| 19:48 | noprompt | the horror. |
| 19:48 | callen | oh dude, I think I just converted it to a reduce. |
| 19:49 | callen | foldl ftfw. |
| 19:49 | callen | noprompt: plant hipster. |
| 19:49 | noprompt | ah dammit. |
| 19:49 | callen | only hipsters care about plants. and trees. and green things. |
| 19:49 | callen | only hipsters do anything other than suck soda and watch netflix. |
| 19:49 | noprompt | callen: i care about getting to my frakin' orange tree w/o being molested by weeds. |
| 19:50 | `cbp | I am not ready for this image |
| 19:52 | callen | god that was deeply satisfying. |
| 19:52 | callen | converted it to a reduce and the code is shorter and cleaner! |
| 19:52 | technomancy | can we move on to calling people hepcats yet? |
| 19:52 | technomancy | I've been saving up jokes. |
| 19:53 | callen | dyslexic heaps of cats? |
| 19:54 | technomancy | https://en.wikipedia.org/wiki/Hepcat |
| 19:54 | callen | I know what a hepcat is, I'm just not a funny person :( |
| 19:54 | technomancy | oh oops |
| 19:55 | callen | technomancy: do you keep bookmarks or links of all the webcomics you read? |
| 19:55 | callen | I need a better source of obscure references and library names. Naming things is hard. |
| 19:56 | technomancy | it's all up here |
| 19:56 | noprompt | callen: you need a name? |
| 19:56 | technomancy | that said, ohnorobot.com is an invaluable resource |
| 19:57 | noprompt | callen: what does the lib do? |
| 19:57 | callen | noprompt: anticipating future needs. I've had problems before. |
| 19:57 | callen | sorry, nothing to name right now :) |
| 19:57 | callen | noprompt: but you'll be the first person I ping next time! |
| 19:57 | noprompt | i'm working on something called "aoede" |
| 19:58 | noprompt | cause that sounds cool. |
| 19:58 | callen | so you...don't want anyone to use it? |
| 19:58 | noprompt | the moons of jupiter have cool names. |
| 19:58 | technomancy | almost fully dvorak-homerow |
| 20:01 | callen | I think can just make this whole program nested reduces and be done with it. |
| 20:01 | `cbp | should just use java |
| 20:01 | callen | `cbp: I keel you |
| 20:01 | noprompt | technomancy: my laptop keyboard is damaged because of my failed dvorak attempt. ;_; |
| 20:02 | callen | it's not worth being disabled when you use somebody elses keyboard. |
| 20:02 | callen | what if I have to desperately hack the Gibson before my friends are caught by corrupt government agents?! |
| 20:04 | technomancy | always carry a hardware-dvorak mechanical keyboard with you on your escapades |
| 20:04 | coventry | Somehow, I can type fairly fluently in either layout. |
| 20:06 | rasmusto | callen: 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:06 | callen | rasmusto: ...all? |
| 20:07 | rasmusto | callen: er, I have a "core" file that has dependencies on a bunch of files |
| 20:07 | callen | oh I see, you have a default namespace. |
| 20:07 | callen | Leiningen has that. |
| 20:07 | callen | switch to the namespace, then refresh. |
| 20:08 | rasmusto | oh... I've been using the user ns all along, hmm |
| 20:08 | callen | I don't use (ns user) |
| 20:08 | callen | I didn't know that was significant or unusual, sorry. |
| 20:09 | callen | rasmusto: my repl inner loop looks like: tardis.storage-test> (require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh) (require '[clojure.pprint :refer [pprint]]) |
| 20:09 | callen | rasmusto: the content thereof being an emacs macro I jam on whenever I need nuke the universe. |
| 20:09 | rasmusto | "unable to resolve symbol: require in this context" ahh |
| 20:09 | callen | I put defs for experimental data in my test namespaces so they're there post refresh. |
| 20:10 | rasmusto | I'm seriously questioning my sanity atm, how did I ever have this working |
| 20:12 | rasmusto | callen: hm, I do the (require '[c.t.n.r]) (refresh) thing, and it still complains about one of my namespaces not existing |
| 20:12 | callen | rasmusto: https://github.com/bitemyapp/dotfiles/blob/master/.emacs.d/clojure/clojure-config.el#L48-L62 |
| 20:12 | callen | rasmusto: which one? is it in your user profiles :dependencies? are you overriding the user profile in your project.clj? |
| 20:12 | rasmusto | callen: its one in my src dir |
| 20:13 | callen | well that's on your ns decl and classpath man. |
| 20:13 | callen | nothing to do with refresh. |
| 20:13 | callen | unless you ghosted a namespace it's trying to refresh or something. I don't know. |
| 20:14 | rasmusto | I hope I didn't ghost anything ;o |
| 20:16 | callen | rasmusto: you're not giving me much to work with here. |
| 20:16 | rasmusto | callen: hm, my classpath has projroot/src in it |
| 20:17 | rasmusto | but not its subdirectories |
| 20:17 | coventry | rasmusto: That's the way it ought to be. |
| 20:17 | rasmusto | coventry: okay, that's what I thought, since that's the lein template default |
| 20:18 | rasmusto | callen: you've helped enough, I'm just stumbling over something dumb |
| 20:21 | callen | rasmusto: I hope you figure it out, and when you do, please report back. :) |
| 20:21 | rasmusto | callen: 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:22 | callen | rasmusto: my world is filled with '(reduce reduce reduce reduce reduce) today ;) |
| 20:24 | akurilin2 | Is doseq the right macro to use for going through a collection and using it for side-effects, or is there a better choice? |
| 20:25 | rasmusto | akurilin2: doseq is the right one |
| 20:25 | callen | akurilin2: on the nose. |
| 20:25 | akurilin2 | rasmusto, callen, great, thank you gentlemen. |
| 20:26 | rasmusto | akurilin2: happy friday |
| 20:26 | akurilin2 | rasmusto, I never know how to respond to that one. |
| 20:26 | rasmusto | clojurebot: happy friday |
| 20:26 | clojurebot | It's greek to me. |
| 20:27 | rasmusto | akurilin2: yeah, idk. I don't normally talk like that, I'm just in a weird mood today |
| 20:27 | rasmusto | akurilin2: I think it was the iced coffee and condensed milk I had for lunch |
| 20:28 | akurilin2 | rasmusto, doesn't sound too bad unless that's the only thing you had for lunch. |
| 20:28 | rasmusto | I had pho too |
| 20:29 | TEttinger | MSG madness? |
| 20:29 | akurilin2 | Style 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:29 | callen | pho is expensive broth. I do not understand it. |
| 20:29 | callen | akurilin2: Using let that way is fine. that's why it's the default instead of parallel let. |
| 20:30 | callen | akurilin2: if it's going to some extreme then you part out functions and destructure binding from the functions. |
| 20:31 | akurilin2 | callen, 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:35 | akurilin2 | It's not really pressing, but I tend to get pretty obsessive over making the most out of the language. |
| 20:36 | rasmusto | callen: yeah, I prefer ramen, but it's a bit too heavy for a lunch |
| 20:39 | callen | akurilin2: it's just splitting off child functions. |
| 20:40 | mmarczyk | dnolen: ping? |
| 20:41 | akurilin2 | callen, that's fair. |
| 20:42 | callen | hella. |
| 20:42 | callen | akurilin2: I wish you could see my code right now, lol. |
| 20:42 | akurilin2 | callen, as in, good or bad? |
| 20:43 | callen | akurilin2: 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:44 | callen | akurilin2: with a sprinkling of, http://www.youtube.com/watch?v=Vmn9asN-8AE |
| 20:44 | akurilin2 | callen, I love that video. |
| 20:49 | callen | akurilin2: but seriously. this code. THIS. CODE. |
| 20:51 | rasmusto | callen: ahhhh, its something |
| 20:52 | rasmusto | either :aot, :main, or :profiles {:dev ...} in project.clj |
| 20:52 | akurilin2 | I 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:52 | rasmusto | that's messing me up |
| 20:52 | coventry | My vote is it's clojure's fault and we should all go back to making starcraft clones in Haskell. |
| 20:53 | rasmusto | coventry: I think it's :aot :O |
| 20:53 | rasmusto | oh no, it's :main, hmmm |
| 21:01 | mmarczyk | a little advert: |
| 21:01 | mmarczyk | drop-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:02 | mmarczyk | perf mostly on a par with the built-in versions |
| 21:02 | rasmusto | callen: :main ^:skip-aot {{my-main-ns}} may have fixed my issues |
| 21:04 | callen | rasmusto: weird. well then. |
| 21:33 | dnolen | mmarczyk: that's pretty cool! |
| 21:35 | mmarczyk | dnolen: :-) |
| 21:43 | dnolen | I think we're in a good spot, just need to clean up the writing and add diagrams |
| 21:44 | dnolen | we should also do the benchmarks a bit more rigorously |
| 21:45 | mmarczyk | re: avl.clj, it's nice to see perf superior to the built-ins in some benchmarks on the Clojure side |
| 21:45 | mmarczyk | not a huge difference, but still; also, where the built-ins win, that's also not by a large margin |
| 22:09 | mklappstuhl | using clojure.java.jdbc - is there a way to print a query instead of execute it or the like? |
| 22:10 | gfredericks | mklappstuhl: a non-answer is have you used honeysql? |
| 22:10 | mklappstuhl | nope, but I appreciate the headsup |
| 22:11 | `cbp | mklappstuhl: are you using jdbc/query? |
| 22:11 | `cbp | or with-connection |
| 22:14 | mklappstuhl | `cbp: actually something like this before: (sql/insert! db :stock day-data)) |
| 22:20 | callen | mklappstuhl: http://github.com/bitemyapp/blackwater |
| 22:20 | callen | mklappstuhl: also if you use Korma, there's a sql-only macro. |
| 22:20 | callen | mklappstuhl: http://sqlkorma.com/ |
| 22:20 | callen | mklappstuhl: blackwater works with c.j.j and Korma. |
| 22:21 | callen | mklappstuhl: have fun :) |
| 22:21 | mklappstuhl | callen: 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:23 | callen | mklappstuhl: just read the code to c.j.j theb |
| 22:23 | callen | then* |
| 22:23 | callen | mklappstuhl: you really should look at Korma though, it does precisely what you want. |
| 22:23 | callen | mklappstuhl: there's no inherent value to be gained in what I think you're angling at. |
| 22:27 | `cbp | mklappstuhl: hi sorry went afk for a bit. There's no way to print the sql atm with what you're using |
| 22:27 | `cbp | I think there's a jira ticket from like 2 years ago that asked for that |
| 22:28 | `cbp | mklappstuhl: If you used jdbc/query then the little dsl basically gets evalled to sql though |
| 22:31 | mklappstuhl | `cbp: thank you |
| 22:31 | mklappstuhl | callen: I actually went with your advice and am taking a look at korma atm |
| 22:33 | mklappstuhl | having a problem defining two related entities though since both are used in the definitions and one has to go first |
| 22:34 | danielszmulewicz | I 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:36 | mgaare | mklappstuhl: you can forward-declare both of them |
| 22:37 | danielszmulewicz | OK. I figured it out. |
| 22:37 | danielszmulewicz | Called it from within the excluded namespace. |
| 22:39 | mmarczyk | danielszmulewicz: 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:39 | danielszmulewicz | mmarczyk: Makes sense. Thank you. |
| 22:39 | mmarczyk | np |
| 22:40 | callen | danielszmulewicz: exclamation mark usually means "point and aim" |
| 22:40 | callen | more poetically: "Point, aim, and pray" |
| 22:40 | danielszmulewicz | callen: :-) |
| 23:10 | mklappstuhl | how do I reload my current namespace and all the things required in it? |
| 23:13 | chord | is anyone here actually using clojure for something significant |
| 23:14 | coventry | Yeah, I'm making a starcraft clone. I expect it to solve world hunger and cure cancer. |
| 23:15 | mklappstuhl | coventry: cool, me too |
| 23:16 | mklappstuhl | is there a way to stop runtime execution in clojure similiar to ruby's pry gem? |
| 23:17 | `cbp | i use clojure at work to make pretty charts about stuff |
| 23:19 | coventry | mklappstuhl: There is the ritz debugger, and George Jahad's macro (see here https://coderwall.com/p/xayyvq). Nothing very fancy at this point. |
| 23:29 | scottj | What was the aurora thing ibdknox demoed at strangeloop? the mentions on twitter aren't very revealing |
| 23:59 | Apage43 | happy little tries |