2013-10-28
| 00:00 | jared314 | amalloy: what do you mean by nicer? |
| 00:00 | jared314 | amalloy: faster? |
| 00:00 | jared314 | amalloy: more readable? |
| 00:00 | amalloy | well, it might or might not be faster, but it's prettier and more readable |
| 00:01 | jared314 | (reduce #(assoc %1 (first %2) (apply f %2)) m m)) |
| 00:01 | jared314 | that is what I ended up with |
| 00:02 | amalloy | (into {} (for [[k v] m] [k (f k v)])), then |
| 00:02 | dnolen | from 0 to 60 with ClojureScript, fast recompiles and source maps - zero config http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/ |
| 00:04 | jared314 | amalloy: if I use into, does it reuse the structure of the original map? or is it an entirely new map |
| 00:08 | amalloy | it builds a new map |
| 00:09 | amalloy | which is rather cheaper than building copies of the original map which contain entries you're just going to overwrite anyway |
| 00:09 | jared314 | unless i make it a transient |
| 00:09 | amalloy | into does that anyway |
| 00:10 | muhoo | simple static server, https://www.refheap.com/20206 |
| 00:15 | jared314 | amalloy: ok i'll use into then |
| 00:15 | jared314 | amalloy: thanks |
| 00:45 | ddellacosta | dnolen: nice. I'm going to write something up this week describing the workflows I've been using and tools that have helped me get going in CLJS. Aiming to be a good companion piece to yours for people getting going, giving them an introduction to ways of using the tools and libraries that are out there as of late 2013. |
| 00:47 | dnolen | ddellacosta: excellent! |
| 00:52 | jared314 | is there a function that can give me the namespace folder path from the namespace string? |
| 00:53 | brunokim | folder path? What do you mean? |
| 00:53 | jared314 | I have "something.core" and I am looking for "something/core.clj" |
| 00:54 | jared314 | but there are character replacements, so I was wondering if there was already a function to do it |
| 00:54 | brunokim | ah, ok, just a character replacement, not in fact look for the basis file and such? |
| 00:55 | dobry-den | |
| 00:55 | jared314 | brunokim: just the string path |
| 00:57 | brunokim | I guess (-> ns-name (str/replace "." "/") (str ".clj")) could do the trick |
| 00:58 | brunokim | oops, ns-name is already a function |
| 00:58 | jared314 | brunokim: i would also want to do a namespace-munge too |
| 01:00 | brunokim | in the REPL, the following worked to find the current namespace name: |
| 01:00 | brunokim | (-> *ns* ns-name (str/replace "." "/") (str ".clj")) |
| 01:00 | dobry-den | namespace-munge is literally another character replace |
| 01:01 | jared314 | dobry-den: i know, but it is maintained by the people working on core |
| 01:01 | jared314 | dobry-den: so if it changes my code will still work |
| 01:01 | brunokim | what's namespace-munge? |
| 01:01 | dobry-den | yeah, but it's also (.replace s "-" "_") |
| 01:01 | jared314 | dobry-den: future proofing |
| 01:01 | brunokim | Are you trying to convert between clojure namespace and java package? |
| 01:02 | jared314 | brunokim: the folder names are valid java package names |
| 01:02 | jared314 | brunokim: so yes |
| 01:02 | dobry-den | im not saying dont use it, im just saying it's not magical |
| 01:02 | jared314 | dobry-den: yeah, i looked at the source before I mentioned it |
| 01:02 | jared314 | dobry-den: i know |
| 01:03 | brunokim | well, since gen-class possibly already does something like that, it doesn't hurt to look for it |
| 01:09 | bitemyapp | ddellacosta: that write-up would be very helpful. |
| 01:12 | ddellacosta | bitemyapp: yes, I think it would be useful on a lot of levels. Among other things, I'd like to spark a conversation to get a better idea of how other people are using CLJS: what libraries they are using, what approaches in terms of workflow for testing and development they are using, etc. At the same time I'd like to get beginners clued in to what is possible with the libraries that are around right now. |
| 01:13 | jared314 | thanks brunokim and dobry-den. this is what I ended up with (str (-> "something.core" namespace-munge (clojure.string/replace \. \/)) ".clj") |
| 01:14 | ddellacosta | bitemyapp: I think Mimmo has done a great job with https://github.com/magomimmo/modern-cljs, but I think we need something a little more general and lightweight too. |
| 01:20 | dnolen | ddellacosta: completely agree. I actually think lein templates are pretty sweet way to do CLJS tutorials so that interested users are protected from the seriously uninteresting work of configuring cljsbuild - they can focus on how to use a library. |
| 01:21 | ddellacosta | dnolen: most definitely, that is a great point--I will try to produce some more lein templates too, now that you mention it. |
| 01:24 | bitemyapp | ddellacosta: dnolen a "lein-try" that "just works" for cljs could be cool. |
| 01:25 | bitemyapp | sritchie: welcome to #clojure, here's your allotted picture of a kitten: http://i.imgur.com/Pmyt3SX.jpg |
| 01:25 | sritchie | hahaha |
| 01:25 | sritchie | yessss |
| 01:25 | arrdem | (inc bitemyapp) |
| 01:25 | lazybot | ⇒ 6 |
| 01:25 | sritchie | this is the finest programming language community on IRC, full stop. |
| 01:27 | ddellacosta | bitemyapp: hmm, I wonder how that would work, since there are big differences in how namespaces and libs work under the covers in cljs vs clj. |
| 01:27 | ddellacosta | sritchie: :-) |
| 01:27 | bitemyapp | ddellacosta: I like to sit down, dream up the tool, DSL, or library I actually want - and then just see how close I can get. |
| 01:28 | ddellacosta | bitemyapp: yeah, I definitely hear ya. I do too, and I think dnolen's comment about having some lein templates as a good place to start would help. And I'd definitely love to see something like lein-try for CLJS. But I think we'd need a bit of a different approach. Will think on it. |
| 01:29 | ddellacosta | also, clearly, more kittens |
| 01:30 | bitemyapp | ddellacosta: dunzo: http://i.imgur.com/QsJqLTi.jpg |
| 01:30 | jared314 | http://placekitten.com/ |
| 01:30 | ddellacosta | omg jared314 that is awesome |
| 01:31 | bitemyapp | s/web/cat/g developer |
| 01:31 | ddellacosta | (and don't get me wrong, dogs work too) |
| 01:33 | bitemyapp | ddellacosta: core.async or agents? |
| 01:34 | bitemyapp | I mostly need to serialize operations, I'm not convinced I need core.async, but there might be a use-case I haven't thought of. |
| 01:34 | ddellacosta | bitemyapp: sorry, in regards to those two, what are you asking about? |
| 01:34 | bitemyapp | ddellacosta: rethinkdb client for Clojure, connection management. |
| 01:34 | bitemyapp | reading and writing to the socket. |
| 01:35 | ddellacosta | bitemyapp: oh...well, I'm not sure I can give you a great answer--I haven't used agents in much depth. |
| 01:36 | ddellacosta | bitemyapp: I would imagine core.async would work fine there, but an agent may be more appropriate for reasons I can't imagine right now. |
| 01:38 | dobry-den | im using core.async right now for a client/server loop. involves lots of repl restarts. |
| 01:38 | bitemyapp | I have some specific API related reasons for using agents that could *possibly* simplify it, but there isn't a substantial difference. It's just to serialize side effects safely and without locks in the end. |
| 01:41 | ddellacosta | it's too bad tbaldridge isn't around, I imagine he could give you a great answer. |
| 01:43 | bitemyapp | ddellacosta: I think I poked him earlier today to no avail. |
| 01:43 | bitemyapp | I think my use-case is too boring for him :) |
| 01:43 | ddellacosta | bitemyapp: ah, okay...haha |
| 01:47 | bitemyapp | time to reproduce a race condition I suspect exists but haven't proven yet |
| 01:52 | muhoo | gawd, the "encryption" available in jgit is fucking useless |
| 01:53 | muhoo | it's like ROT13 |
| 01:53 | Apage43 | for what, credentials? |
| 01:53 | muhoo | for encrypting data. it's MD5 and DES. hello? 1993 called and they've been hacked. |
| 01:54 | muhoo | apparently jgit doesn't support actual encryption, just that nonsense. |
| 01:54 | Apage43 | why does jgit include data encryption anyway |
| 01:54 | muhoo | as an option. for "cloud storage" on s3 |
| 01:54 | bitemyapp | lol. |
| 01:55 | jared314 | is that a new 3.x feature? |
| 01:55 | Apage43 | oh. |
| 01:55 | clojurebot | Titim gan éirí ort. |
| 01:55 | muhoo | woudldn't be a bad idea if it was actually somewhat secure. |
| 01:55 | bitemyapp | lein-difftest is pretty sweet btw. |
| 01:55 | bitemyapp | just saved my eyeballs and fingers some hassle. |
| 01:57 | bitemyapp | ooh pretty. I like this plugin. |
| 02:07 | akurilin | bitemyapp, gotta try that, could be useful. |
| 02:13 | seangrove | rot12 is useless |
| 02:13 | seangrove | rot13 is ok, but if you want to be really serious, it's alwasy gotta be rot 21 |
| 02:14 | seangrove | I hear they're working on something new, we're talking like rot23, but I don't think it'll happen this decade |
| 02:14 | bitemyapp | Why can't I reproduce the race condition I thought would happen? |
| 02:15 | bitemyapp | ...thread oblivious code is way too robust in Clojure. |
| 02:16 | bitemyapp | Kinda caremad. |
| 02:17 | bitemyapp | AHA |
| 02:26 | sritchie | do you guys know what the best practice is for pre-routing pages in Compojure? |
| 02:26 | sritchie | say I want to authenticate a user before they hit some route, for example |
| 02:26 | bitemyapp | sritchie: middleware fn (what I do) or Liberator (what the cool kids do) |
| 02:26 | sritchie | I see friend, by cemerick |
| 02:26 | bitemyapp | I'm going to be the bad guy and say don't use Friend. |
| 02:26 | sritchie | yeah, I'm trying to get away from sandbar, |
| 02:27 | sritchie | and Friend looks abandoned |
| 02:27 | bitemyapp | and instead wrap the "protected" routes (or all routes) with vanilla Ring middleware or consider Liberator. |
| 02:27 | bitemyapp | reproducible race conditions make me feel fuzzy inside. |
| 02:28 | sritchie | liberator looks interesting |
| 02:30 | sritchie | bitemyapp: so you're just using something similar to |
| 02:30 | sritchie | https://github.com/adeel/ring-http-basic-auth |
| 02:31 | sritchie | though that's quite old |
| 02:32 | bitemyapp | sritchie: kinda. it's homespun and not basic-auth though. |
| 02:32 | bitemyapp | similar design superficially |
| 02:33 | sritchie | cool, thanks |
| 02:33 | sritchie | trying to convert some calls to "pre-routes" from noir |
| 02:33 | sritchie | over to raw compojure |
| 02:34 | bitemyapp | sritchie: not to be a pedant, but for the sake of clarity, any middleware is probably really just concerned with Ring for all intents and purposes. |
| 02:34 | bitemyapp | Compojure is off in its own little world, the dispatch is almost immaterial. Compojure is used with Liberator too. |
| 02:35 | sritchie | yes, I was just stating why I'm poking at this - I'm sure Noir just built up a little piece of its own middleware |
| 02:35 | sritchie | but I want to get a feel for how the ecosystem looks now, so any comment is helpful |
| 02:35 | bitemyapp | Compojure makes it trivial to wrap subsets of your application routes, yes, but the middleware code itself only needs or expects Ring and should be compatible with apps that don't use Compojure - not that that's really a thing. |
| 02:36 | bitemyapp | Compojure is really just "dumb" routing, it begins and ends there. Does a good job of it, but that's all it is. |
| 02:36 | bitemyapp | Everything else is either interfacing directly with Ring or with a library that interfaces with Ring. the whole request and response maps, concentric circles of middleware functions dilly. |
| 02:38 | bitemyapp | Noir was an attempt to "and in the darkness bind them" all the libraries but without the tender loving care of Granger it was left to the not-so-tender mercies of people who weren't keen on frameworks and dismantled it in favor of a library ecosystem. |
| 02:38 | bitemyapp | this attitude is common to Clojurians. |
| 02:39 | sritchie | pedestal looks to be trying to jump into the framework role |
| 02:39 | bitemyapp | Yes but it's attacking a very particular niche. |
| 02:39 | bitemyapp | A niche that involves complicated and typically expensive projects. |
| 02:39 | jared314 | and it is large enough to require time to disassemble |
| 02:40 | bitemyapp | If you know you're going to go nuts with a complicated CLJS frontend client and all kinds of data flying back and forth between server and client then Pedestal might be a fit. Pedestal has some of the "decision graph" stuff that Liberator offers as a library. |
| 02:40 | bitemyapp | I'd prefer libraries. |
| 02:41 | bitemyapp | I don't even like the global connection pooling in Korma. I glare with daggers in my eyes at c3p0 at least once a week. |
| 02:48 | bitemyapp | https://github.com/acfoltzer/cabal-meta This says a lot, and it terrifies me. |
| 02:53 | sritchie | bitemyapp: I'll need to do some studying before getting liberator |
| 02:55 | sritchie | but it looks like the idea here is that you use these calls to "resource" instead of passing your view functions directly, |
| 02:55 | sritchie | and this makes the auth, etc decision tree explicit |
| 02:55 | bitemyapp | Yeap. |
| 02:55 | bitemyapp | lets you more easily part out and reuse things like auth and to compose resources like data. |
| 02:55 | bitemyapp | if you have two routes that are vanilla functions, you can't merge them. |
| 02:56 | bitemyapp | you *can* merge maps with keys pointing to fns. |
| 02:56 | bitemyapp | Thus, the Zen of Liberator. |
| 02:56 | bitemyapp | it's all dataaaaaaaaaa |
| 02:56 | mullr | Anybody know the status of core.typed with clojurescript? I see the source in there, but I'm not sure if it's supposed to work yet... |
| 02:56 | sritchie | :) |
| 02:56 | bitemyapp | mullr: no-mans-land. Put on a pair of galoshes and dive in if you're a hearty soul. |
| 02:56 | sritchie | bitemyapp: so, with liberator, |
| 02:57 | sritchie | you wouldn't need the middleware, since this effectively tacks on resource-specific middleware |
| 02:57 | sritchie | to certain routes |
| 02:57 | sritchie | (if used w/ compojure) |
| 02:57 | bitemyapp | sritchie: aye, and you could arbitrarily compose/inherit/merge said resources from parent/siblings definitions |
| 02:58 | sritchie | ah, so you make an "admin" that can look up a userid or whatever from the current session, then fork, |
| 02:58 | bitemyapp | (reduce merge {:my-fn #()} [secure-resource checked-resource logged-resource]) |
| 02:58 | sritchie | then you merge that with your page |
| 02:58 | muhoo | bummer. clojure.tools.trace/trace-vars doesn't |
| 02:58 | sritchie | bitemyapp: merge-with comp, right? |
| 02:59 | sritchie | to get the functions to stack? |
| 02:59 | bitemyapp | sritchie: yep. |
| 02:59 | muhoo | prints exactly nothing. |
| 02:59 | bitemyapp | it wasn't intended to be perfect code, sorry. |
| 02:59 | sritchie | haha, just making sure I understood |
| 02:59 | sritchie | but yes |
| 02:59 | bitemyapp | you appear to have the idea just fine :P |
| 02:59 | sritchie | awesome |
| 03:01 | muhoo | and, when trace-ns says no source path, but there's definitely a source path |
| 03:03 | muhoo | ohh wait, nm. holy crap it's working allright. it just prints to the nrepl repl |
| 03:03 | muhoo | not to stdout or log4j. |
| 03:04 | muhoo | sure do wish ther was a way to log this stuff somewhere more sane than that though. |
| 03:04 | akurilin | Should the following work? lein repl :connect localhost:7888 ? |
| 03:06 | akurilin | I keep getting told "port is required" |
| 03:06 | akurilin | there was a change just in that check about 10 days ago, not sure that might have affected it |
| 03:11 | muhoo | akurilin: only one way to find out: try an older lein and see if it works |
| 03:34 | bitemyapp | ddellacosta: You know what San Francisco needs that Tokyo has? Cat lounges. |
| 03:35 | bitemyapp | ddellacosta: I want to pay money, get some tea, and be surrounded by cats. |
| 03:35 | bitemyapp | Not a cat, a few cats...I want to drown in cats. |
| 03:35 | bitemyapp | *not a few cats |
| 03:35 | ddellacosta | bitemyapp: ha, haven't been to one of those places yet, although have heard about them |
| 03:36 | ddellacosta | bitemyapp: when you come to Tokyo, we can go. ;-) |
| 03:36 | ddellacosta | I'm betting it's not as idyllic as you would imagine though, knowing how these things go here |
| 03:36 | bitemyapp | ddellacosta: you'll have to cart me out in a wheelbarrow if we do |
| 03:36 | bitemyapp | because I'll OD on cats. |
| 03:36 | bitemyapp | ddellacosta: sure, but...cats. |
| 03:37 | ddellacosta | bitemyapp: haha...well, it's on the list then. :-) |
| 03:44 | TEttinger | bitemyapp, you're fairly close to the cat house on the kings I imagine |
| 03:45 | bitemyapp | ? |
| 03:47 | TEttinger | it's for when you want way too many cats around you |
| 03:48 | TEttinger | https://maps.google.com/maps?hl=en&q=cat%20house%20on%20the%20kings I have no idea how far this is from san francisco |
| 03:48 | TEttinger | they have 700 cats just roaming the yard |
| 03:48 | Apage43 | heh |
| 03:49 | TEttinger | welcome to #meowjure |
| 03:49 | bitemyapp | TEttinger: that is nowhere near me, but that is interesting. |
| 03:50 | TEttinger | I volunteered at a local humane society, it's good work they're doing |
| 03:52 | TEttinger | pasadena HS had to suddenly shelter something like 40 cats that they did not have room for because they were confiscated from a hoarder. and they couldn't be adopted until the criminal trial was settled |
| 03:53 | TEttinger | bitemyapp, if I were you I would settle for kitten cams. |
| 03:54 | Apage43 | See also http://en.wikipedia.org/wiki/Buenos_Aires_Botanical_Garden |
| 03:54 | muhoo | http://www.youtube.com/watch?v=VbyTAtBv7k0 |
| 03:54 | TEttinger | http://new.livestream.com/tinykittens/jungle |
| 03:55 | Apage43 | https://www.youtube.com/watch?v=eSETs3oXwpQ |
| 03:56 | Apage43 | So if you ever wind up in Buenos Aires, you know where to go =P |
| 04:11 | ddellacosta | sritchie: just to be the devil's advocate to bitemyapp, Friend is not abandoned and works pretty well, and I would also think about using my boss's lib https://github.com/diligenceengine/safeguard which is a hidden gem--but it does *post* routing filtering. We use it not just for validation but for all kinds of filtering; you set up policies and away you go. Very nice lib. |
| 04:12 | sritchie | nice, awesome |
| 04:12 | sritchie | thanks for the pointer |
| 04:13 | ddellacosta | (I'm a bit biased since I'm working on this: https://github.com/diligenceengine/safeguard) |
| 04:13 | ddellacosta | whoops, not that |
| 04:13 | ddellacosta | this |
| 04:13 | ddellacosta | https://github.com/ddellacosta/friend-oauth2 |
| 04:13 | ddellacosta | but, the liberator approach seems pretty great too. So, I guess it really just depends on which one suits you the most. |
| 04:14 | muhoo | now this is an interesting wtf https://www.refheap.com/20209 |
| 04:14 | muhoo | what does that even mean. what index is out of what bounds? |
| 04:15 | ddellacosta | muhoo: sounds like you are referencing an index on an array which doesn't exist |
| 04:15 | ddellacosta | if I saw your code I'd be better able to offer suggestions. ;-) |
| 04:15 | muhoo | i'm not doing anything of the sort. notice my code isn't even involved in that stacktrace |
| 04:15 | muhoo | it looks like pst or nrepl itself is puking |
| 04:16 | ddellacosta | I mean, I don't know what you are doing or in what context, so it's hard to say |
| 04:16 | SegFaultAX | ,(nth [] 1) |
| 04:16 | clojurebot | #<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException> |
| 04:16 | muhoo | but i'm not calling nth |
| 04:16 | muhoo | that's not in my code |
| 04:17 | muhoo | it's odd, it looks like clj-stacktrace itself has lost control of its bladder |
| 04:17 | muhoo | probably on the way to reporting a bug in my code, but it never got that far. |
| 04:17 | ddellacosta | it may be the indirect effect of something else. But again, can't say without seeing your code, or knowing what you are doing |
| 04:18 | ddellacosta | This seems key through: NO_SOURCE_FILE:2 user/eval26014 |
| 04:19 | ddellacosta | *though |
| 04:21 | muhoo | stacktraces usually don't report errors in stacktrace |
| 04:22 | muhoo | aha! i restarted the jvm, and now i'm getting a proper stacktrace showing the errors in my code |
| 04:22 | muhoo | something is.... not right. why is clj-stacktrace getting confused, statefully? |
| 04:23 | SegFaultAX | muhoo: It's hard to answer questions when you provided absolutely no context. At all. |
| 04:24 | SegFaultAX | Other than increasingly graphic descriptions of stackstraces. |
| 04:26 | andyfingerhut | Friend 0.2.0 was released on Oct 1 2013 and it looks abandoned? |
| 04:27 | muhoo | SegFaultAX: the context seems irrelevant. this has happened a few times now on totally different forms in totally diffferent namespaces. it appears to be a problem with the tooling. |
| 04:28 | SegFaultAX | muhoo: Fix it and file a PR. |
| 04:28 | muhoo | finding problems with the tooling is difficult without the tooling, but yeah, if i track it down, i'll do that. |
| 04:29 | muhoo | FWIW, it started going crazy once i added clojure.tools.trace to my classpath. |
| 04:33 | muhoo | hmm, and specifically once i require the ns, and trace something. then somethign seems to break in eiither nrepl or clj-stacktrace or something. will have to track it down more. |
| 04:35 | SegFaultAX | andyfingerhut: Abandoned is a pretty strong word. Personally my issue is that friend hasn't matured that much since it first came out, and there still isn't a super mature general purpose authentication library (that I'm aware of) for Clojure. |
| 04:36 | SegFaultAX | I think this inevitably leads to everyone inventing their own solution, which is almost always less than ideal. |
| 04:37 | andyfingerhut | SegFaultAX: I should have been clearer. I was looking through the logs and responding to a comment sritchie made a couple of hours ago, not realizing I was that late in responding. My bad for not providing better context. |
| 04:39 | sritchie | yeah, that was my mistake |
| 04:39 | sritchie | sorry about that |
| 04:40 | muhoo | is it possible that not many people are using clojure for complicated social-networkign single-sign-on kind of apps? |
| 04:41 | muhoo | maybe what friend has is more than good enough for what people are actually doing? |
| 05:09 | makkalot | hi can anyone help, i'm stuck with that async example http://pastebin.com/Q9HxEcU0 and http://pastebin.com/7PWZxmCw |
| 06:14 | mmarczyk | cgrand: ping |
| 06:14 | cgrand | mmarczyk: pong |
| 06:15 | mmarczyk | cgrand: that's some quick patching action |
| 06:15 | mmarczyk | :-) |
| 06:16 | cgrand | So it's line #839 and below where array.length should be replace by 2*this.count |
| 06:16 | cgrand | because the array.length == 2*count invariant doesn't hold with nodes produced by tranisents |
| 06:17 | mmarczyk | right |
| 06:17 | cgrand | I'm going to check for similar bugs befre sending a patch, a second pair of eyeballs would be more than welcome |
| 06:17 | mmarczyk | happy to lend mine :-) |
| 06:17 | cgrand | as I said: transients are touhy |
| 06:18 | cgrand | touchy even |
| 06:18 | mmarczyk | yes, it's quite amazing really |
| 06:18 | mmarczyk | for some reason the (f) case works in ClojureScript |
| 06:18 | mmarczyk | but the logic seems to be the same |
| 06:18 | mmarczyk | so presumably either I made a typo while testing or there's some small difference somewhere which slightly changes the shortest path to the problem... |
| 06:19 | mmarczyk | I'm happy to test the patch on both sides if you'd like to provide the ClojureScript version too, or else transfer it once it's tested in Clojure |
| 06:20 | cgrand | in JS does 2 and -1 hash to the same value? |
| 06:21 | cgrand | about while seq works: seq knows that keys can't be nil and skip them. seq doesn't loo at count for the node |
| 06:22 | hyPiRion | mmarczyk: I would guess the hash is different? |
| 06:22 | hyPiRion | for the cljs case |
| 06:22 | mmarczyk | oh yes, of course |
| 06:23 | mmarczyk | ok, so it'll be no problem to produce a similar test case with some colliding strings |
| 06:24 | cgrand | my preferred way to test those is to use two reify producing the same hard coded hashCode |
| 06:24 | cgrand | (thus not dependent on the hash claculsation) |
| 06:24 | mmarczyk | good call :-) |
| 06:26 | mmarczyk | bbloom: thanks for asking about core.rrb-vector perf! will be moving forward again soon |
| 06:26 | makkalot | does 'dotimes' work for core.async in clojurescript , it seems it got blocked somehow ? |
| 06:28 | mmarczyk | I'll have more news on that next time, need to dash now |
| 06:29 | cgrand | Ok, I didn't find other similar errors, preparing the patch. |
| 06:29 | mmarczyk | cgrand: cool |
| 06:30 | mmarczyk | cgrand: I actually must run now, I'll take it for a test drive next time I'm at the keyboard though |
| 06:30 | cgrand | I let you investigate on the CLJS side |
| 06:30 | cgrand | ok see you |
| 06:30 | cgrand | thanks |
| 06:45 | staafl | what's the rationale for grouping closing parens in code? |
| 06:48 | staafl | instead of having them on separate lines |
| 06:51 | honza | staafl: it makes the code look cleaner - if your indentation is right, you don't even have to look at the closing parens |
| 06:53 | staafl | honza, interesting point |
| 07:29 | glosoli | would it be right to to check if java.sql.TimeStamp dates are equal using (= date-one date-two) ? |
| 07:30 | hyPiRion | if dateOne.equals(dateTwo), sure thing |
| 07:33 | glosoli | hyPiRion: so this means yes I guess heh :D |
| 07:33 | glosoli | thanks |
| 07:36 | hyPiRion | np |
| 07:54 | mercwithamouth | has anyone ported the light table theme to emacs by chance? |
| 07:55 | mercwithamouth | emacs-live rather |
| 07:59 | mrhanky | hi folks |
| 08:01 | minimal | mercwithamouth: noctilux is pretty close |
| 08:03 | mrhanky | i'm new to clojure, i have clj-file with a namespace (sample-ns). why does "(:use sample-ns)" does not work but "(:use sample-ns.hello)" does? |
| 08:22 | mercwithamouth | hmm using light table and the instarepl fails to connect every time. =( |
| 08:24 | HolyJak | mrhanky: if you could share the code f.ex. via https://www.refheap.com/, it would be easier to help you :) |
| 08:28 | mrhanky | HolyJak, i only want to know why i simply cant do "(:use sample)" (sample is the given ns of a clj-file i got). if i try to use this file with this ns i get "cannot find class", but if i change the ns to "sample.bla" and modify my :use it will work without any problems |
| 08:29 | mrhanky | and i want to avoid changing the ns of the existing clj-file |
| 08:32 | HolyJak | How is your code and files structured? |
| 08:33 | mrhanky | HolyJak, https://www.refheap.com/20212 |
| 08:34 | mrhanky | i dont want to modify impl.clj |
| 08:37 | mrhanky | i think i got it, i moved impl.clj out of the consize dir and renamed it to the ns name |
| 08:37 | HolyJak | ns and files/dirs are related to each other. your impl should have ns consize.impl - if not, it won't work properly. I don't know a workaround but i know little about compilatin in clojure |
| 08:37 | HolyJak | good |
| 08:37 | mrhanky | this stuff is so weird :) |
| 08:37 | HolyJak | not really, at least if you are used to packages in java |
| 08:37 | mrhanky | i mean the whole clojure thing |
| 08:44 | sszzqq | The syntax is ok? => (let [[_ _ [_ a]] [1 2 [3 4]]] a) |
| 08:45 | sw1nn | account 0 del |
| 08:47 | Jarda | ,(let [[_ _ [_ a]] [1 2 [3 4]]] a) |
| 08:47 | clojurebot | 4 |
| 08:47 | Jarda | sszzqq: ^^ |
| 08:52 | mrhanky | *sigh |
| 08:55 | sszzqq | Jarda: thanks, Let is so powerful, |
| 08:56 | sszzqq | Jarda: let could binding any depth local var value. |
| 08:57 | mrhanky | mh i copied my leiningen project from my desktop to my notebook. i use jetty for a http service, incl lein-ring to have a dev server. now after copying my project running the server gives me errors in java.util.regex.Pattern: https://www.refheap.com/20214 |
| 08:58 | mrhanky | the code works on my desktop |
| 08:58 | sszzqq | ,(let [ [_ [_ [_ a]]] [1 [2 [3 [4 5]]]]] a) |
| 08:58 | clojurebot | [4 5] |
| 09:00 | glosoli | is there something inbuilt that would let me replace last occurance of dot ? |
| 09:00 | glosoli | in a string |
| 09:01 | sszzqq | ,(do (def var [1 [2 [3 [4 5]]]]) (let [[_ [_ [_ a]]] var]) a) |
| 09:01 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 09:18 | mdrogalis | tbaldridge: Would you be okay with me quoting you on the sentence "Test systems, not functions"? |
| 09:19 | tbaldridge | mdrogalis: sure, but I'm not sure I coined that phrase. It's more of a paraphrase of what other Clojure devs have said. |
| 09:20 | mdrogalis | tbaldridge: Close enough. :P Have it in my chat logs by you. Hah. |
| 09:21 | rkneufeld | Hey, can anyone intimately familiar with leiningen/data-readers internals comment on the kludgy-ness of this change to lein-try? https://github.com/rkneufeld/lein-try/commit/c652ebe780477bfa78463769c77e2482f56dec8d. We're trying to make data-readers work properly outside of projects and this seems to fix our issues. |
| 09:27 | glosoli | http://bpaste.net/show/rWs9iKTIgLjfTThzLH6F/ any ideas if this is a good way to attach date-time to the file name string, just before file extension |
| 09:39 | mdrogalis | tbaldridge: Hot off the press, when you get a few minutes. :) http://michaeldrogalis.tumblr.com/post/65274692089/clojure-understood-the-rush-hour-platform |
| 09:42 | hyPiRion | rkneufeld: Not entirely sure why `(prj/project-with-profiles)` is in there, otherwise it seems fine Leiningen-wise |
| 09:47 | rkneufeld | hyPiRion: having not written that, I don't understand what it does either... |
| 09:47 | rkneufeld | hyPiRion: I can only imagine it helps in the case that project was nil to begin with... |
| 09:48 | tbaldridge | mdrogalis: nice read! It's a cool program. |
| 09:50 | mdrogalis | tbaldridge: Thank you! |
| 09:53 | mdrogalis | I have a feeling my micro instance on EC2 might get overwhelmed today. |
| 09:54 | tbaldridge | mdrogalis: I wonder if the output data could be baked, and then run the entire thing from the client. |
| 09:55 | mdrogalis | tbaldridge: It absolutely can. If you listen on the websocket that ClojureScript is using, it's just arrays of coordinates. |
| 10:26 | bordatoue | when starting an exteranl java application using log4j how do we manage to see the log in a the repl. I can't find any logs at all . I am using nrepl. Could anyone tell me how to access nrepl-server buffer |
| 10:34 | bordatoue | say if i got an exteranl .jar file that prints output to the console , system.out.println; how to i see these output on the repl. I am using nrepl. When i kill the application I can see it populates *nrepl-server* buffer, is there any way to see these output as it is generated |
| 11:06 | instilled | it should populate *nrepl-server* buffer in emacs |
| 11:06 | instilled | before you kill the application |
| 11:07 | instilled | that is, you should see it there as soon as you print to the console. This of course also applies if you use a logging library that logs to the console |
| 11:08 | bordatoue | instilled: i can't see anything on *nrepl-server* buffer in emacs, but when i kill the process it appears all of a sudden in *nrepl-server* |
| 11:09 | bordatoue | instilled: how do I access *nrepl-server* I just typed in C-x b *nrepl-server* is it the correct way to access nrepl-server |
| 11:10 | instilled | yes, basically you switch to that buffer. |
| 11:10 | vmarcinko | hi, is there some URL roadman for clojure v1.6 exists? |
| 11:10 | vmarcinko | URL for v1.6 roadmap I meant |
| 11:10 | instilled | bordatoue: could be that the buffer is not automatically scrolled to the buttom. |
| 11:10 | bordatoue | instilled: I didn't have this problem with slime |
| 11:11 | stuartsierra | vmarcinko: Roughly, http://dev.clojure.org/display/design/Release.Next+Planning |
| 11:11 | vmarcinko | ok, thanx |
| 11:12 | bordatoue | instilled: the buffer appears to be empty i tried C-x [ |
| 11:13 | instilled | bordatoue: how do you jack-in? |
| 11:13 | bordatoue | instilled: nrepl-jack-in |
| 11:14 | bordatoue | instilled: *nrepl-server* buffer doesn't come up , I need to explicitly open the buffer |
| 11:18 | instilled | bordatoue: i haven't updated nrepl.el in a while… at least it used to work. btw. nrepl is now called cider https://github.com/clojure-emacs/cider |
| 11:19 | bordatoue | ok, I will try that, is it available via package manager in emacs |
| 11:20 | instilled | bordatoue: i haven't updated yet. don't know what changed expect the name of course... |
| 11:21 | instilled | bordatoue: what package manager do you use? |
| 11:21 | dnolen | tbaldridge: did the macro line/col thing get into 1.6 do you know? |
| 11:21 | bordatoue | instilled: thanks very much, i have got the following ELPA,gnu,marmalade,melpa |
| 11:22 | tbaldridge | dnolen: I don't know. |
| 11:22 | instilled | bordatoue: follow the readme in https://github.com/clojure-emacs/cider |
| 11:22 | instilled | bordatou: you're welcome. let me know if that worked... |
| 11:23 | bordatoue | instilled: will keep you updated |
| 11:25 | bbloom | cgrand: looking at your patch for the hash collision nodes fix, i had to smile at the subtlty of the bug in code of a sort i haven't had to look at in a long time :-) |
| 11:29 | cgrand | bbloom: Clojure makes a good job of preserving us from this kind of "subtlety" |
| 11:39 | staafl | is it possible to write in lisp without visual brace matching? |
| 11:40 | staafl | it doesn't seem so to me, but maybe I'm just missing a trick |
| 11:41 | shoshin | ping, a clojure newbie question here. i'm trying to take an optional argument to a function but i'm unable to figure out what i'm doing wrong here. |
| 11:41 | tbaldridge | sure it is. See the videos from the 1980's of "SICP". In there they write lisp on a blackboard. |
| 11:41 | tbaldridge | shoshin: can you post a code sample? |
| 11:41 | bbloom | staafl: i don't use any kind of paredit, auto paren insertion, or anything like that |
| 11:42 | shoshin | (defn sample [x {:keys [load?] :or {load? false}}] (when load? (println "load? is true)) (println x)) |
| 11:42 | staafl | tbaldridge, I remember a few times when they had to manually track braces with their hands |
| 11:42 | shoshin | tbaldridge ^^ |
| 11:42 | staafl | bbloom, what about visual matching/highlighting? |
| 11:42 | bbloom | the only thing i use is the most basic matching that's standard in vim, same for every other language with {} [] () |
| 11:43 | shoshin | tbaldridge when i call this function just as (sample 2) i get an arity execption |
| 11:43 | bbloom | and i'm pretty sure i could live without that |
| 11:43 | shoshin | what am i doing wrong here? |
| 11:43 | znDuff | staafl: eh; with paredit-type tools, there's nothing "visual" about it -- the editor *won't let you* get into a situation where your content isn't syntactically valid. |
| 11:43 | bbloom | i do use % to jump to the matching brace quite frequently though, couldn't live witout that |
| 11:43 | ndp | shoshin: in your :or map, load? needs to be a keyword |
| 11:44 | bbloom | i know i'm a bit of a heretic, but i *hate* paredit |
| 11:44 | bbloom | of any kind |
| 11:44 | bbloom | i often write syntactically invalid code while i'm thinking |
| 11:44 | shoshin | ndp like :load? |
| 11:44 | bbloom | on purpose... |
| 11:44 | znDuff | bbloom: ...I can't stand any kind of _inadequate_ paredit -- if it isn't complete enough to let me write things the way I think of them, it's awful. |
| 11:44 | tbaldridge | <disowned> "bbloom? Never heard of him." |
| 11:44 | znDuff | bbloom: but the emacs version is in my experience good enough that as long as you have its commands in your finger-memory, you can represent anything you need to. |
| 11:45 | znDuff | bbloom: ...though yes, that means you need to scale its learning curve pretty completely before the experience becomes a good one. |
| 11:45 | bbloom | i tend to write something like a demented hybrid between documentation, language comments, real code, pseudocode, lisp, python, and shit i just plain made up |
| 11:45 | staafl | znDuff, paredit looks intriguing |
| 11:45 | bbloom | then when it looks right, i massage that in to real code |
| 11:46 | ndp | shoshin: yep, just like that |
| 11:46 | bbloom | paredit totally fucks with my brain |
| 11:46 | shoshin | ndp (defn sample |
| 11:46 | shoshin | [x {:keys [load?] |
| 11:46 | shoshin | :or {:load? false}}] |
| 11:46 | shoshin | (when load? |
| 11:46 | shoshin | (println "load is true")) |
| 11:46 | shoshin | (println x)) |
| 11:46 | bbloom | i had to turn off even the most basic of brace insertion in intellij for java |
| 11:46 | mikerod | Is it possible that every .clj file can be fully AOT compiled to .class files? So say I have a project with some clj dependencies, could everything be compiled AOT into .class files and all of the .clj files removed from the resulting jar? I'm just curious if AOT compilation is "fully-capable". |
| 11:46 | shoshin | i still seem to be getting a problem. |
| 11:46 | shoshin | :/ |
| 11:47 | stuartsierra | mikerod: Yes. |
| 11:47 | znDuff | mikerod: it's a bad idea -- you lose compatibility with future versions of Clojure when you do that. |
| 11:47 | znDuff | mikerod: ...but if you're willing to eat that restriction, yes, it's possible. |
| 11:48 | mikerod | znDuff: I know the incompatibility concerns. I was just curious if AOT compilation is able to fully compile anything from clj source. |
| 11:48 | stuartsierra | AOT-compilation isn't really different from normal on-the-fly compilation: it just writes out the .class files to disk. |
| 11:50 | mikerod | stuartsierra: That was my understanding. I was just curious if you could set up some clj source that could be sneaky and leave some computation uncompiled until called upon or something. If that explanation makes sense. |
| 11:51 | ndp | shoshin: You're also missing an ampersand between x and the rest parameter: [x & {:keys [load?] :or {:load? false}}] |
| 11:51 | stuartsierra | mikerod: Yes, if you call `eval`, that expression gets compiled at runtime. But even AOT-compiled Clojure code still depends on clojure.jar, so you always have the compiler available. |
| 11:53 | shoshin | ndp aah. okay. but when i call the function with (sample "12") it returns "12" (because of the println). But in the case of adding (sample "12" true) it says no value supplied for they key true. What am i missing? |
| 11:53 | mikerod | stuartsierra: That makes sense. The compiled source is sufficient then on its own. |
| 11:53 | stuartsierra | yes |
| 11:53 | mikerod | I appreciate the quick feedback. |
| 11:54 | ndp | shoshin: If you want to provide a keyword argument, you need to call with a key-value pair like so: (sample "foo" :load? true) |
| 11:55 | shoshin | ndp *facepalm* thank you for your help! |
| 11:55 | ndp | shoshin: Also, to be clear, (sample) is returning nil, but it prints the value of x to *out* |
| 11:55 | shoshin | ndp ah. okay. |
| 11:55 | ndp | shoshin: Hey, no prob |
| 11:58 | wakeup | hi ho |
| 11:59 | wakeup | I need a crc-24 or equal in clojure (e.g. a 24bit hash), anything available? |
| 11:59 | wakeup | Can only find java's crc32 |
| 12:00 | ndp | wakeup: do you need to interoperate with an external system? |
| 12:01 | wakeup | ndp: nope |
| 12:01 | znDuff | wakeup: most hash functions can be truncated safely. |
| 12:01 | znDuff | err, hash functions' output |
| 12:02 | wakeup | znDuff: Any one you'd recommend thats available in clojure? |
| 12:02 | znDuff | wakeup: I don't know your use case and parameters, so I'm not in a position to recommend anything at all. |
| 12:03 | tbaldridge | wakeup: it looks like bouncycastle has what you are looking for. http://grepcode.com/file/repo1.maven.org/maven2/org.bouncycastle/bcpg-jdk16/1.43/org/bouncycastle/bcpg/CRC24.java |
| 12:04 | tbaldridge | I'd be tempted to just port that to Clojure, the code is under MIT. |
| 12:05 | wakeup | No way |
| 12:05 | wakeup | I don't want to be the one to blame for implementing a broken hash ;) |
| 12:06 | tbaldridge | or you can just use bouncy castle as a dep, and use it from there. |
| 12:09 | staafl | help request: why isn't my implementation of 'reductions' lazy? https://www.refheap.com/20217 |
| 12:09 | staafl | (take 5 (scanl (+) (range)) gives me Stack Overflow |
| 12:10 | TimMc | wakeup: What properties does your hash need? |
| 12:10 | staafl | I'm not using any eager functions on xs |
| 12:10 | TimMc | wakeup: CRC is very different from SHA, for instance. (CRC checks for a specific class of errors.) |
| 12:10 | staafl | and cons is lazy, so far az I get it |
| 12:11 | wakeup | TimMc: I am not even so sure yet, my client has some wild ideas |
| 12:11 | wakeup | about a multi-part hashing scheme that is user-input friendly at the same time. |
| 12:11 | wakeup | with lookup of partial wildcard queries |
| 12:11 | joegallo | staafl: cons is not lazy |
| 12:11 | joegallo | you might want to include a call to lazy-seq in there |
| 12:11 | staafl | joegallo, oh |
| 12:12 | staafl | so I should wrap the second arg in lazy-seq? |
| 12:12 | TimMc | wakeup: CRC is not collision-resistant, for isntance. |
| 12:12 | joegallo | i mean, (cons 1 some-lazy-seq) is lazy in the sense that it doesn't realize the lazy-seq... |
| 12:12 | joegallo | but it's not like (cons ... ...) will magically generate lazy seqs on your behalf |
| 12:12 | wakeup | TimMc: good point. |
| 12:12 | joegallo | staafl: sure, start with that |
| 12:13 | wakeup | I will probably use a sha variant and truncate that. |
| 12:13 | staafl | yeah, it worked |
| 12:13 | wakeup | and just do a hail mary |
| 12:13 | staafl | joegallo, thank you |
| 12:13 | wakeup | see what happens |
| 12:13 | joegallo | you're welcome! |
| 12:15 | staafl | it's a bit weird to me though, since the xs argument *is* lazy |
| 12:15 | staafl | so we have a function that basically cons-es to a lazy sequence, but ends up not being lazy |
| 12:17 | TimMc | &(first (cons 5 (range))) |
| 12:17 | lazybot | ⇒ 5 |
| 12:17 | joegallo | you were eagerly consuming the lazy sequence when you generated your non-lazy sequence |
| 12:17 | TimMc | See? Lazy, after the 5. |
| 12:17 | instilled | in what cases would you usually define :pre and :post conditions in functions? I haven't seen this much in clojure code yet… do you use the at all? any advise? |
| 12:17 | joegallo | TimMc: yeah, exactly |
| 12:18 | joegallo | but the key is that range *was* called, it's not like it lazily avoided invoking the range function |
| 12:18 | staafl | TimMc, oh, I get it |
| 12:19 | TimMc | &(take 10 (cons 5 (range))) |
| 12:19 | lazybot | ⇒ (5 0 1 2 3 4 5 6 7 8) |
| 12:19 | staafl | i'm just used to Haskell thunking function calls |
| 12:19 | staafl | so I assumed the recursion would be lazy |
| 12:22 | joegallo | ah, that's a logical mistake to make, coming from there :) |
| 12:32 | ro_st | i have a seq of non-seq things, and sometimes some things are instead themselves seqs of non-seq things. i want a single seq of things. i don't want to use flatten. what else can i use to expand the nested seqs up into the top seq? |
| 12:33 | TimMc | ro_st: You can use clojure.core/for, I think. |
| 12:33 | TimMc | mapcat could also be useful. |
| 12:34 | TimMc | It's best to avoid ending up with those sorts of heterogeneous data structures in teh first place, of course. |
| 12:35 | ro_st | well, it's the nature of the source data. datomic log, from which i'm inferring Important Things That Happened. sometimes we only notify one person, sometimes we notify two. i want triggers to be able to return one notice or a handful, and then to walk the whole list of notices and flatten it to a uniform shape for the next step |
| 12:37 | hlship | So it looks like protocols and varadic parameters are a no, go? Is this intentional? |
| 12:38 | dobry-den | ro_st: have you looked at clojure.walk? it might help to see flatten's simple implementation (uses walk) |
| 12:39 | ro_st | thanks dobry-den and TimMc. sleuthing to do! |
| 12:44 | clgv | I remember a library for graph visualization that was mentioned on the mailing list. what is its name? |
| 12:45 | hyPiRion | clgv: nephila |
| 12:45 | hyPiRion | or, well, that's not a library, but visualizes your namesspaces. Probably not what you want. |
| 12:46 | clgv | hyPiRion: it was from one of the well-known clojure folks that produce a lot of libraries. |
| 12:46 | hyPiRion | clgv: https://github.com/ztellman/rhizome then |
| 12:46 | TimMc | You probably want one of nephila's dependencies, though. |
| 12:46 | TimMc | ^ that |
| 12:47 | clgv | oh right i remembered zach but didnt find a promising name in his repos |
| 12:48 | clgv | can I label edges in rhizome? the examples do not show anything like that |
| 12:50 | hyPiRion | probably some value (e.g. :label) to `:edge->descriptor`? |
| 12:51 | clgv | hmm right. reading the source now... |
| 12:53 | clgv | hooray for lein-try ;) |
| 12:54 | seangrove | If something's been defonce'd, how can I "undef" it so it can be re-defonce'd? |
| 12:54 | seangrove | I'm using a library that does a defonce under the covers, and it's bothering my repl workflow |
| 12:55 | clgv | hyPiRion: ok :edge->descriptor it the tool |
| 12:55 | clgv | *is |
| 12:56 | hyPiRion | ah, goodie |
| 12:58 | dobry-den | What comes to mind for you if you wanted to use core.async for client/server socket interaction? I don't know design patterns and am arriving at a system where I send outbound messages on out-channel, and I have a listener asychronously listening on in-channel which parses incoming bytes and updates the state-machine. |
| 12:59 | mdrogalis | dobry-den: I do something like that. It works out great. |
| 12:59 | mdrogalis | You just sit core.async ontop of the socket library. |
| 13:00 | jared314 | has anyone put core.async on top of any other forms of IPC? |
| 13:00 | jared314 | other than sockets |
| 13:01 | seangrove | jared314: 0mq count? |
| 13:01 | dobry-den | mdrogalis: I'm making progress, but I also feel like I'm programming in a cave. Do you know of any examples that use core.async for networking? |
| 13:01 | jared314 | seangrove: i thought that had sockets |
| 13:02 | seangrove | I don't think exclusively |
| 13:02 | seangrove | Been about 2 years since I used it though |
| 13:02 | seangrove | Probably just sockets |
| 13:03 | dnolen | jonasen: hey trying to get Google Chrome Dev Tools to syntax highlight ClojureScript as Clojure, did you have to configure Code Mirror in any specific way? I thought Code Mirror shipped w/ Clojure support. |
| 13:07 | grncdr | dnolen: nice blog post, I'd recommend you use lein cljsbuild 1.0.0-SNAPSHOT in the project.clj though, 0.3.4 has the crashing bug in `lein cljsbuild auto` that is super annoying |
| 13:07 | dnolen | grncdr: not going to point to snapshot |
| 13:07 | grncdr | fair enough, would 0.3.3 work? |
| 13:08 | dnolen | grncdr: mies will get updated soon enough and so will CLJS, going to wait for that |
| 13:08 | dnolen | grncdr: in the mean time what's there is good enough for people who want to play around. |
| 13:08 | grncdr | ok |
| 13:13 | dnolen | grncdr: wanted to thank you again for the earlier feedback, it inspired me to push this stuff along. |
| 13:16 | grncdr | np ;) |
| 13:16 | grncdr | I'm hoping to do more than complain eventually |
| 13:18 | dnolen | grncdr: articulate complaining is always welcome. Also you're timing was good - if you'd complained a year ago there's not much we could have done - it's been a long road getting here. |
| 13:18 | dobry-den | I'm writing an app that does a lot of work with bytes. It swaps endianness, hex<->bytes, promotes ints, etc. My solution was to represent all bytes in my system as a vector of strings: ["0a" "0b" "0c"]. it makes it easy to, say, checksum with (take 4 (double-sha256 <hex-vector>)). but I was criticized when I showed the approach to some people but not really given any feedback. |
| 13:18 | dobry-den | What would be wrong with that? |
| 13:19 | grncdr | dobry-den: speed maybe? |
| 13:20 | dobry-den | grncdr: Yeah, for sure. That's the thing I decided to defer for later |
| 13:20 | dobry-den | I found working with byte-arrays directly to be insufferable due to constantly mapping int or some bytes->hex helper over them anyways |
| 13:21 | grncdr | ok, so if you don't mind me asking: how were you criticized without any feedback? |
| 13:21 | grncdr | "I think this sucks" (walks away) |
| 13:21 | grncdr | ? |
| 13:22 | grncdr | I guess what I'm saying is it's difficult to guess what somebody else might've been thinking about ;0 |
| 13:22 | instilled | hi. Can someone help? I'm trying to get the class (Class<?>) of a Java object in clojure, e.g. SomeClass.class. How would i do that in clojure? |
| 13:22 | hiredman | ,(class String) |
| 13:22 | clojurebot | java.lang.Class |
| 13:23 | instilled | ok. |
| 13:23 | hiredman | ,String |
| 13:23 | clojurebot | java.lang.String |
| 13:23 | mdrogalis | dobry-den: Yeah sorry, popped out for lunch. |
| 13:23 | instilled | cheers! |
| 13:23 | dobry-den | haha, i didnt mean to make it sound that way. i just didnt walk away with any other approaches |
| 13:23 | mdrogalis | dobry-den: I have a websocket example? |
| 13:24 | dobry-den | mdrogalis: Do you know of any core.async networking examples? |
| 13:24 | mdrogalis | dobry-den: Right. Is one where it integrates with a websocket sufficient? |
| 13:25 | dobry-den | sure |
| 13:25 | mdrogalis | dobry-den: https://github.com/MichaelDrogalis/asphalt/blob/master/src/cljs/asphalt/core.cljs#L38-48 |
| 13:26 | mdrogalis | Putting a channel over a websocket to obviate using the callback any more than necessary |
| 13:27 | tbaldridge | mdrogalis: *cough* (put! transport-chan data) *cough* |
| 13:29 | drorbemet | Hi, I am looking for an 7zip input stream just like BZip2CompressorInputStream in |
| 13:29 | drorbemet | http://commons.apache.org/proper/commons-compress/apidocs/allclasses-noframe.html |
| 13:29 | drorbemet | but found only SevenZFile and SevenZArchiveEntry which don't seem to output a stream. |
| 13:29 | drorbemet | Do you have any clue where else to search for an 7zip input stream? |
| 13:30 | mdrogalis | tbaldridge: Dang it, I always forget to do that |
| 13:31 | dobry-den | Why use put!? |
| 13:31 | dobry-den | I guess that's L40 |
| 13:31 | mdrogalis | Apparently it's much faster. |
| 13:31 | mdrogalis | I would verify that if I could ever remember to do it. |
| 13:32 | tbaldridge | put! (without the optional callback) is exactly the same as (go (>! c value)). put! does a async put. Since you're spinning up a go and then putting the go version will be slower |
| 13:33 | tbaldridge | internally go blocks will re-wire the code into a put! anyways, but there is extra overhead from creating the go. |
| 13:33 | mdrogalis | Oh, that makes a ton of sense now. |
| 13:34 | mdrogalis | Especially after watching the core.async video. |
| 13:34 | dobry-den | yeah, i need to go and watch more vids. it's too easy to get excited about something and the video to diddle about in emacs |
| 13:35 | dobry-den | especially since everyone in videos is brilliant and gives me false confidence |
| 13:35 | mdrogalis | I have been in videos. Can verify I am not brilliant. \o/ |
| 13:36 | dnolen | tbaldridge: is there anything holding up getting Read/WritePort in there? I'd even go for just providing the lower level api if just getting Rich to approach api level names is what is holding things up. |
| 13:36 | dobry-den | mdrogalis: How do you maintain an overview of what's actually going through channels when you're working on your app? Particularly when everything is happening in a go block? |
| 13:36 | dnolen | s/approach/approve |
| 13:36 | tbaldridge | dnolen: did we never port that to CLJS? It's in CLJ. |
| 13:36 | dnolen | tbaldridge: heh lemme check |
| 13:36 | dobry-den | My only solution has been to make an (atom []) for each go-block and conj the message to the atom so i can look at it later |
| 13:36 | mdrogalis | dobry-den: If you're using CSP, you usually don't want an overview. |
| 13:37 | mdrogalis | I think that's true? |
| 13:37 | mdrogalis | dobry-den: What exactly are you trying to do? |
| 13:37 | dnolen | tbaldridge: oh wow, ok I missed it, it's there, sweet! |
| 13:38 | dnolen | tbaldridge: well the lower level stuff, not the higher level op to take a channel and get a read only port from it |
| 13:39 | dobry-den | mdrogalis: I'm talking to other nodes in a network and I'm not sure how to best open up my channel system to debug things like "why couldn't i parse that message" or "why did my state-machine not transition? oh, the peer sent back :foo before :bar this time??" |
| 13:40 | mdrogalis | It sounds like you just need better introspection and logging. |
| 13:40 | dobry-den | yeah |
| 13:40 | mdrogalis | What's to stop you from dropping those inside go blocks? |
| 13:43 | dobry-den | good point, i'll try to make a more deliberate mechanism. i suppose go-blocks could conj a logging message onto an agent that writes it to a file? |
| 13:44 | dobry-den | my ad-hoc mix of printlns obviously fight in repl output |
| 13:44 | dobry-den | -- once there are multiple go-blocks |
| 13:46 | mdrogalis | dobry-den: Have you tried Dire? It can keep all of that cruft out of your app logic. |
| 13:46 | dobry-den | I have a final question: Once you have many go-blocks running, what's a good method for shutting them down and ensuringn they dont run away from you? So far I have a (def running? (atom true)) that all go-loops will check |
| 13:46 | dobry-den | ill check dire out |
| 13:47 | seangrove | dobry-den: I pass in a stop-ch to all of them, that I use to shut them down externally. |
| 13:49 | mdrogalis | Pretty neat, seangrov. |
| 13:49 | dobry-den | cool, i'll do that. |
| 13:50 | seangrove | mdrogalis: Yeah, allows me to restart my working space instantly |
| 13:51 | mdrogalis | seangrove: What kinda sentinal value are you using for that? |
| 13:52 | seangrove | mdrogalis: Anything - the channel is explicitly used to stop the go-loop |
| 13:52 | seangrove | https://github.com/sgrove/jida/blob/master/src/cljs/main.cljs#L111 |
| 13:52 | mdrogalis | seangrove: Ohh, I see what you mean now. |
| 13:53 | seangrove | You can see I use these two lines to rebuilt the ui instantly: https://github.com/sgrove/jida/blob/master/src/cljs/main.cljs#L177 & 178 |
| 13:53 | mdrogalis | That is one hell of a go block. |
| 13:53 | seangrove | Yeah, working on the semantics/patterns - going to show this project to the channel in just a second |
| 13:53 | mdrogalis | Very cool. |
| 13:53 | seangrove | But it's the main ui block, and it's not too bad for what it does |
| 13:54 | dobry-den | I often use (alts!! [channel (timeout 1000)]) to protect myself against my crappy code that will probably block until i restart my repl while i'm still smoothing things out. |
| 13:55 | dobry-den | How do yall deal with that kind of thing? |
| 13:57 | dobry-den | I guess my entire problem really comes down to the fact that a go-block up the chain will have a problem but everything silently fails since i cant see an exception, and it's been hard for me to pin it down |
| 13:58 | dobry-den | i suppose once i get some better logging system working, it'll be much easier so ill work on that |
| 14:01 | seangrove | bitemyapp: You around? Could use some help on a datomic query |
| 14:04 | delihiros | hi, I'm wondering why memfn is just a macro and not a reader macro... |
| 14:06 | nightfly | Because it doesn't require new syntax? |
| 14:07 | delihiros | nightfly: yes, it's true, but I feel (memfn getBytes) are more verbose than something like $getBytes |
| 14:08 | delihiros | or is it wrong to use memfn so often? |
| 14:08 | TimMc | You can also do #(.getBytes %), but yeah, it's a little annoying. |
| 14:09 | delihiros | yes, #(.getBytes %) are better I feel, but than I feel memfn unnecessary |
| 14:13 | silasdavis | Suppose I have a seq of streams |
| 14:13 | silasdavis | can I expose them as a single concatenated stream? |
| 14:15 | jared314 | silasdavis: stream as in file io stream? |
| 14:15 | mrhanky | can i pass a string (which will not be executed as clojure code) to load-file (loading a clj)? |
| 14:15 | silasdavis | jared314: as in some type of java.io.InputStream |
| 14:16 | jared314 | mrhanky: do you want the code to be parsed and executed? |
| 14:16 | myguidingstar | I'm interested in https://github.com/liebke/avout but the project seems inactive. Is it widely used? |
| 14:17 | tbaldridge | myguidingstar: no it's not, and there's actually a few bugs in the lib (from what I've heard). |
| 14:18 | bitemyapp | seangrove: sure, what's up? |
| 14:19 | mrhanky | jared314, i have a very small and basic programlanguage written in clojure. the clj file gives a a commandline on execution. now i want to call that clj from another clj and pass a string which will be executed by the loaded clj |
| 14:19 | jared314 | silasdavis: http://stackoverflow.com/questions/14295099/how-to-chain-multiple-different-inputstreams-into-one-inputstream |
| 14:20 | mrhanky | but the string i want to pass to the clj is no valid clojure code |
| 14:22 | jared314 | mrhanky: not valid clojure? as in not your custom language that needs to be parsed? |
| 14:23 | mrhanky | jared314, the string would be: \ file.txt run say-hi |
| 14:23 | logic_prog | googling for "http session" brings up all these random tutorials about sessions. I want a throughouh understanding of http sessions -- and how it works in ring/compojure. I suspect this will be two separate tutorials -- where are these two tutorials? |
| 14:24 | jared314 | mrhanky: have you posted a code sample anywhere? |
| 14:26 | bitemyapp | http://heeris.id.au/sites/default/files/ProgrammerInterrupted.png |
| 14:27 | `cbp | :'( |
| 14:27 | bitemyapp | `cbp: I take it you got my email? |
| 14:27 | bitemyapp | `cbp: I started a branch, "connections" |
| 14:28 | `cbp | bitemyapp: I haven't checked my email but i did check github :P |
| 14:28 | mrhanky | jared314, just a sec |
| 14:30 | `cbp | bitemyapp: An explanation of your idea would be nice whenever you have time. Also for the experimental code, a paste or another branch would be fine with me |
| 14:30 | bitemyapp | `cbp: 'tis the branch then |
| 14:31 | bitemyapp | `cbp: so basically I'm componentizing it. |
| 14:31 | bitemyapp | The impure I/O part, the promise, and the pure part. |
| 14:31 | mrhanky | jared314, here is the implementation of the language and on the the command i run from terminal to execute: https://www.refheap.com/20226 |
| 14:31 | bitemyapp | the tricky part is you can't really do the serialization of the protobufs in the pure part, because it depends on the current value of the token |
| 14:32 | `cbp | yeah the outer protobuffer at least |
| 14:32 | `cbp | the Query one |
| 14:37 | jared314 | mrhanky: oddly enough, I was playing with something similar about a week ago https://gist.github.com/Jared314/7095415 |
| 14:37 | jared314 | mrhanky: except i was translating directly to clojure |
| 14:38 | bitemyapp | `cbp: yeah, so it isn't really worth trying to "optimize" that for now |
| 14:38 | bitemyapp | `cbp: so basically an agent or core.async channel serializes writes against the socket |
| 14:39 | mrhanky | jared314, i go eat now, back in a few minutes |
| 14:39 | bitemyapp | `cbp: a dedicated thread is constantly reading from the socket and sends results to the agent who delivers on the promises associated by token |
| 14:39 | bitemyapp | `cbp: so the API is async by default. you just deref the promise returned. |
| 14:43 | `cbp | bitemyapp: good stuff, can't wait :) |
| 14:44 | bitemyapp | `cbp: notably, there's no client-side connection pooling. I don't think it's merited, a good idea, or necessary. |
| 14:44 | bitemyapp | I might end up being wrong, but I'd like to try to proceed without. |
| 14:44 | `cbp | that's ok you mentioned that rdb already provides that |
| 14:45 | bitemyapp | yeah they have a separate daemon you run on the machines querying the db. |
| 14:45 | bitemyapp | pretty handy. |
| 14:45 | bitemyapp | `cbp: if one wants more querying "parallelism" then you just create more connection objects. |
| 14:46 | bitemyapp | ordinarily wouldn't matter for obvious reasons. |
| 14:48 | `cbp | I will test the rdb python api doc's examples tonight to make sure everything runs, make those test cases + docs |
| 14:49 | `cbp | + possibly make an example application sometime this week |
| 14:49 | bitemyapp | `cbp: just look at the test-cases I wrote in the connections branch |
| 14:49 | bitemyapp | `cbp: don't duplicate any work if possible |
| 14:49 | bitemyapp | and add to those |
| 14:49 | `cbp | I am currently reading them |
| 14:55 | jared314 | mrhanky: i guess you are updating https://code.google.com/p/consize ? |
| 14:57 | `cbp | bitemyapp: the wat stuff is like an (update-in authors [2 :posts] conj {:title .. :content ..}) |
| 14:57 | `cbp | bitemyapp: probably will need some more idiomatic helper fns/macros |
| 14:57 | jared314 | mrhanky: why not move the parsing you are doing into a VM function and slurp the file and call that a second time? |
| 14:58 | bitemyapp | `cbp: using update-in against vectors is a really bad idea in general. |
| 14:58 | bitemyapp | there's no enforced order, it's implicit state. |
| 14:59 | `cbp | bitemyapp: yea i know. I was just pointing out that the filter gives you the 3rd item of the table |
| 14:59 | bitemyapp | that sort of use-case really screams for lenses. |
| 14:59 | bitemyapp | `cbp: makes sense. |
| 15:00 | `cbp | the (lambda [row] {:posts (append (get-field row :posts) ... stuff is really nasty |
| 15:00 | `cbp | that could be changed for an update-in |
| 15:00 | bitemyapp | `cbp: I could think of worse, honestly. The java library doesn't even have lambdas at all yet. |
| 15:00 | seangrove | Alright, this is probably ready to get some feedback on - jidaexplorer is a rewrite of a project wei and I did roughly a year ago: http://www.jidaexplorer.com/?query-uuid=81987df7-3ccc-478b-bbd5-bd1b252b1e29 |
| 15:00 | `cbp | bitemyapp: really? I wonder how it works |
| 15:01 | seangrove | It's essentially a front-end to codeq with some nice additions, like query-sharing/saving, and results returnable by json with CORS. The json endpoint for the query above, for example, would be http://www.jidaexplorer.com/queries/81987df7-3ccc-478b-bbd5-bd1b252b1e29/results.json |
| 15:02 | seangrove | So you could easily build "leaderboards" for projects with stats you cared about: commits over time, latest commits, new functions created, functions update by authors, etc. |
| 15:03 | coventry | seangrove: You should show the results of the query immediately when you first go to that page, rather than requiring the user to hit "run." As it is, it looks like the datalog query is the point of the page, until you read the whole thing. |
| 15:03 | `cbp | bitemyapp: I take it that you had no problems understanding the rdb connection ritual? |
| 15:03 | seangrove | coventry: Good point, I'll push that out in a bit when I move to a cafe |
| 15:03 | `cbp | bitemyapp: lmk if you have in case you have to change the stuff dealing with the input/output data streams |
| 15:04 | bitemyapp | `cbp: well, I will. |
| 15:04 | bitemyapp | `cbp: the out stream will belong exclusively to the agent, the in stream will belong exclusively to the delivery thread. |
| 15:04 | bitemyapp | the singleton connection object is getting squashed too |
| 15:04 | bitemyapp | Fuck *that* noise. |
| 15:05 | bitemyapp | Learned our lesson in Korma, never again. |
| 15:05 | coventry | seangrove: Pretty cool, though. |
| 15:05 | bitemyapp | No singleton connections, no singleton connection pooling. |
| 15:05 | bitemyapp | Burn my fucking house to the ground before I let that happen again. |
| 15:05 | `cbp | bitemyapp: good to have you here := |
| 15:05 | `cbp | :) |
| 15:06 | bitemyapp | `cbp: := looks like a person pretending to be a walrus by having chopsticks in their mouf. |
| 15:07 | `cbp | :p |
| 15:07 | bitemyapp | https://github.com/AvisoNovate/pretty |
| 15:07 | seangrove | coventry: Thanks, appreciate it. There's something useful here, just haven't *quite* figured it out yet. Making it a service should help open the exploration. |
| 15:08 | bitemyapp | Pretty cool asset pipeline library: https://github.com/AvisoNovate/twixt |
| 15:08 | bitemyapp | weavejester would approve...I think |
| 15:12 | mrhanky | jared314, not updating, i want to build a web-interface for it |
| 15:18 | bitemyapp | mdrogalis: just saw Rush Hour, this is really interesting! |
| 15:19 | bitemyapp | mdrogalis: Exception in thread "main" java.lang.RuntimeException: No such var: json/pprint, compiling:(cljs/source_map.clj:142:7) |
| 15:22 | mdrogalis | bitemyapp: Thanks!! |
| 15:23 | mdrogalis | bitemyapp: Where'd that come up? |
| 15:24 | bitemyapp | mdrogalis: `lein cljsbuild once` in asphalt |
| 15:24 | bitemyapp | mdrogalis: maybe relying implicitly on something in your lein profile? |
| 15:24 | mdrogalis | bitemyapp: Weird. Just built it on my work machine alright. |
| 15:25 | mdrogalis | I don't have much experience debugging ClojureScript errors though. Not sure where it could be coming from. |
| 15:26 | myguidingstar | what's wrong with this?(.isUpperCase \a) |
| 15:26 | myguidingstar | IllegalArgumentException No matching field found: isUpperCase for class java.lang.Character |
| 15:26 | znDuff | myguidingstar: where do you find the javadocs saying that isUpperCase() is a thing you can call? |
| 15:27 | znDuff | ahh. |
| 15:27 | znDuff | it's static. |
| 15:27 | mdrogalis | myguidingstar: That method is static. |
| 15:27 | znDuff | myguidingstar: (Character/isUpperCase \c) |
| 15:27 | mdrogalis | bitemyapp: If you send me your Leiningen set up I can try to figure it out for you. |
| 15:28 | myguidingstar | thanks all, but I don't understand :" |
| 15:28 | bitemyapp | mdrogalis: https://github.com/bitemyapp/dotfiles/blob/master/.lein/profiles.clj |
| 15:28 | myguidingstar | why adding `Character/`? |
| 15:28 | znDuff | myguidingstar: the (.foo bar) syntax works for calling class methods. |
| 15:29 | znDuff | myguidingstar: ...it's not the syntax for static methods. |
| 15:29 | coventry | seangrove: I bet a service which notified you when your library is used in another open-source project would be popular :-) |
| 15:29 | znDuff | s/class methods/instance methods/ |
| 15:29 | znDuff | bleh. |
| 15:29 | coventry | myguidingstar: http://clojure.org/java_interop#Java Interop-Classname/staticField |
| 15:30 | myguidingstar | thank you all |
| 15:32 | mdrogalis | bitemyapp: Yep, something in your profile is doing it |
| 15:34 | mdrogalis | bitemyapp: Jark is the culprit. |
| 15:34 | mdrogalis | Comment it out and it works. Don't have more time to look into why :) |
| 15:36 | bitemyapp | :( |
| 15:38 | mdrogalis | bitemyapp: At least you have an answer. :P |
| 15:39 | coventry | Is jark in the same space as grench? Is it preferable? |
| 15:39 | bitemyapp | mdrogalis: is this spelling intentional? coordindates |
| 15:39 | mdrogalis | bitemyapp: That would be a typo for sure. |
| 15:40 | bitemyapp | mdrogalis: it's a consistent typo but it confused me. |
| 15:40 | mdrogalis | bitemyapp: That's what I get for using Emacs autocomplete. |
| 15:40 | bitemyapp | mdrogalis: I don't see where jark is coming into this. |
| 15:41 | bitemyapp | mdrogalis: dude, I've seen egregious typos proliferated because of Eclipse/IntelliJ/Visual Studio autocomplete. |
| 15:41 | bitemyapp | the error appears to be from attempting to generating source maps. |
| 15:41 | mdrogalis | Heh, yeah it can happen. All I know is that I commented out Jark and it worked. |
| 15:41 | bbloom | i've proliferated egregious typeos without the help of autocomplete, thank you very much |
| 15:42 | mdrogalis | bbloom: I don't need your help to mispell basic words. |
| 15:42 | bitemyapp | mdrogalis: that's what I'm saying , I don't know wtf you're talking about |
| 15:42 | bitemyapp | mdrogalis: where is jark? what are you commenting out? |
| 15:42 | bitemyapp | I don't see anything in asphalt's project.clj or code that says "jark" or "Jark" |
| 15:42 | mdrogalis | It's in your Lein profile, haha. |
| 15:42 | bitemyapp | or anything that looks plausible. |
| 15:42 | bitemyapp | oh |
| 15:42 | bitemyapp | well wtf. |
| 15:43 | mdrogalis | Hah. |
| 15:43 | bitemyapp | that must be from before I started using grench. |
| 15:43 | bitemyapp | grrr. |
| 15:44 | mdrogalis | Looks like it. |
| 15:48 | mdrogalis | bitemyapp: Let me know if you have any other problems - typos aside. |
| 15:53 | bitemyapp | mdrogalis: well, I did, but I don't really have time to follow-up on it right now. I take it I need to init some default state? |
| 15:53 | bitemyapp | in the repl. |
| 15:53 | bitemyapp | from the edn fixtures. |
| 15:53 | mdrogalis | bitemyapp: Are you trying to just run Asphalt or the entire thing? |
| 15:54 | bitemyapp | mdrogalis: the entire thing more or less, I just wanted to see it in action. |
| 15:54 | mdrogalis | bitemyapp: Got'cha. There's a live demo online if you didn't see, but the instructions on the Github page should work alright too for local usage. |
| 15:55 | bitemyapp | I'll take a look at that, thanks. |
| 15:55 | bitemyapp | mdrogalis: what inspired this? this is really cool. The last Clojure dojo led to my fiddling with a simple "predicates as data" thing. |
| 15:56 | mdrogalis | bitemyapp: Well, I was passed out in a park after work when I had no internet, and my brain just started playing with ideas. |
| 15:56 | mdrogalis | Removing internet for a while does good things. |
| 15:58 | mmitchell | I realize this isn't a clojure question, but maybe some of you have a suggestion? I'm looking for a json/javascript editor/mode that has a configurable indent size... for emacs. |
| 15:59 | bitemyapp | mmitchell: https://code.google.com/p/js2-mode/ http://www.emacswiki.org/emacs/Js2Mode |
| 15:59 | bitemyapp | "variable (adjustable) indentation" |
| 15:59 | mmitchell | bitemyapp: nice, thanks! |
| 16:17 | ivan | http://www.learndatalogtoday.org/ is fantastic |
| 16:19 | jonasen | ivan: thanks |
| 16:20 | ivan | jonasen: I noticed a subtle bug in the second exercise in chapter 8 where the solution allows an actor to be friends with himself |
| 16:20 | ivan | there is probably no value in fixing it, however ;) |
| 16:22 | jonasen | ivan: yes, it would be an easy check I guess to add something like (not= ?p1 ?p2) |
| 16:23 | ivan | fwiw the solution I came up with involved pasting in the associated-with rules, which I had to rename to get past the symbol checker |
| 16:24 | jonasen | ivan: I should add that symbol to the whitelist as that is a reasonable solution |
| 16:25 | jonasen | since it's used in the text |
| 16:26 | dnolen | if somebody would like to help improve source maps even further - this is one that needs work - https://twitter.com/jhirn/status/394903906431422464 |
| 16:26 | dnolen | jonasen: did you see my earlier question about Code Mirror and ClojureScript syntax highlighting? |
| 16:27 | jonasen | dnolen: no |
| 16:27 | dnolen | jonasen: so are you telling Code Mirror that .cljs is just .clj? |
| 16:27 | dnolen | jonasen: I'm assuming CM comes w/ .clj support right? |
| 16:27 | jonasen | dnolen: yes |
| 16:28 | jonasen | I use clj highlighting |
| 16:28 | dnolen | jonasen: can you point me to the location where you configure this? I'm trying to get .cljs syntax highlighting enabled in Google Chrome |
| 16:29 | jonasen | https://github.com/jonase/cljsfiddle/blob/master/src/cljs/cljsfiddle/core.cljs#L118 |
| 16:29 | dnolen | jonasen: by which I mean, I'd like to get Google Chrome patched so that it just work (I already opened a ticket) and it's been assigned but I'd like to link to example of it working in CM |
| 16:29 | jonasen | and it depends on this file: https://github.com/marijnh/CodeMirror/blob/master/mode/clojure/clojure.js |
| 16:32 | dnolen | jonasen: great thanks, for reference, http://code.google.com/p/chromium/issues/detail?id=312271 |
| 16:33 | staafl | help request :-) |
| 16:33 | seangrove | tbaldridge: I finished up work on a tool for codeq-as-a-service, and wondered if you guys at cognitect had some example queries to share? |
| 16:34 | staafl | this problem asks to implement a function that guesses the type of a collection |
| 16:34 | staafl | http://www.4clojure.com/problem/65#black-box-testing |
| 16:34 | staafl | without using the built-in predicates |
| 16:34 | staafl | it's a cool exercise, but I'll probably have to dig through the documentation for hours to figure it out... any suggestions? |
| 16:35 | coventry | staafl: &(doc empty) |
| 16:36 | staafl | coventry, that's really smart |
| 16:37 | staafl | yep, that worked |
| 16:37 | staafl | any other suggestions though? I'm curious for the other ways there to skin this one |
| 16:37 | staafl | s/there// |
| 16:47 | muhoo | ,(doc empty?) |
| 16:47 | clojurebot | "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))" |
| 16:49 | rasmusto | ,((complement empty?) []) |
| 16:49 | clojurebot | false |
| 16:51 | arrdem | is there a way to force clojure to copy an object? |
| 16:51 | Jarda | a |
| 16:51 | rasmusto | ,(if-let [a (seq [])] a 'not-a) |
| 16:51 | clojurebot | not-a |
| 16:51 | dnolen | arrdem: what do you mean? |
| 16:52 | arrdem | dnolen: obviously with the immutability model there isn't a need for it normally, but because I'm testing a memoized function I'd like to force a memcopy duplicate of some data. |
| 16:52 | bitemyapp | my solution was better than amalloy's, but austin taylor molly-whomped me. |
| 16:53 | bitemyapp | staafl: did you solve it yet? |
| 16:53 | bitemyapp | I want to share my answer :) |
| 16:53 | staafl | bitemyapp, yep :-) |
| 16:53 | tbaldridge | arrdem: seems like you need a better memoize function, one that supports reset |
| 16:53 | seangrove | tbaldridge: For example, here's a list of all clojurescript committers and their commit count: http://www.jidaexplorer.com/?query-uuid=81987df7-3ccc-478b-bbd5-bd1b252b1e29 |
| 16:53 | bitemyapp | staafl: #(or (and (get (conj (empty %) [:a nil]) 0) :vector) ({{} :map #{} :set '() :list} (empty %))) |
| 16:53 | seangrove | coventry: Fixed it so results show up automatically |
| 16:54 | seangrove | tbaldridge: But I remember seeing a query rich did where he queried for functions with the highest churn |
| 16:54 | seangrove | Would like to get a few example queries in the library like that |
| 16:54 | arrdem | tbaldridge: that would definitely work too... but to the best of my knowlege the clojure.core one doesn't and neither does my tweak thereof. |
| 16:56 | bitemyapp | seangrove: http://blog.datomic.com/2012/10/codeq.html |
| 16:56 | bitemyapp | seangrove: you just sum up the number of commits for each def. |
| 16:56 | staafl | bitemyapp, why does get on a list always return nil? |
| 16:56 | bitemyapp | staafl: lists aren't associative yo. |
| 16:57 | staafl | bitemyapp, then why is it implemented at all? |
| 16:57 | bitemyapp | the only other difference between them and vectors is the order of conj, which is what amalloy used |
| 16:57 | bitemyapp | staafl: lol? sometimes you need to conj onto the head instead of the tail. |
| 16:57 | bitemyapp | staafl: they're used to represent code too. |
| 16:57 | bitemyapp | You don't commonly use them in typical code though |
| 16:58 | staafl | bitemyapp, I was referring to get |
| 16:58 | staafl | why is get implemented on lists |
| 16:58 | bitemyapp | staafl: get isn't implemented on anything. |
| 16:58 | bitemyapp | staafl: get is a function. |
| 16:58 | tbaldridge | seangrove: I'm not aware of any such queries, but I haven't worked with codeq for some time. |
| 16:58 | staafl | bitemyapp, you know what I mean :-) |
| 17:00 | bitemyapp | staafl: Clojure believes in GIGO, not proliferating exception handling. |
| 17:00 | mdrogalis | GIGO? |
| 17:00 | mdrogalis | Oh, nevermind |
| 17:00 | mdrogalis | Got it as soon as I hit enter. |
| 17:00 | bitemyapp | (get {} :a) returns nil. (get '() 0) returns nil. (get [:a] 1e16) returns nil. |
| 17:00 | staafl | ,(pop []) |
| 17:01 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector> |
| 17:01 | bitemyapp | you either get a result, or you don't. In the default case, does it really matter which exception got thrown? |
| 17:01 | tbaldridge | ,(get 4 :a) |
| 17:01 | clojurebot | nil |
| 17:01 | bitemyapp | staafl: pop isn't a normal coll operation. |
| 17:01 | bitemyapp | the normal coll operations are "Option" typed. |
| 17:01 | bitemyapp | I'm quite fond of this, personally. |
| 17:02 | staafl | bitemyapp, so in case of a code error, you have null references all over the place |
| 17:02 | staafl | <span style="tone: irony">sounds neat</span> |
| 17:02 | bitemyapp | staafl: yes, the world is doomed. There's no way you could possibly write safe code. |
| 17:02 | Bronsa | ,(get (sorted-map 1 1) :a) |
| 17:02 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Keyword> |
| 17:02 | Bronsa | :( |
| 17:02 | bitemyapp | staafl: back to #haskell with you. |
| 17:03 | staafl | bitemyapp, lol |
| 17:03 | staafl | I was on the other side of this debate only a few days ago |
| 17:03 | bitemyapp | the language has an implicit Maybe monad in most of the coll operations. I prefer it. |
| 17:03 | tbaldridge | (inc bitemyapp) |
| 17:03 | lazybot | ⇒ 7 |
| 17:04 | bitemyapp | Prefer it to Python barfing unnecessary exceptions and to breaking out pointless/meaningless nil cases when I am just going to chain and short-circuit anyway. |
| 17:04 | tbaldridge | it's never really a problem since everything knows how to handle nils |
| 17:04 | bitemyapp | ^^ precisely. |
| 17:04 | tbaldridge | , (-> {} :foo :bar :baz) |
| 17:04 | clojurebot | nil |
| 17:04 | staafl | tbaldridge, but how do you trace it back |
| 17:04 | bitemyapp | head [] in Haskell throws an exception. |
| 17:04 | staafl | to the point of error |
| 17:05 | bitemyapp | staafl: if you pass {} to #(-> % :a :b :c) and you get a nil back, does it really matter that :a was the first key to return nil? |
| 17:05 | bitemyapp | if you care that much: |
| 17:05 | stuartsierra | One nil pun I often debate with myself: http://dev.clojure.org/jira/browse/CLJ-1107 |
| 17:05 | tbaldridge | staafl: for me? I use the repl or tests. If you have small functions you probably have < 10 lines of code to proof-read |
| 17:05 | Jarda | I have found it very refreshing that the 'worst case' is a returned nil |
| 17:05 | staafl | 'tis very new to me |
| 17:06 | Jarda | because I don't have to surround my code with try/catch |
| 17:06 | staafl | I've always been told that "fail fast, fail loud" is the responsible way |
| 17:06 | Jarda | or a ton of if (foo != null) checks |
| 17:06 | tbaldridge | staafl: it really starts to be a nice to have when you start writing code like this: |
| 17:06 | tbaldridge | (or (:bar {}) (:baz {}) (:foo {:foo 42})) |
| 17:06 | tbaldridge | ,(or (:bar {}) (:baz {}) (:foo {:foo 42})) |
| 17:06 | clojurebot | 42 |
| 17:07 | bitemyapp | staafl: you short-circuit with and/or if you want to catch a nil midstream. |
| 17:07 | tbaldridge | staafl: here the get failures return nil, so their result is thrown away. |
| 17:07 | bitemyapp | Most of the time, you don't care and there's simply, "an error" if a nil comes out the other side. |
| 17:08 | staafl | i'll meditate on this |
| 17:09 | tbaldridge | staafl: I forget who said it, but I love the fact that Clojure defines nil as "undefined, or unknown" instead of "an error". In OOP nils are deadly since doing nil.foo() just doesn't make sense, but if you define everything via functions and then call nil "unknown" things start to make sense. |
| 17:10 | staafl | tbaldridge, summing unknown values doesn't make sense either |
| 17:10 | tbaldridge | staafl: agreed, and that's where Clojure differs from PHP or JS |
| 17:10 | staafl | after all, the data the code works on has to map to the real world somehow |
| 17:10 | tbaldridge | ,(+ nil 42) |
| 17:10 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 17:11 | staafl | ,(get nil nil) |
| 17:11 | clojurebot | nil |
| 17:11 | seangrove | ,(reduce + [1 1 2 2 2 nil nil 3 3]) |
| 17:11 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 17:11 | seangrove | ,(reduce + (filter identity [1 1 2 2 2 nil nil 3 3])) |
| 17:11 | clojurebot | 14 |
| 17:11 | staafl | what is the semantic difference between summing unknowns and retrievning unknown key from unknown collection? |
| 17:12 | staafl | aren't they both bogus code? |
| 17:12 | staafl | division-by-zero-bogus? |
| 17:14 | bitemyapp | staafl: not really, no. |
| 17:14 | tbaldridge | staafl: that could be the debate. Q: "What is the first item in an empty box" You could answer "nothing is the first thing in an empty box" |
| 17:14 | tbaldridge | staafl: or you could say "how dare you ask that question! now die!!!" |
| 17:14 | bitemyapp | staafl: expecting uniformity of type in a coll isn't unusual, throwing exceptions over the mere non-existence of a key/value pair in a map is silly. |
| 17:19 | staafl | well, if you ask me, it's not a slam dunk either way |
| 17:19 | bitemyapp | ,(reduce (fn [[a v] k] [(get a k) (conj v k (get a k))]) [{} []] [:a :b :c]) |
| 17:19 | clojurebot | [nil [:a nil :b nil :c ...]] |
| 17:19 | bitemyapp | ,(reduce (fn [[a v] k] [(get a k) (conj v k (get a k))]) [{:a {:b {:c 321}}} []] [:a :b :c]) |
| 17:19 | clojurebot | [321 [:a {:b {:c 321}} :b {:c 321} :c ...]] |
| 17:19 | staafl | you either have to litter your code with null checks |
| 17:19 | bitemyapp | staafl: ^^ get-in with tracing. |
| 17:19 | bitemyapp | staafl: you don't litter your code with null checks. |
| 17:19 | bitemyapp | that's the point. |
| 17:19 | staafl | or you have to remember to explicitly elevate nil values to exceptions |
| 17:20 | bitemyapp | staafl: false dichotomy |
| 17:20 | staafl | OR you just laissez-faire it and end up swimming in nils of unknown origin |
| 17:20 | bitemyapp | also false. |
| 17:20 | bitemyapp | you perform all the data operations you want in one sweep, monadically or ephemerally, and then you decide how to react to the final result without null-checks interspersed. |
| 17:20 | staafl | bitemyapp, that was my second option |
| 17:21 | bitemyapp | no it wasn't |
| 17:21 | staafl | you have to remember to check for nils at some junctions |
| 17:21 | bitemyapp | staafl: just go write code. |
| 17:21 | joegallo | i dunno, what if there's a problem with the code? |
| 17:21 | joegallo | better do nothing |
| 17:21 | rasmusto | myapp/nil, namespaced nils? |
| 17:21 | joegallo | ;) |
| 17:21 | mdrogalis | Awkward comment of the day: "Anyone else going as Rich Hickey for Halloween?" |
| 17:22 | rasmusto | could you tag a nil with metadata? |
| 17:22 | tbaldridge | staafl: it's kindof one of those things that just isn't a problem in day-to-day use. |
| 17:22 | bitemyapp | joegallo: funny that you would pop-up, I used robert-bruce to reproduce a race condition last night. |
| 17:22 | joegallo | so you're the one! |
| 17:22 | joegallo | :) |
| 17:23 | bitemyapp | I'm what. |
| 17:23 | joegallo | the user! |
| 17:23 | bitemyapp | more than one person uses robert-bruce. |
| 17:23 | joegallo | phew! |
| 17:23 | staafl | tbaldridge, we'll see :-) |
| 17:23 | joegallo | anyway, glad you liked it! |
| 17:23 | bitemyapp | joegallo: yeah super handy. |
| 17:23 | staafl | bitemyapp, since you asked for code |
| 17:24 | bitemyapp | staafl: don't mistake that for my being especially interested in what you're doing. |
| 17:24 | staafl | why does this trial division primegen go into infinite loop: https://www.refheap.com/20237 |
| 17:24 | bitemyapp | staafl: because you're reducing an infinite sequence |
| 17:25 | bitemyapp | staafl: also why are you lazy-seq'ing range? range is lazy. |
| 17:25 | staafl | bitemyapp, just in case you like giving pratical advice in addition to philosophical :-) |
| 17:25 | staafl | bitemyapp, cargo-culting :-/ |
| 17:25 | bitemyapp | staafl: range is lazy, reduce is not. That should tell you everything you need to know about why that's an infinite loop |
| 17:25 | staafl | bitemyapp, well, I assumed "reduced" short-circuits the reduction |
| 17:26 | bitemyapp | staafl: reduced is a function. Why would you (:reduced ...) a value? |
| 17:26 | bitemyapp | keywords-as-fns are assocative "gets" against their argument. |
| 17:26 | bitemyapp | staafl: http://stackoverflow.com/questions/15625341/reduce-a-lazy-sequence-like-a-loop-with-a-condition-in-clojure |
| 17:27 | bitemyapp | staafl: annnnnnd you might also note: http://dev.clojure.org/jira/browse/CLJ-1185 |
| 17:27 | staafl | bitemyapp, because 4clojure.com didn't recognize it... I guess it's using an older version of clojure |
| 17:27 | bitemyapp | I'm helping you solve 4clojure puzzles? |
| 17:28 | staafl | bitemyapp, no, you're helping me learn how clojure works |
| 17:28 | staafl | 4clojure puzzles are incidental |
| 17:29 | staafl | bitemyapp, thank you for your opinionated help :-) |
| 17:29 | bitemyapp | staafl: +1 this: https://github.com/4clojure/4clojure/issues/247 |
| 17:29 | Raynes | Ugh, please don't. |
| 17:29 | Raynes | :p |
| 17:30 | Raynes | We've seen the issue. We don't need inboxes spammed with +1. |
| 17:30 | bitemyapp | Raynes: I will torment youuuuuu |
| 17:30 | Raynes | I'll see about spending some time this weekend on it. |
| 17:30 | bitemyapp | Raynes: tea > red bull |
| 17:30 | Raynes | Or if bitemyapp wants to send a pull request. |
| 17:31 | bitemyapp | seangrove: Halloway's video is pretty solid and touches on some design notes that are pretty important: http://www.datomic.com/videos.html#query |
| 17:31 | Raynes | bitemyapp: Yeah, redbull may kill me today. |
| 17:31 | bitemyapp | Raynes: seriously? PR'ing 1.4.0 => 1.5.1? |
| 17:31 | seangrove | bitemyapp: Yeah, watched this one earlier today |
| 17:32 | Raynes | bitemyapp: Well, usually a version increment requires testing to make sure there is no breakage. Dependencies might need to be updated, etc. |
| 17:32 | Raynes | Things break in interesting ways sometimes. |
| 17:32 | staafl | tbaldridge, thank you for your input as well |
| 17:32 | Raynes | Or maybe I'm just damaged from helping upgrade a rails codebase from Ruby 1.8 to 2.0 |
| 17:32 | bitemyapp | staafl: you have your first Clojure chore. |
| 17:32 | bitemyapp | Raynes: I don't think it'll go quite so badly in our neck of the woods. |
| 17:32 | bitemyapp | 1.8 => 2.0 sounds incredibly brutal. |
| 17:32 | bitemyapp | I hope you had tests. |
| 17:32 | Raynes | Oh it has been. |
| 17:33 | Raynes | We did. |
| 17:33 | bitemyapp | 1.8 => 1.9 alone was pretty bad. |
| 17:33 | Raynes | 1.8 -> 1.9 is worse than 1.8 -> 1.9 |
| 17:33 | Raynes | Er 2.0 |
| 17:33 | Raynes | 1.9 is worse than 2.0 |
| 17:33 | bitemyapp | Raynes: OTOH, the Python solution to painful language upgrades is to never upgrade. |
| 17:33 | Raynes | More encoding issues, etc. |
| 17:33 | bitemyapp | wheeee Python 2 forever #HeadInTheSand |
| 17:34 | znDuff | bitemyapp: eh. Python at least saved their breaking changes for a major release. |
| 17:35 | AimHere | Perl is saving their breaking changes for the apocalypse |
| 17:35 | justin_smith | my emacs nrepl buffer is trying to evaluate defrecords twice, is this a known bug? |
| 17:35 | bitemyapp | Perl 5 will probably outlast human civilization. |
| 17:36 | arrdem | bitemyapp: grrrr 2.7.* |
| 17:36 | bitemyapp | arrdem: everything at my company is stuck on 2.7 |
| 17:36 | arrdem | ztellman: not sure why you'd want to listen to my ravings, but welcome to the broadcast list |
| 17:37 | arrdem | bitemyapp: I mean at least 2to3 is a thing... |
| 17:37 | arrdem | and it works really nicely for 2.7. I wonder why. |
| 17:37 | ztellman | arrdem: happy to be here |
| 17:37 | bitemyapp | arrdem: the real problem is dependencies. |
| 17:37 | rasmusto | it's better than 2.5.4 |
| 17:38 | arrdem | bitemyapp: which is really cool because it's circular. |
| 17:43 | dcunit3d | whats the best way to use a version of a library that's not available on clojar yet |
| 17:44 | coventry | dcunit3d: I would just make it a lein checkout dependency. |
| 17:47 | coventry | dcunit3d: "lein install" if you really want a jar. |
| 18:02 | bitemyapp | Today's theme: whiny people on Twitter. |
| 18:03 | muhoo | really? just today's? |
| 18:05 | bitemyapp | muhoo: there has been a confluence of whiny lazy people on *my* Twitter today anyway. |
| 18:12 | tsantos | I upgraded to OS X Mavericks and now lein ring server launches but I always get not-found when trying to load pages. No errors in stdout or stderr either... anyone else seen this? |
| 18:12 | tsantos | it's bound to all interfaces on port 3000 |
| 18:13 | bitemyapp | tsantos: no problems here. |
| 18:15 | muhoo | whomever was selling clojre.tools.trace, thank you. it has saved my sanity |
| 18:15 | coventry | No worries. :-) |
| 18:19 | bitemyapp | muhoo: I definitely babble about it. I have dedicated emacs macros for it :P |
| 18:23 | rasmusto | arrdem: I made my code parallel and use that pmemoize function, the performance leads me to believe it worked |
| 18:23 | rasmusto | (compared to when I used just a pure memoize) |
| 18:24 | arrdem | rasmusto: awesome! |
| 18:25 | arrdem | rasmusto: I realized that there's a potential for significant memory wasting in that a ref will be held to every argumemt to the memoize function :/ |
| 18:25 | arrdem | rasmusto: the clojure core fn will do the same, but that isn't much of an excuse. |
| 18:27 | bitemyapp | arrdem: pmemoize? |
| 18:27 | arrdem | bitemyapp: it' |
| 18:27 | rasmusto | bitemyapp: https://github.com/arrdem/useful/commit/77356d78d1908e773c384040af6d8abfc084cb80 |
| 18:28 | arrdem | oh. or that. |
| 18:28 | bitemyapp | rasmusto: thanks. |
| 18:29 | arrdem | rasmusto: it also made it in here ... https://github.com/aysylu/loom/pull/8 |
| 18:29 | rasmusto | the application is memoizing a function that could potentially be called with the same arguments across multiple threads at the same time |
| 18:29 | rasmusto | arrdem: cool |
| 18:30 | coventry | bitemyapp: Wow, your dotfiles repository is 103M?? |
| 18:30 | lazybot | coventry: Uh, no. Why would you even ask? |
| 18:30 | rasmusto | ?? |
| 18:30 | lazybot | rasmusto: Definitely not. |
| 18:30 | bitemyapp | coventry: we don't talk about that. |
| 18:30 | bitemyapp | coventry: it's about 410k LOC of emacs lisp. |
| 18:31 | bitemyapp | coventry: http://i.imgur.com/uhoSoOk.gif |
| 18:31 | coventry | Bwahaha |
| 18:31 | rasmusto | those claws look deceptively cute |
| 18:31 | arrdem | oh gods... oh gods why |
| 18:32 | rasmusto | (((cat))) |
| 18:32 | arrdem | clojurebot: bitemyapp is bitemyapp: CAT PICTURE TIME |
| 18:32 | clojurebot | You don't have to tell me twice. |
| 18:35 | bitemyapp | clojurebot: bitemyapp is CTHULHU FTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP |
| 18:35 | clojurebot | Alles klar |
| 18:35 | bitemyapp | ~bitemyapp |
| 18:35 | clojurebot | bitemyapp is bitemyapp: CAT PICTURE TIME |
| 18:35 | bitemyapp | god dammit. |
| 18:35 | bitemyapp | clojurebot: forget bitemyapp |
| 18:35 | clojurebot | Titim gan éirí ort. |
| 18:42 | bitemyapp | ~bitemyapp |
| 18:42 | clojurebot | bitemyapp is CTHULHU FTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP |
| 18:42 | bitemyapp | that's better |
| 18:50 | coventry | bitemyapp: Anyway, your trace macros look handy. Thanks for sharing. |
| 18:50 | bitemyapp | coventry: np. |
| 18:56 | wink | really sorry, but I have to correct that |
| 18:56 | wink | clojurebot: bitemyapp is CTHULHU FHTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP |
| 18:56 | clojurebot | Ok. |
| 18:57 | brehaut | now it knows both |
| 18:57 | wink | well, that is semantics ;) |
| 19:01 | brehaut | wink: correct fhtagnd are important though |
| 19:02 | jacktasia | is there a clojure code formatter for emacs? |
| 19:04 | bitemyapp | jacktasia: tab? |
| 19:04 | bitemyapp | tab indents region for me. |
| 19:05 | rasmusto | how about evil-mode ggVG= |
| 19:06 | jacktasia | bitemyapp: i mean like auto format the whole file like eclipse can with java code |
| 19:08 | rasmusto | jacktasia: http://stackoverflow.com/questions/992685/auto-formatting-a-source-file-in-emacs ? |
| 19:11 | augustl | I'm doing (map (fn [things] (map (fn [thing] ....) things)) groups-of-things). Is there any built-in way to do that with one call? |
| 19:11 | augustl | no biggie nesting it of course, would just look slightly nicer if it was one call :) |
| 19:12 | rasmusto | augustl: (for [as xs, a as] (myfn a)) ? |
| 19:13 | augustl | rasmusto: ah, of course, thanks :) |
| 19:13 | augustl | I haven't relaly learned "for" yet |
| 19:14 | rasmusto | augustl: I guess you lose the nesting with that method, not sure if that's quite what you want |
| 19:14 | jacktasia | rasmusto: thanks, but that doesn't seem to do much other than handling indenting - i was hoping for something that used like a pretty-printer |
| 19:14 | jacktasia | (let [file-contents (slurp "clojure_test.clj") |
| 19:14 | jacktasia | process-file (with-out-str (clojure.pprint/write (read-string (str "[" file-contents "]")) :dispatch clojure.pprint/code-dispatch ))] |
| 19:14 | jacktasia | (println (subs process-file 1 (- (.length process-file) 1)))) |
| 19:14 | augustl | rasmusto: ah, I'm also in a threading macro.. |
| 19:15 | rasmusto | augustl: you can do #(for [as %, b as] (foo b)) |
| 19:15 | rasmusto | it's a bit weird at that point though :p |
| 19:15 | rasmusto | jacktasia: ah, don't know about pretty-printing |
| 19:16 | bitemyapp | those moments in the REPL when you're frantically ^c^c^c^c^c^c^c^c^c^c^c |
| 19:18 | Morgawr | (repeat 4) oh shi- ^C^C^C^C^C^C |
| 19:18 | augustl | rasmusto: ah, cool |
| 19:18 | arrdem | (inc wink) |
| 19:18 | lazybot | ⇒ 1 |
| 19:18 | Apage43 | there's two classes of that |
| 19:18 | Apage43 | "aw man, I froze it, now I'm going to have restart my jvm.. and maybe my editor depending on how bad I broke things" |
| 19:18 | Apage43 | and |
| 19:18 | bitemyapp | Morgawr: the worst is when I spam my Emacs and I have to restart the buffer. |
| 19:19 | bitemyapp | Hate that. |
| 19:19 | Apage43 | "whoops that was the production db" |
| 19:19 | bitemyapp | Apage43: I use environment variables for a reason :P |
| 19:20 | Apage43 | i haven't actually touched anything that was a service I could mess up for a while, so I'm a bit out of practice wrt thtat |
| 19:20 | Apage43 | *that |
| 19:21 | arrdem | fixed it again... |
| 19:21 | arrdem | ~bitemyapp |
| 19:21 | clojurebot | bitemyapp is CTHULHU FHTAGN KITTY CAT 400,000 LINES OF EEEEEEEEEEEEEEEELISP |
| 19:21 | arrdem | damnt |
| 19:23 | rasmusto | ah crap, `killall emacs` broke something :( |
| 19:27 | dobry-den | ztellman is an alien |
| 19:28 | ztellman | I'm a what now? |
| 19:28 | bbloom | he responds with alien-like reflexes |
| 19:28 | dobry-den | constant stream of cool libs |
| 19:28 | ztellman | augmented by the insistent beeps of my computer |
| 19:28 | ztellman | truly, where do I end and the machine begin |
| 19:29 | rads | when you guys have a constructor function that creates a logical "thing", do you prefix it with "make-" or "create-" or just leave it as the noun it represents? |
| 19:29 | bbloom | ztellman is a robot |
| 19:29 | rads | e.g. "(make-thing)", "(create-thing)", or "(thing)" |
| 19:29 | ztellman | rads: I like create |
| 19:29 | ztellman | it's nice to have a verb |
| 19:30 | bbloom | rads: depends on if the "thing" has value or identity equality |
| 19:30 | bbloom | if it's a value, i just go with "thing", if it's an identity, i go with a nice verb like "create-thing" |
| 19:31 | dobry-den | rads: i use `make` because you generally are binding it to `thing`. (let [thing (make-thing 1)] ...) |
| 19:31 | dobry-den | because once make-thing and thing are taken, i've run out of names and creativity |
| 19:32 | dobry-den | and i use intricate -> ->> as-> calls to go the rest of the function without having to thing of a name |
| 19:32 | dobry-den | thing''' |
| 19:34 | rads | yeah, I was having the same problem with an audio player ns. it was called "app.player", but I also have to create things with "player", but I also want to alias the ns as "player" :) |
| 19:35 | dobry-den | that's why i installed a thesaurus into emacs |
| 19:37 | brehaut | rads: clojrue namespaces are different namespace to values |
| 19:37 | brehaut | frex (require '[clojure.string :as str]) |
| 19:38 | rads | I see. I thought that would be a little confusing to read, but now that I think about it, I don't think there is really any ambiguity |
| 19:38 | rasmusto | rads: so long as you don't :require player :refer [player] |
| 19:59 | dobry-den | ztellman: Is there a way to declare padded strings in Gloss? Like padding 5 bytes with 0x00: "abc" <-> [97 98 99 0 0] |
| 20:00 | ztellman | dobry-den: you can define wrappers for encode and decode for any frame |
| 20:00 | ztellman | so you'd do that as a post-processing step |
| 20:00 | ztellman | check out compile-frame |
| 20:06 | dobry-den | simple, thanks |
| 20:21 | muhoo | let is an implicit do, right? |
| 20:22 | coventry | muhoo: Yes. |
| 20:26 | muhoo | thx |
| 20:41 | mnew | hey does anyone know a workaround for this: https://bugzilla.redhat.com/show_bug.cgi?id=1008699 |
| 20:42 | mnew | leiningen doesn't work on fresh installs on my fedora machine |
| 20:44 | hyPiRion | mnew: preferably you install leiningen through the installation procedure at leiningen.org. It's not hard, really |
| 20:49 | ToBeReplaced | mnew: is that your bug posting? i think a reasonable recommendation would be to make a new rpm off of a recent stable cut |
| 20:50 | mnew | ToBeReplaced, to I just found that bug after encountering exactly the same problem |
| 20:50 | ToBeReplaced | for just getting done, go through the installation procedure, but it would be nice if fedora updated for fc20 |
| 20:50 | mnew | no* |
| 20:52 | ToBeReplaced | mnew: try `lein upgrade` -- not sure if that was around at 1.7 but worth a shot |
| 20:52 | ToBeReplaced | you might need to sudo since system package and all |
| 20:53 | mnew | oh wow why is it such an old version |
| 20:57 | ToBeReplaced | mnew: i would guess it's due to build requirements that couldn't be met with 2.0 before fc19 was cut -- technomancy might know or #leiningen |
| 21:01 | mnew | I'll just install manually for now, I'll look into updating the rpm but I am a complete fedora noob |
| 21:01 | satshabad | So I have an experiemnt where I have two matrix multiplication algorithms. One is implemented recursivly (NOT tail recusive) and one uses the nested maps. both have the same big O run time, but the one with the three maps out performs the other by an order of magnitude. Is this due to the general slowness of recursion vs iteration? or is it something clojure specific? or JVM specifc? |
| 21:02 | satshabad | I mean obviously one can only speculate |
| 21:04 | satshabad | Also: is it possible to recur more than once in a function and still use `recur` somehow? |
| 21:05 | jared314 | satshabad: you can use recur in multiple places, but the result is the same, unless inside a loop |
| 21:06 | satshabad | hmmm, but if I use loop/recur, recur has to be in the tail position *only* to get the TCO beneft? |
| 21:09 | seangrove | How can I add a local lein plugin while I'm developing it? |
| 21:09 | yeoj___ | I'm new to clojure, but is there anything in pedastal or luminus that offers scaffolding (django, rails) like features? It seems like adding routes for pages has me jumping around to a bunch of different areas to add boilerplate things. |
| 21:09 | seangrove | Trying to fix a quirk with lein-cljsbuild, have the code cloned and changed, but not sure how to get lein to use it instead of the version that's in my .m2 |
| 21:10 | bitemyapp | seangrove: lein install |
| 21:11 | bitemyapp | Found an excuse to start using CLJS on the @work project. |
| 21:13 | satshabad | bitemyapp: that's awesome |
| 21:16 | seangrove | bitemyapp: Very cool |
| 21:19 | satshabad | does anyone know of any good talks/blog-posts/advice on how to take something that is not tail recusion and turn it into something that is tail recursion? |
| 21:22 | justin_smith | satshabad: in general, you can often take the non-tail-recursive version, make any values it uses extra parameters to the function/loop, then put everything that was after the tail up at the top of the loop |
| 21:23 | bitemyapp | satshabad: a lot of times when you're writing recursive code, it can just be a reduce anyway. |
| 21:23 | justin_smith | yeah, that's a good point |
| 21:23 | bitemyapp | seangrove: does "Unable to resolve var: reader/*alias-map*" ring a bell? |
| 21:23 | justin_smith | recursion is low level in clojure, an iterating or reducing call is better |
| 21:23 | bitemyapp | justin_smith: for a long time, most of my loop recurs (pre 1.5) were just short-circuiting folds. |
| 21:24 | bitemyapp | now that reduced is a thing, I don't even need it for that. |
| 21:24 | satshabad | hmmm |
| 21:24 | satshabad | that's really interesting |
| 21:25 | satshabad | but what about functions that recur multiple times? |
| 21:25 | satshabad | i mean they call themselves several times? |
| 21:25 | justin_smith | conditionals |
| 21:25 | justin_smith | or, in the rare case, you need a recursive call but cannot use `recur` because it cannot be a tail call |
| 21:26 | bitemyapp | justin_smith: let-fn ? |
| 21:26 | bitemyapp | oh, no, that's mutual recursion. |
| 21:26 | justin_smith | I mean things like quicksort that do not lend themselves to tail recursion |
| 21:26 | justin_smith | or generally when you want to recurse in parallel on two branches of a data structure |
| 21:27 | bitemyapp | In case anybody thinks this is unusual, writing Haskell requires an inordinate amount of time spent thinking about foldl, foldl', and foldr and which one will or won't blow up the stack. |
| 21:27 | satshabad | well in this spcifc case I'm talking about divide-and-conquer for matrix multiplication. you divide the matrix into 4 and then call divide on those parts and combine the results |
| 21:27 | bitemyapp | satshabad: that's a problem for reducers if I ever heard one. |
| 21:27 | bitemyapp | reducers can parallelize the divide/conquer for you too. |
| 21:27 | satshabad | yeah i've seem that |
| 21:27 | hiredman | a function can recursively call itsself fine |
| 21:27 | satshabad | it's exciting! |
| 21:27 | hiredman | but you cannot have more than one call in the tail position |
| 21:28 | satshabad | yes so in this case I am not sure it's applicable |
| 21:28 | hiredman | recur can only be used in the tail position to provide bounded space recursion |
| 21:28 | hiredman | but a function called f, that calls f, is still recursive, recur isn't what makes a function recursive |
| 21:29 | satshabad | justin_smith: do you think the statagy of putting extra params in a loop /recur construct would work here? |
| 21:30 | satshabad | hiredman: yes, I understand that. The problem i am running into is that it performs way worse than higher order functions |
| 21:30 | satshabad | and I was wondering why and how I could fix it |
| 21:31 | bbloom | satshabad: can you share the code? |
| 21:31 | hiredman | satshabad: that is unlikely, so I wonder what you mean by "higher order functions" |
| 21:31 | bbloom | satshabad: maybe the issue will be obvious to a trained eye? |
| 21:31 | bitemyapp | bbloom: he needs to use reducers or mikera's library. |
| 21:31 | bitemyapp | you're going to look at the code and then you're going to end up repeating what I just said. |
| 21:32 | satshabad | bbloom: https://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj#L46 |
| 21:32 | bbloom | bitemyapp: if he's only going to divide it in to FOUR parts, the communication overhead of reducers is surely not worth it |
| 21:32 | satshabad | haha I bet |
| 21:32 | bitemyapp | bbloom: it's a reduce regardless. |
| 21:32 | satshabad | higher order == map, reduce |
| 21:33 | bbloom | oh, i misunderstood. it's dividing it up in to four *repeatedly* |
| 21:33 | satshabad | yes, it's turtles all the way |
| 21:33 | bitemyapp | is this the part where we get back to agreeing with me? |
| 21:33 | bitemyapp | I'd like to skip to that part. |
| 21:33 | bitemyapp | ;) |
| 21:33 | hiredman | bbloom: reducers are also not just about fold's parallelism |
| 21:34 | satshabad | yeah that's just a bonus right? |
| 21:34 | bbloom | it's a bonus, but hiredman points it out b/c of my comment about communication overhead |
| 21:34 | bbloom | reducers also minimize intermediate data structures, which can be a perf win |
| 21:35 | hiredman | satshabad: if I had to guess, I would say that if your map/reduce based version is faster you map/reduce based version is not computing the same thing |
| 21:35 | satshabad | oh i se |
| 21:35 | satshabad | huh? |
| 21:35 | satshabad | they are run on the same thing |
| 21:35 | satshabad | and map/reduce version is faster |
| 21:37 | bbloom | satshabad: do you have that code to show too? |
| 21:37 | hiredman | satshabad: and they have the same result? |
| 21:37 | satshabad | sure, |
| 21:37 | satshabad | https://github.com/Satshabad/Matrix-Mult-Analysis/blob/master/src/project1/core.clj#L12 |
| 21:37 | jared314 | is there a way to use a custom comparator with sets? |
| 21:37 | satshabad | well they are run on random matrices |
| 21:37 | satshabad | of the same size |
| 21:38 | ToBeReplaced | jared314 what are you trying to do? |
| 21:38 | jared314 | ToBeReplaced: a set of maps where I am comparing values in the maps |
| 21:39 | bbloom | jared314: you mean you want custom equality? |
| 21:39 | bbloom | jared314: to the end of custom set membership? |
| 21:39 | hiredman | both of these use mapv, it is not clear to me how you are making the distinction, just looking at it, the second one is doing way more |
| 21:40 | jared314 | bbloom: maybe, i'm trying to control the duplicate check |
| 21:40 | bbloom | jared314: can you step back and describe the higher level goal? |
| 21:42 | bbloom | jared314: b/c there are a few possible recommendations & i wanna make sure i recommend something sensible |
| 21:42 | jared314 | bbloom: i have a set of maps, with various keys and values, and I want to customize the equality check to only use a single key in the map |
| 21:43 | bbloom | jared314: ah, ok. you might find that the simplest thing to do is to just have a map of sets |
| 21:43 | bbloom | instead of a set of maps |
| 21:44 | bbloom | (update-in map-of-sets [(:key m)] (fnil conj #{}) m) |
| 21:45 | jared314 | bbloom: i can't get rid of the maps. They are generated before my function, and i'm using them further them down the pipeline |
| 21:45 | bbloom | jared314: i'm not suggesting you get rid of the maps. i'm suggesting you store them in a map of sets, rather than directly in a set |
| 21:46 | bbloom | jared314: study that update-in line i wrote above ^^ |
| 21:46 | bbloom | instead of conj/disj-ing to a set, you do it to set values of a map |
| 21:47 | jared314 | bbloom: ok, give me sec to see if I can work it in |
| 21:48 | seangrove | technomancy: You around to help developing a local version of a lein plugin? |
| 22:16 | satshabad | bitemyapp: you mentioned you thought that divide and conquer could be done using reduce |
| 22:16 | satshabad | I have been thinking about it |
| 22:16 | satshabad | and I don't see how it applies |
| 22:17 | satshabad | could you give me a hint at what you meant? |
| 22:17 | bitemyapp | satshabad: not really, you're catching me at the tail-end of my day. |
| 22:17 | satshabad | ah ok, no worries |
| 22:17 | bitemyapp | satshabad: my brain is fried. Suffice it to say, you'd be reduce 1 -> map 1 -> reduce * |
| 22:18 | satshabad | what's 1? |
| 22:18 | bitemyapp | that's how you turn divide and conquer into HOF |
| 22:18 | satshabad | ah like * is many ? |
| 22:18 | bitemyapp | yes. |
| 22:18 | bitemyapp | * is partitions |
| 22:18 | bitemyapp | you're mapping the reduction across the partitions |
| 22:19 | bitemyapp | and reducing the mapped reductions of the partitions |
| 22:19 | bitemyapp | satshabad: think about it man, if divide and conquer can't be expressed in terms of map and reduce...then what is Hadoop? |
| 22:19 | satshabad | hahaha |
| 22:19 | satshabad | yes I was thinking of *just* reduce |
| 22:20 | satshabad | but with map, it makes more sense |
| 22:20 | bitemyapp | satshabad: you could do it with just reduce. |
| 22:20 | satshabad | really? |
| 22:20 | bitemyapp | satshabad: you realize map is a dumb fold right? |
| 22:20 | bitemyapp | everything can be made from folds. |
| 22:20 | satshabad | yeah |
| 22:20 | satshabad | oh |
| 22:20 | satshabad | I guess |
| 22:20 | bitemyapp | well? |
| 22:20 | satshabad | i see |
| 22:20 | satshabad | it's all folds |
| 22:20 | bitemyapp | Right. |
| 22:21 | satshabad | functional programming is cool |
| 22:21 | bitemyapp | Clojure doubly so. |
| 22:21 | satshabad | OK i will think on it some more and see what i can come up with |
| 22:21 | satshabad | thanks! |
| 22:24 | `cbp | bitemyapp: hi, should i work on the branch connection? |
| 22:24 | holo | hi |
| 22:24 | `cbp | bitemyapp: to add to the tests |
| 22:25 | bitemyapp | `cbp: if you like, sure. |
| 22:27 | holo | some fn yelds val for each item of a vector. why does it yeld [key val] for maps? |
| 22:27 | holo | *yields |
| 22:28 | bitemyapp | ,(seq {:a 1 :b 2}) |
| 22:28 | clojurebot | ([:a 1] [:b 2]) |
| 22:28 | bitemyapp | holo: you are welcome to guess why, given the above. |
| 22:29 | holo | bitemyapp, i suppose that's the internal implemenation, but i'm more worried about the semantics of some |
| 22:29 | bitemyapp | some isn |
| 22:30 | bitemyapp | isn't going to start doing magic where sometimes it seqs across and sometimes it fucks with the values before seq'ing |
| 22:30 | bitemyapp | that's a really bad idea and before thinking there's something wrong the API you should ask yourself if you've actually thought about it harder than Hickey |
| 22:30 | bitemyapp | because 99.999% of the time, you havent' |
| 22:30 | holo | i know |
| 22:31 | bitemyapp | it makes perfect sense and if you expect key-val pairs then destructure them in the fn you pass to some. |
| 22:31 | bitemyapp | or start using Fluokitten. |
| 22:31 | bitemyapp | and make a functor-some. |
| 22:31 | bitemyapp | ffilter, really. |
| 22:31 | bitemyapp | but don't do that. Just fix your code. |
| 22:48 | `cbp | bitemyapp: so run will be (run query connection) right? (writing the docs) |
| 22:48 | `cbp | or uh (run connection query) |
| 22:49 | `cbp | prolly the former for threading with -> |
| 22:51 | holo | bitemyapp, thanks. can't fix this map as it's to be searched by key or value. i'll probably name what i want as get-key |
| 22:52 | holo | or get-some-key |
| 23:05 | muhoo | and here's my weird, context-free error of the night https://www.refheap.com/20242 |
| 23:06 | muhoo | any clue where to even look? |
| 23:07 | amalloy | muhoo: at the repl, you typed in (defn foo (let ...)) |
| 23:09 | amalloy | or, no, you attempted to load a namespace that contains (defn foo (let ...)) |
| 23:09 | rhg135 | amalloy, i'm in awe |
| 23:10 | muhoo | amalloy: that's it! i had forgoten a [] after a defn |
| 23:10 | muhoo | that's fucking spooky |
| 23:10 | amalloy | i'll be here all night, doing parlor tricks |
| 23:10 | muhoo | (inc amalloy ) |
| 23:10 | lazybot | ⇒ 4 |
| 23:10 | amalloy | except that actually i'm leaving now. glad you found it, muhoo |
| 23:11 | muhoo | it's all good, thanks again |
| 23:41 | marcopolo2 | join #haskell |
| 23:42 | marcopolo2 | whoops |
| 23:42 | `cbp | ~guards |
| 23:42 | clojurebot | SEIZE HIM! |
| 23:42 | coventry | It's OK to date other languages. |
| 23:44 | jonh | if only for a short while |