2013-05-08
| 00:23 | devn | How did I miss the-ns for so long? |
| 00:26 | Raynes | devn: Because you never tried to break clojail. ;) |
| 00:26 | Raynes | We have a long history of abusive namespace hackory based around the-ns. |
| 00:28 | technomancy | gdev: you only use emacs for one clojure project? |
| 00:28 | gdev | technomancy, yeah, one at a time |
| 00:29 | Raynes | technomancy: I'm curious how many people use multiple vim instances. |
| 00:29 | Raynes | If I had to use more than one I'd cut people. |
| 00:29 | technomancy | Raynes: I thought everyone did? |
| 00:29 | Raynes | I certainly don't |
| 00:30 | Raynes | Have no reason to. |
| 00:30 | technomancy | because then you can make fun of emacs's >1s startup time |
| 00:30 | Raynes | I open things in split buffers, tabs, etc. |
| 00:30 | Raynes | And you can of course switch to background buffers like with Emacs. |
| 00:30 | technomancy | so you have like your work buffers in the same buffer list as your OSS stuff? |
| 00:31 | Raynes | My work *is* open source. |
| 00:32 | Raynes | I don't think I've worked on a single thing not open source since I got to Geni. |
| 00:32 | technomancy | nice! |
| 00:32 | technomancy | good work if you can get it =) |
| 00:32 | technomancy | but I mean your work projects and side projects |
| 00:34 | gdev | i'm still trying to understand the original question; what gave the impression that I only use emacs for one project? |
| 00:35 | technomancy | gdev: otherwise having nrepl launch on emacs boot would be pretty annoying |
| 00:36 | gdev | technomancy, ah, well usually when I'm opening emacs its to edit a clojure file; even if I wasn't it wouldn't bother me having it going |
| 00:36 | technomancy | right, but each project will have a different classpath |
| 00:37 | technomancy | I guess if you always had a .clj file as the argument to emacs it could work |
| 00:37 | arrdem | I tried to have nrepl open whenever I edited a .clj but I didn't get it right :/ |
| 00:38 | gdev | so my workflow would be, cd <project dir>/<src dir>, emacs core.clj, ??? profit |
| 00:38 | gdev | what could possibly go wrong? |
| 00:38 | technomancy | gdev: guess it's fine if you never use gui emacs |
| 00:39 | technomancy | I have it so emacs starts a shell when it launches |
| 00:39 | technomancy | then I cd to the project and hit C-c C-j for jack-in |
| 00:41 | gdev | what I'm trying to do now is if I'm in a file and i hit C-x C-e, instead of saying "no lisp subprocess" it just says "starting nrepl-jack-in" |
| 00:42 | technomancy | (eval-after-load 'clojure-mode '(define-key clojure-mode-map (kbd "C-x C-e") 'nrepl-jack-in)) ; maybe |
| 00:47 | gdev | i'll have to put that on my to-do list for tomorrow. I have a rule, no configuration changes after 10 pm. |
| 00:48 | arrdem | gdev: that's one way to keep insomnia at bay |
| 00:49 | gdev | arrdem, yes and also not having to deal with that awkward moment when you wake up the next morning face down on your keyboard and when you look up you've noticed your config folder has turned into a pumpkin |
| 00:50 | arrdem | gdev: ah a friend of mine _wting realized that having a ~/conf dir which is git controlled and symlinking from there helps keep config pumpkins at bay |
| 00:52 | technomancy | dinc |
| 00:52 | technomancy | that is to say, double inc |
| 00:53 | arrdem | (def dinc (comp inc inc))? |
| 00:54 | technomancy | exactly |
| 00:54 | technomancy | clojurebot: oinc? |
| 00:54 | clojurebot | oinc is octo-inc: (apply comp (take 8 (repeat inc))) |
| 00:54 | arrdem | (inc clojurebot) |
| 00:54 | lazybot | ⇒ 23 |
| 01:05 | gdev | ,((#(apply comp (take % (repeat inc)))20)22) |
| 01:05 | clojurebot | 42 |
| 01:05 | gdev | odd way to add two numbers |
| 01:31 | tomoj | dnolen: so any thought on whether supporting with-bindings* etc alongside existing binding macro (i.e. no var reification, just a bit of ugliness to let {push,pop,get}-thread-bindings get/set the values of dynamic vars) is on the table? |
| 01:32 | dnolen | tomoj: I'm not likely to look at anything related to vars until we're much closer to bootstrapping. |
| 01:33 | tomoj | ah, well, I realize I can just throw them in my library then |
| 01:33 | tomoj | since no changes to existing stuff is required |
| 01:37 | tomoj | and people who use binding will still get the benefits, and they have no need to use {get-thread-,with*-}bindings, nice |
| 02:04 | tomoj | oh, shit, actually, I needed to change the emit for :def |
| 02:04 | tomoj | :( |
| 02:04 | tomoj | so core-async will be pended on bootstrapping (or will just not work with dynamic scope) |
| 02:08 | tomoj | well I guess I can define a macro which adds existing dynamic vars (e.g. *print-fn*) and lets you define new ones |
| 02:09 | tomoj | core-async seems capable of giving us generators |
| 02:09 | tomoj | question is, do we even want that? :) |
| 02:10 | tomoj | I'm guessing no.. |
| 02:48 | devn | good evening gents |
| 02:49 | devn | anyone else feel like the reader page gets way too many questions and there seem to be many variations on the answers people receive? |
| 02:55 | devn | yogthos: howdy |
| 03:04 | ciphergoth | damn, compojure generates a lovely function which handles requests as they arrive, but no statically available information on what my routes and endpoints are |
| 03:04 | ciphergoth | so when I want to say "redirect to over here", I repeat myself specifying the URL |
| 03:05 | callen | ciphergoth: you can return the result of passing the request to the intended function too. |
| 03:05 | callen | ciphergoth: somewhat like middleware. |
| 03:06 | callen | ciphergoth: that doesn't return an HTTP 3XX though. |
| 03:06 | ciphergoth | callen, oh you mean instead of redirecting? |
| 03:06 | callen | right, but you could write a wrapper that does a redirect-fn and sets the status to 3XX and spits out the alternate result by fn. |
| 03:06 | callen | would take maybe...120 seconds to write. |
| 03:06 | ciphergoth | right, but I want to do much more than redirecting, like including links in "href=" and "action=" |
| 03:06 | callen | or less. |
| 03:07 | callen | I have my own ideas on how to handle that, but I doubt they apply to your use-case. |
| 03:07 | ciphergoth | Think you'd need something that wasn't compojure! |
| 03:08 | callen | erm, no. I'm fine with Compojure. |
| 03:08 | callen | I just bundle up my routes and ship them into a universal rendering context |
| 03:09 | callen | that then gives me the ability to define purpose-oriented referents for the URLs |
| 03:09 | callen | but, I usually don't need to do that, because I'm not an idiot and don't change URLs. |
| 03:09 | ciphergoth | well, you do a (defroutes foo this that) and then a (defroutes (context "/admin" [] foo)) |
| 03:09 | ciphergoth | and it's not until the latter is written that you even know what the url for "that" is |
| 03:09 | callen | not quite. It sits on the template rendering side. |
| 03:10 | ciphergoth | I'm not planning on changing my URLs, I just prefer to write code in a way that adheres to DRY and makes it harder for me to make mistakes! |
| 03:10 | callen | I feel you, I just don't see why you can't solve your problem. |
| 03:11 | callen | ciphergoth: you need to understand that Lisps in general, Clojure included, are not omakase like Rails. |
| 03:11 | ddellacosta | ciphergoth: it sounds like you are looking for something vaguely like Rails "rake routes?" |
| 03:11 | callen | ciphergoth: you are expected to prepare your own dishes from the materials provided and craft precisely what you want. |
| 03:11 | ciphergoth | I have never used Rails |
| 03:11 | ddellacosta | okay, nevermind. |
| 03:11 | callen | You will not be provided a best-practices 100% all possible use-cases imagined framework for everything. |
| 03:12 | callen | we even abandoned the one remotely serious micro-framework for a template oriented framework instead because it lent more power to the programmer. |
| 03:12 | callen | we just don't...need that stuff. |
| 03:12 | callen | ciphergoth: it's all data, write your own code to do what it is you have in mind. |
| 03:12 | callen | ciphergoth: what are you using for templates? |
| 03:12 | ciphergoth | enlive |
| 03:12 | tomoj | 'omakase' good word |
| 03:13 | ddellacosta | I think DHH uses it a lot |
| 03:13 | ddellacosta | I wonder if he likes sushi. |
| 03:13 | callen | tomoj: it's apropos and apolitical (no value assignment). |
| 03:14 | ciphergoth | I'd be interested to hear what other people have done in their web applications |
| 03:14 | callen | I don't have any strong opinions one way or the other as it regards omakase frameworks, I've used those and I've used more minimal stacks and been happy with both. Nevertheless, I have to describe it without getting peopled riled up. |
| 03:14 | tomoj | excellent |
| 03:14 | callen | ouch @ enlive. |
| 03:14 | ddellacosta | ciphergoth: if there is one thing I've found it seems like most people are using a big variety different libraries in the web space to solve their problems |
| 03:14 | callen | ciphergoth: I have a simple CMS on github. |
| 03:14 | ddellacosta | variety *of* |
| 03:14 | ciphergoth | it seems like lots of people must have felt the need to create an endpoint with a URL in one place, and create a hyperlink to it in another place |
| 03:15 | ciphergoth | so I'm keen to know what sort of dishes people have prepared for themselves with the ingredients provided to address this :) |
| 03:15 | ddellacosta | the thing is, I don't know if we'll ever have these big over-encompassing "CoC" frameworks in Clojure |
| 03:15 | callen | ddellacosta: pedestal'ish. |
| 03:15 | callen | 'ish. |
| 03:15 | ddellacosta | well, compojure/ring is quite common, obviously |
| 03:15 | ddellacosta | yeah, pedestal…I have to learn more about it. It scares me a bit, I'll admit. haha |
| 03:16 | callen | ciphergoth: I don't have anything open sourced that addresses your specific thing. I would strongly recommend reconsidering enlive so that it's easier to handle things like the concept of a "template context" without doing repetitive whole document processing. |
| 03:16 | ddellacosta | I think Noir did a bunch of stuff nicely, but the way it implemented some things was too side-effect intensive |
| 03:16 | callen | ddellacosta: myself and most other clojure web devs aren't impressed. |
| 03:16 | ddellacosta | callen: re: Noir? |
| 03:16 | callen | no, Pedestal. |
| 03:16 | ddellacosta | oh, pedestal? |
| 03:16 | callen | I was fine with Noir. |
| 03:17 | ciphergoth | OK so supposing I was using the templating system of your choice, what might the solution look like? |
| 03:17 | ddellacosta | ah, yeah, again, I haven't dug into it yet |
| 03:17 | callen | I use compojure/ring/libnoir/luminus now. |
| 03:17 | ddellacosta | yah, that seems like a solid stack… |
| 03:17 | callen | ciphergoth: Clabango, which resembles Jinja/Django templates. I have a universal render-template function that handles template context. |
| 03:17 | ciphergoth | that sounds great, how does it address this issue? |
| 03:17 | ddellacosta | ciphergoth: there is another question here which is, are you doing client-side-heavy development or server-side templating? |
| 03:17 | callen | ciphergoth: if I need to add global or template context, it's simple to do so. In the process, I can munge my routes to provide injectable/renderable aliases for routes. |
| 03:18 | callen | ddellacosta: I highly recommend Luminus if you need ideas on how to structure a Clojure web app. |
| 03:18 | callen | It's quite nice. |
| 03:18 | ciphergoth | how does a template context help here? |
| 03:18 | callen | ciphergoth: I described a possible solution above. |
| 03:18 | ddellacosta | yeah, I've poked at it a bit, but otherwise just rolled my own stuff w/compojure |
| 03:18 | callen | ciphergoth: read what I said. |
| 03:19 | callen | ddellacosta: I poked and prodded yogthos as he's been developing Luminus. Got him to switch template libraries, bwahahahaha. :) |
| 03:19 | ddellacosta | what was he using before? |
| 03:19 | callen | ddellacosta: hiccup. |
| 03:20 | ddellacosta | ah. |
| 03:20 | ciphergoth | callen: you mena the bit that starts "I just bundle up my routes..." |
| 03:20 | callen | ciphergoth: da comrade. |
| 03:20 | callen | ddellacosta: I've been doing web dev solo and in a team context long enough that I'm wary of anything that doesn't put my html in a file that ends in .html |
| 03:20 | ddellacosta | callen: haha |
| 03:20 | callen | normally that would mean enlive, but enlive is awful. |
| 03:21 | ddellacosta | callen: actually, I pretty much agree. What don't you like about enlive though? (I have my own feelings about why that is as well...) |
| 03:21 | ciphergoth | How do you "bundle up your routes" in compojure? |
| 03:21 | ciphergoth | All compojure gives you is a function that responds to requests |
| 03:21 | ddellacosta | ciphergoth: you mean, other than using defroutes? |
| 03:21 | ciphergoth | how is that useful at render time? |
| 03:22 | ciphergoth | ddellacosta, defroutes composes several functions into one, but I don't see how to use what it generates at render time |
| 03:22 | ciphergoth | no matter what templating system you have |
| 03:22 | ciphergoth | I don't see a way to query what defroutes creates to extract a URL I can then use in a template |
| 03:23 | callen | ciphergoth: split the data structure out and inject it into the defroutes after the fact. |
| 03:23 | ddellacosta | ciphergoth: sorry, I'm jumping in on the conversation late, but what exactly are you trying to do? You can get route info in the request map |
| 03:23 | callen | ddellacosta: wants URL/handler aliases or something that he can inject client-side into the HTML. |
| 03:24 | callen | (url "handles-stuff") => "/handles/stuff/?true |
| 03:24 | ciphergoth | not necessarily client-side |
| 03:24 | callen | not literally client-side |
| 03:24 | ciphergoth | server-side at the moment actually |
| 03:24 | callen | I mean in HTML viewed by the client |
| 03:24 | ciphergoth | right |
| 03:24 | callen | rendered server-side |
| 03:24 | ciphergoth | yes |
| 03:25 | ddellacosta | ciphergoth: so, you want your url to be like callen's example (url "handles-stuff") |
| 03:25 | ciphergoth | So I refer to URLs in two places: one where I write (GET "....") and the other where I set an href property on an "a" entity. I'd like ot not repeat myself |
| 03:25 | ddellacosta | but be represented otherwise (/handles/stuff/?true) ? |
| 03:25 | callen | ciphergoth: write the code you want. |
| 03:25 | callen | ciphergoth: you're spending more time discussing it in IRC than it would take to implement, seriously. |
| 03:25 | ciphergoth | OK so nothing currently exists to do this, if I want there to be a library with this property I should write it myself. |
| 03:25 | ciphergoth | I'm surprised! |
| 03:26 | ciphergoth | callen: that really isn't my experience. If someone else had written a solution it would be far more stable, better thought out etc than what I would write when I first thought of the problem. |
| 03:27 | ddellacosta | ciphergoth: I guess I don't get it--if you have a map of your routes somewhere, you can just easily pull out aliases. If they are systematized, then it's just a transformation of the route information. |
| 03:27 | ciphergoth | this seems like a need that every single webapp would need, so it's weird that no-one has written a framework that makes it easy. |
| 03:27 | ddellacosta | ... |
| 03:28 | ddellacosta | ciphergoth: it seems like just a simple function to me, so maybe that's why there isn't a library for it. But maybe I'm still not understanding what you are trying to do. |
| 03:28 | ciphergoth | when you say a map, you mean a literal Clojure map? |
| 03:28 | ddellacosta | ciphergoth: yes. |
| 03:28 | ciphergoth | right, so instead of using the macros compojure provides, I should put all my routes in a map |
| 03:28 | ciphergoth | completely work around compojure basically |
| 03:29 | ciphergoth | write my own way of compsing route information togethe |
| 03:29 | ciphergoth | I can do that, but I just would have thought someone else woudl already have done so! |
| 03:29 | callen | simple function/macro. |
| 03:29 | tomoj | I did my own routing thing too.. |
| 03:29 | callen | ciphergoth: that's not the attitude Lisp hackers tend to take. |
| 03:29 | ciphergoth | will do something ugly for now. Thanks guys! |
| 03:30 | callen | ciphergoth: you're being overly schlep sensitive and need to just "get 'er done" |
| 03:30 | callen | sigh, gone anyway. |
| 03:30 | callen | so whiny. |
| 03:30 | ddellacosta | I still don't think I understood what he wanted. |
| 03:30 | ddellacosta | it seemed too trivial to be under discussion…but I probably didn't get it. |
| 03:31 | ddellacosta | anyhow, gotta run, cheers mates |
| 03:31 | callen | ddellacosta: toodles. |
| 03:31 | callen | I understood what he wanted, I just didn't understand why it was so hard to just do. |
| 04:05 | wink | is public/resources somehow special to lib-noir? can't find why I can't slurp outside of that dir... |
| 04:20 | wink | ah. grep failed me... |
| 04:28 | Glenjamin_ | Hi guys, is there a function like seq that returns strings? |
| 04:28 | Glenjamin_ | eg (??? "string") => "string" (??? "") => nil |
| 04:29 | Glenjamin_ | so i can do something like (or (??? potentiall-empty-string) "default") |
| 04:31 | mthvedt | (if (seq? %) % nil) |
| 04:31 | mthvedt | sorry |
| 04:31 | mthvedt | seq not seq? |
| 04:31 | Foxboron | Glenjamin_: you could use empty? |
| 04:31 | Foxboron | then wrap that around something |
| 04:31 | edoloughlin | Or clojure.string/blank? |
| 04:32 | edoloughlin | ,(doc clojure.string/blank?) |
| 04:32 | clojurebot | "([s]); True if s is nil, empty, or contains only whitespace." |
| 04:32 | Glenjamin_ | yeah, mthvedt's approach seems sensible - was checking if there was a core functions which already wraps the pattern |
| 04:33 | mthvedt | i sometimes wish there was a core function that did that |
| 04:33 | Foxboron | make your own :)? |
| 04:34 | amalloy | &(doc not-empty) ;; Glenjamin_ |
| 04:34 | lazybot | ⇒ "([coll]); If coll is empty, returns nil, else coll" |
| 04:34 | Foxboron | ohhhh |
| 04:34 | Glenjamin_ | (def some-str #(when-not (clojure.string/blank? %1) %1)) |
| 04:34 | Glenjamin_ | oo |
| 04:34 | Glenjamin_ | ,(or (not-empty "") "default") |
| 04:34 | clojurebot | "default" |
| 04:34 | noidi | I don't think a string-specific function would be as useful as seq |
| 04:34 | Foxboron | amalloy: and thats the function that came right after "empty" in the quickref |
| 04:34 | Glenjamin_ | huzzah! |
| 04:35 | noidi | with seq, you don't pass it a seq but something seq-able |
| 04:35 | Glenjamin_ | not-empty seems very similar to seq, but without the cast to a Seq type |
| 04:35 | Glenjamin_ | which is exactly what I was after in this case |
| 04:36 | noidi | oh, cool |
| 04:37 | Glenjamin_ | ,(inc amalloy) |
| 04:37 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: amalloy in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 04:37 | Glenjamin_ | (inc amalloy) |
| 04:37 | lazybot | ⇒ 53 |
| 05:07 | AWizzArd | Via “lein localrepo” I installed jcuda and jcublas, cause those libs are not available in any Maven repo. This worked nicely, until today. Now I get the message that Leiningen could not transfer the artifacts from central. I want Leiningen to just take what it has in ~/.m2 and only contact central if something is missing. Ideas? |
| 05:13 | edoloughlin | AWizzArd: have you tried asking on #leiningen? I've not done this with lein but I had similar problem on a Java project (using Apache Buildr). I set up a private remote repo and deployed to that. I see it might be possible to do this with lein: https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md |
| 05:15 | edoloughlin | Buldr tried the Maven repos and then fell back to the private remote... |
| 05:15 | AWizzArd | Hmm I see. |
| 06:01 | mccraig | alia vs cassaforte experiences anyone ? |
| 06:07 | shriphani | hi. I am trying to create an infinite list using this: (def dates-list (concat (list start-date) (list (clj-time/plus (last dates-list) (clj-time/days 1))))) But the list only has length 2. Isn't referencing dates-list sufficient to create an infinite list ? |
| 06:10 | stain | not sure what you are trying to do.. but (last dates-list) would just evaluate to the last element of the previous binding of dates-list |
| 06:11 | stain | you would not want to look for the last element of a truly infinite list anwyay ;) |
| 06:11 | shriphani | stain, I just want a sequence of dates. |
| 06:12 | shriphani | I expected it to lazily generate the next one as needed. |
| 06:12 | mccraig | shriphani: try the iterate function : (iterate (fn [old-date] (make-a-new-date old-date)) first-date) |
| 06:13 | shriphani | mccraig, is there a way to do it using just the lists though ? |
| 06:15 | mccraig | shriphani: not sure what you mean |
| 06:15 | edoloughlin | shriphani: why not implement something using lazy-seq? |
| 06:15 | edoloughlin | ,(doc lazy-seq) |
| 06:15 | clojurebot | "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?" |
| 06:15 | stain | do you want to call (nth) on it? |
| 06:19 | shriphani | umm no. I wanted to try out somehting like this: let x = 1 : map (2*) x (that is haskell code) |
| 06:21 | mccraig | shriphani: (iterate #(* 2 %) 1) |
| 06:21 | tomoj | #3 question to ask rich if I ever get to talk to him: which dictionary do you use? :) |
| 06:21 | mccraig | ,(take 10 (iterate #(* 2 %) 1)) |
| 06:21 | clojurebot | (1 2 4 8 16 ...) |
| 06:27 | AWizzArd | When I make a closure (let [size 8] (defn ...)) then `size` is used as a final constant and needs no lookup time during runtime. Can I achieve the same with a def? |
| 06:29 | clgv | AWizzArd: yes there is ^:const |
| 06:29 | clgv | AWizzArd: (def ^:const pi 3.14159) |
| 06:29 | AWizzArd | Very good, thanks. |
| 07:22 | zackzackzack | How would I go about dynamically redefining clojure.test/test-var to do something else? |
| 07:25 | zackzackzack | Nevermind! Somebody had the foresight to make it dynamic |
| 08:36 | mpenet | mccraig: yeah :p but I might be biaised |
| 08:37 | mpenet | mccraig: imo alia is more production ready atm and covers more features (async, more config options). The main difference between the 2 libs is the api other than that, cassaforte aims to be a bit higher level, alia forces you to use execute, prepare and so on (which is a good thing imo). |
| 08:38 | mpenet | mccraig: under the hood both lib use the same query dsl (hayt, it's a shared library), so you can switch between the 2 quite easily anyway |
| 08:39 | mpenet | mccraig: both are resonably documented, but I expect the clojurewekz guys to create tons of guides soon. |
| 09:11 | mpenet | just checked, cassaforte has no way of setting consistency or any per query option atm |
| 09:47 | gdev | has anyone done any remote pair programming on clojure? No one in my office knows clojure or does pair programming so remote looks like my only option |
| 09:47 | gdev | just curious about how to set up my workstation for it |
| 09:48 | ucb | gdev: you can share a tmux screen |
| 09:48 | ucb | s/screen/session/ |
| 09:48 | ucb | gdev: alternatively, you can try with screenhero |
| 09:48 | ucb | I'd also recommend a voice channel, e.g. skype |
| 09:49 | gdev | oh wow, screen hero looks cool |
| 09:49 | ucb | yeah, it mostly works too |
| 09:50 | ucb | "mostly" |
| 09:50 | duck1123 | unless you're on linux. :( |
| 09:52 | gdev | duck1123:) yea i just noticed that in the FAQ |
| 09:53 | gdev | it also has a link to contact them if you want them to support other platforms so start the penguin email storm and they migth implement it for nix |
| 09:55 | gdev | although, I haven't tried it using wine |
| 09:55 | tsdh | Is it possible to declare generic parameters with gen-class, e.g., Map<String,Integer> instead of just Map? |
| 09:56 | ucb | gdev: you could always run a vm with ... never mind ;) |
| 09:57 | gdev | tsdh:) did this not answer your question? http://stackoverflow.com/questions/3688730/how-to-pass-a-typed-collection-from-clojure-to-java |
| 10:00 | gdev | I really need to create a stack overflow account. That way I can post my questions on there and then link them in this channel |
| 10:01 | tsdh | gdev: Ok, there doesn't seem to be a way except for writing a Java interface first and then making the gen-class-ed class implement that. |
| 10:02 | gdev | tsdh:) yeah when you're dealing with gen-class it has to be AOT compiled so it needs a lot of ceremony to do what you need |
| 10:05 | tsdh | gdev: Yeah, just now I have to provide some student with a simple interface to my clojure lib. Just a few static methods that return maps. So for now, I'm keeping them to return just Map, although on the java side one would expect Map<String,SomeOtherType>. |
| 10:05 | tsdh | That's good enough, since he only needs that for testing purposes. |
| 10:06 | gdev | can you post the code on refheap.com ? |
| 10:10 | tsdh | gdev: Sure. https://www.refheap.com/paste/14302 |
| 10:41 | pjstadig | i just used juxt |
| 10:45 | pjstadig | is there a schedule for the 2013 Clojure/West videos yet? |
| 10:47 | pjstadig | https://twitter.com/ClojureWest/status/326455152586420225 |
| 11:22 | tomoj | oh, CFP for strange loop done tomorrow? |
| 11:24 | Bodil | tomoj: Yep. |
| 11:24 | bbloom | tomoj: ooh, the last day is tomorrow? hmmm probably should get on that... |
| 11:26 | tomoj | I wonder how bad an idea it is to submit one when you haven't quite solved the problem yet |
| 11:28 | Bodil | tomoj: fwiw, I'm submitting an ELC talk on a language I haven't really written yet. It's a great way to make sure you get things done by September. :) |
| 11:29 | tomoj | ah, btw, I'd love to see your talk - can't remember whether I decided it was worth pinging you or not, but I was going to tell you that I have often fantasized about that language you're making :) |
| 11:30 | Bodil | So far it's just my fantasy too... needs a bit of work. :) |
| 11:34 | ejackson | Bodil: cgrand calls it TDD - talk driven development :) |
| 11:35 | wink | better than hope or desperation driven |
| 11:35 | bbloom | wink: that's what occurs on the plane ride to the conference |
| 11:35 | wink | hehe |
| 11:35 | wink | yep |
| 11:36 | ejackson | only when you're lucky... |
| 11:36 | Bodil | ejackson: Hah, very true. :) |
| 11:37 | jtoy | can anyone show me how if I had to update a count as im reading through a large file, how I would do it? I think i need to use some imperitave programming or use refs? |
| 11:38 | gfredericks | you're reading lines from a file? |
| 11:38 | gfredericks | just for the sake of producing this count? |
| 11:38 | jtoy | gfredericks: im running some analytics on each line and based on the reults i want to update the counter |
| 11:38 | jtoy | yes |
| 11:39 | gfredericks | that sounds like you could create a line-seq and just reduce over it |
| 11:41 | jtoy | gfredericks: yes, that does sound right, it looks like reduce will make the result turn non-lazy and give methe number i want |
| 11:41 | gfredericks | but the laziness still lets you process the file in a streaming fashion |
| 11:41 | justin_smith | I heard Hickey talk about Hammock driven development - that is when you are motivated to code for a conference in a tropical location, right? |
| 11:42 | jtoy | gfredericks: ok, i'll test it |
| 11:42 | bbloom | justin_smith: heh. i think hammock driven development is a programmer centric view of the "open mode" discussed in John Cleese's (awesome & hilarious) lecture on Creativity: http://vimeo.com/18913413 |
| 11:43 | justin_smith | bbloom: yeah, but it seemed to fit this conference talk nicely |
| 11:43 | bbloom | justin_smith: it did, i just needed an excuse to link to john cleese |
| 11:45 | jtoy | gfredericks: I am collecting a couple of different numbers, so I dont think I can use reduce? is that correct? I thikn i still would need to increment? |
| 11:45 | justin_smith | jtoy: you can reduce into a vector or map |
| 11:46 | jtoy | justin_smith: could you show me a simpe example of just that? Im not sure how that would work exactly |
| 11:47 | justin_smith | (reduce (fn [[a b] x] [(inc a x) (inc b (/ x 2))]) [0 0] [1 2 3 4 5 6]) |
| 11:47 | justin_smith | just define the reduce fn to take an array and return one |
| 11:47 | justin_smith | (or map or whathaveyou) |
| 11:48 | justin_smith | oops, change inc to + above, but that is not the important part of the example |
| 11:49 | jtoy | i see |
| 11:50 | justin_smith | when I want to gather data about a sequence I define a simple data structure that will hold the result and any intermediary values I need, then a function that takes and returns that structure, then I fill that function in to update the structure as apropriate for each element |
| 11:50 | jtoy | justin_smith: great, I will use this method |
| 11:51 | tomoj | if pedestal has a god map, does angular have a devil map? |
| 11:53 | justin_smith | lemme guess, god map is a rewrite of global state into a single data structure in order to make a library re-entrant? |
| 11:53 | tomoj | I'm not terribly sure I understand the pattern (nor pedestal), but that sounds right |
| 11:53 | Anderkent | Does anyone know if https://devcenter.heroku.com/articles/debugging-clojure is still up to date? I'm getting errors when trying `lein repl :connect http://server/url` |
| 11:53 | tomoj | it's the Big Atom in the Sky |
| 11:54 | tomoj | (nor "re-entrant") |
| 11:55 | justin_smith | tomoj: I have seen a number of libs do this - a lib is written so that it refers to some global state inside the lib, and that works until someone wants to instances of what the lib does |
| 11:55 | justin_smith | re-entrancy is the ability to make two objects defined by some stateful library side by side without them messing each other up |
| 11:56 | tomoj | hmm |
| 11:56 | justin_smith | so they create a state object/hash and shove all the globals in there (and add an extra arg to everything / create a special var / whatever) |
| 11:57 | justin_smith | *two instances of what the lib does |
| 11:57 | tomoj | I see |
| 11:57 | tomoj | with pedestal you wire up all these pure functions and explicitly describe the connections between them and the model, and then it just runs them in a state-monad-ish way. I suspect it should have no problem running two instances |
| 11:59 | justin_smith | we had to do this same thing recently when we realized our in-house lib was storing an atom referring to db config |
| 12:00 | justin_smith | but if two parts of one app wanted to use different dbs? |
| 12:00 | justin_smith | boom, move the config out of a single atom in the lib into an arg / special var |
| 12:00 | tomoj | right |
| 12:00 | tomoj | like the java.jdbc issue? |
| 12:00 | justin_smith | yeah |
| 12:00 | justin_smith | exactly |
| 12:01 | justin_smith | the hilarious part is we were using clojure.java.jdbc, and the atom was supposed to be simplifying things |
| 12:01 | justin_smith | in the end we realize that was the right way all along |
| 12:02 | tomoj | so in pedestal when you build a new app it has an atom in there |
| 12:02 | Pure_loulou | hello room :),i want to represant a graph in clojure,which data type to use? |
| 12:02 | tomoj | but there's no var associated with the atom |
| 12:02 | tomoj | i.e. there is room for polytheism |
| 12:02 | Pure_loulou | maps is the normal way to represent a graph in clojure? |
| 12:03 | justin_smith | Pure_loulou: there are graph libs, but I have just used a pair of maps, one describing nodes, the other describing edges |
| 12:04 | justin_smith | each node/edge having keys to look up the related edge/nodes in the other map |
| 12:04 | tomoj | there's also inductive graphs, but I haven't seen a lib that does that yet |
| 12:04 | tomoj | except my WIP |
| 12:05 | jtoy | justin_smith: do you see any basic error with the way I am doing my reduce: https://www.refheap.com/paste/14308 |
| 12:06 | justin_smith | jtoy: you are adding a boolean, which will not work |
| 12:06 | justin_smith | booleans do not overload to int |
| 12:06 | jtoy | ah, right |
| 12:07 | jtoy | justin_smith: dont think it fixed my other error though, ill continue looking |
| 12:07 | justin_smith | I would also define the sequence separate from the reducer |
| 12:08 | justin_smith | the sequence is just complex enough to benefit by standing alone |
| 12:08 | jtoy | justin_smith: you mean just using let to define it to its own variable? |
| 12:09 | justin_smith | yeah, I tend to find bugs faster when less is generated inline |
| 12:09 | justin_smith | (and I think other people do to) |
| 12:10 | jtoy | cool, ill try that too |
| 12:32 | kephale | CCW question (cemerick?): is there currently a way (or a chance of a future way) of using the eclipse internal/local dependency system for external dependencies? |
| 12:33 | cemerick | kephale: Eclipse doesn't have a dependency system of its own...? |
| 12:33 | kephale | cemerick: can't you link jars from other projects? |
| 12:33 | kephale | for java project at least |
| 12:34 | cemerick | kephale: oh, you mean adding project A to the classpath of project B? |
| 12:34 | kephale | cemerick: yeah! |
| 12:34 | kephale | nothing fancy, just for multi-project development |
| 12:35 | cemerick | If you have project A set up right (i.e. so your clojure source dirs are eclipse source roots, etc), then yes. It's not automatic though. |
| 12:36 | cemerick | Though, you can load any Clojure file into any REPL whenever you want, regardless of the classpath. That's worked well enough for me 95% of the time. |
| 12:37 | kephale | cemerick: aha. good point, and that is probably better than restarting the REPL anyway |
| 13:34 | chessguy | hey, i'm playing with a pedestal app, because i want to show the cool tooling, but i'm missing a step somewhere. it's not generating the css somewhere. i feel like there's a lein task i need to run or something. any help? |
| 13:40 | rkneufeld | chessguy: You shouldn't need to do anything extra to have css work. Have you generated a new project or are you in one of the samples? |
| 13:40 | chessguy | rkneufeld: i'm in the todomvc example |
| 13:41 | chessguy | rkneufeld: the styles look right if i go to the dev link, but if i go to design mode, or render, it doesn't look right |
| 13:42 | chessguy | rkneufeld: and if i (watch :dev) i get a lot of FileNotFoundException: out/public/generated-js (No such file or directory) |
| 13:43 | rkneufeld | chessguy: there is definitely a lot broken with that sample, I'm surprised that so many people find it ;) |
| 13:43 | chessguy | rkneufeld: i think it's the only one for which i've been able to get recording to work |
| 13:43 | chessguy | rkneufeld: any suggestions? |
| 13:43 | rkneufeld | chessguy: at this point we've only made it work on the dev page, fwiw - so render and design mode just plain won't work. |
| 13:43 | chessguy | ugh |
| 13:44 | chessguy | it seems like it's really close to working, it's just not loading the styles |
| 13:44 | rkneufeld | chessguy: FYI, the chat sample in the official repo should work for recording. |
| 13:45 | rkneufeld | chessguy: it is pretty close - we never got around to mucking with tooling vs. app templates and getting that sorted out in the rest of the sample pages. |
| 13:45 | chessguy | let me try that one again |
| 13:45 | rkneufeld | *tool pages (not samples) |
| 13:45 | rkneufeld | chessguy: As the originator of that todomvc sample I would definitely say it is a bad example of many things ;) |
| 13:46 | chessguy | rkneufeld: well, it at least looks great :) |
| 13:46 | chessguy | at least, when the styles work |
| 13:46 | rkneufeld | chessguy: heh, the funny part is that was provided by the spec |
| 13:47 | tieTYT2 | what's the word that means the opposite of appreciation? I regret learning clojure because it's making me feel that way about java |
| 13:48 | chessguy | rkneufeld: well, thanks for providing some kind of example, anyway. even a bad example is better than nothing |
| 13:48 | chessguy | i'm really looking forward to seeing a screencast or tutorial on pedestal |
| 13:49 | rkneufeld | chessguy: I'm really looking forward to making one - now that we've wrapped up the data flow engine cleanup we should be a lot closer to that. |
| 13:49 | chessguy | rkneufeld: oh yeah, Craig said you guys were working on wildcard-matching or something |
| 14:35 | kastrup | Raynes: Has anyone tried to take tryclojure and turn it into a full-fledged learning system for Clojure? |
| 14:41 | gfredericks | what fledges does tryclojure lack? |
| 15:00 | kastrup | gfredericks: Try Clojure is sweet--I love it, but it is more of an appetite whetter. I'm wondering if it could be used as a more comprehensive teaching tool. |
| 15:01 | muhoo | i'm trying to read a map in from a file inside project.clj to get around a requirement by a library that it have passwords in project.clj. no luck though. (-> ".lein-env" slurp read-string :migratus) appears to show up as a list even though it is a map. java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Associative |
| 15:01 | muhoo | i refuse on matter of principle to put passwords into project.clj and thus into git. |
| 15:02 | kastrup | gfredericks: I'm thinking it might be interesting to expand the material and possibly add some features (like saving a user's repl session, etc). |
| 15:03 | amalloy | kastrup: 4clojure? |
| 15:04 | amalloy | muhoo: nobody can help with "this thing i'm certain is a map says it's a list, what's the deal?" |
| 15:04 | muhoo | amalloy: true, but as i'm beating on this thing, it seems that (type) says it is indeed a PersistentArrayMap. weird. |
| 15:04 | amalloy | then the exception is coming from something else |
| 15:05 | kastrup | amalloy: Nice. Few new things under the sun! |
| 15:06 | muhoo | aha! i see the problem. defproject is a macro, and it looks like by the time it is done, any code inside it is not executed yet |
| 15:06 | solussd` | xb |
| 15:06 | muhoo | :-/ |
| 15:07 | muhoo | i suspect ~ will be needed here, or exec. wil beat on it. sorry for the thrash |
| 15:08 | muhoo | amalloy: thank you. ~ was all i needed. |
| 15:20 | tieTYT2 | i have a vector and I want to compare adjacent elements and sometimes return them both and sometimes return just one of the two. Is a reduce function the best way to do this? |
| 15:28 | amalloy | tieTYT2: try combining mapcat and partition |
| 15:34 | AWizzArd | I am implementing some neural network stuff using CUDA. I can store weights as floats or doubles on the GPU. The code will look nearly identical for both versions, only tiny differences here and there. |
| 15:34 | AWizzArd | Currently I am using a macro “emit-cuda-defrecord” which spits out both records, implementing the same protocol. |
| 15:35 | AWizzArd | Only the code looks ugly, cause we are talking about 2k - 3k LOC, full of ~ and ~'. |
| 15:35 | AWizzArd | Any ideas? I would love to write down the code as if I were doing only one implementation, say, for doubles. |
| 15:36 | AWizzArd | And have then some maybe not so nice looking code (20-100 loc) which replicates my implementation and replaces only a few details. |
| 15:37 | tieTYT2 | amalloy: I'll look that up, thanks |
| 15:39 | tieTYT2 | ah what I forgot to say is, if I've got [1 2 3] I want to compare 1 to 2, and then the result of that to 3 |
| 15:40 | tieTYT2 | ah partition can do that |
| 15:40 | AWizzArd | symbol-macrolet maybe? |
| 15:43 | amalloy | AWizzArd: i don't think anyone knows enough about your problem yet to give meaningful advice |
| 15:45 | AWizzArd | amalloy: think of a defprotocol for matrices with 75 functions. I want to provide several implementations of this protocol. One that uses pure Java and runs everywhere, one that uses blas and is faster but needs some extra installation, and one that uses cuda. |
| 15:45 | AWizzArd | amalloy: in those 75 FNs I work with double-array calls and such. I could have two cuda implementations, and not just one. |
| 15:46 | AWizzArd | One that uses doubles on the GPU, and one that uses floats. |
| 15:47 | AWizzArd | I basically want to have 2x 75 FNs, where in the replication a few names were changed. |
| 15:59 | mthvedt | maybe there's some clojure templater that can template code? |
| 16:01 | AWizzArd | I think for now I will go with the implementation that uses doubles, and see later if floats are worth the effort. |
| 16:02 | muhoo | wow, all the little gems hiding in the clojure ecosphere: https://github.com/joegallo/robert-bruce |
| 16:02 | muhoo | i was just writing some hack to retry clj-http on error 406 to deal with a broken site, and thinking "wow i wish someone had already thought of a way to to this", and here it is already |
| 16:08 | tieTYT2 | is there a way to make clojure output more information in its exceptions? eg: clojure.lang.ArityException: Wrong number of args (1) passed to: core$reduce would be so much better if it told me the type that's being passed in |
| 16:13 | dnolen | tieTYT2: that would be nice but you should have a line number for that exception |
| 16:13 | recycle | any idea on how to pass a clojure sequence as a command line param to main function ? (that is - prevent argv from being tokenized at whitespace) |
| 16:18 | tieTYT2 | dnolen: I do, but if that line number is the middle of a threading macro, it doesn't help much |
| 16:20 | dnolen | tieTYT2: ? even in a threading macro it should be pretty easy to spot the reduce that isn't being given enough params |
| 16:30 | ppppaul | recycle, |
| 16:30 | ppppaul | IFS |
| 16:30 | ppppaul | talk to the #bash people or nDuff |
| 16:32 | ppppaul | IFS=\n |
| 16:32 | ppppaul | your bash fn is going to get complicated... |
| 16:32 | TimMc | reiddraper: What's the plan for the meetup on Thursday? |
| 16:32 | ppppaul | recycle, you can use commas |
| 16:33 | ppppaul | [1,2,3] |
| 16:33 | tomoj | muhoo: robert-bruce is nice indeed |
| 16:33 | tomoj | or looks it |
| 16:35 | tomoj | I want something better for rate-limiting |
| 16:35 | TimMc | recycle: It really is a shell-specific question, but here's how I generate passwords from the shell: alias pw="java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar -e '(println (apply str (repeatedly 20 #(rand-nth (map char (range 33 127))))))'" |
| 16:35 | recycle | yeah - escaping definitely does the trick |
| 16:36 | recycle | thanks! |
| 16:36 | TimMc | quoting |
| 16:36 | TimMc | escaping is backslashes |
| 16:36 | recycle | yep yep,sorry :) |
| 16:42 | tomoj | TimMc: hmm |
| 16:42 | tomoj | would it be unreasonably paranoid to use SecureRandom? |
| 16:49 | AWizzArd | tomoj: it’s good, go ahead and use it |
| 16:50 | tomoj | A better question would've been whether it's unreasonably unparanoid to use java.util.Random |
| 16:51 | ppppaul | i have to buy my random numbers for the government |
| 16:53 | Apage43 | tomoj: depends on what for |
| 16:53 | Apage43 | -anything- having to do with access control or security, yes |
| 16:54 | ordnungswidrig | tomoj: what's your risk? |
| 16:55 | TimMc | I'm not worried about someone being ablee to gather enough random data from my computer to be able to predict the PRNG output. |
| 16:56 | Apage43 | it doesn't take much |
| 16:57 | TimMc | A big source of leakage (I think) would be JS on a malicious web page calling Math.random() |
| 16:59 | TimMc | Apage43: Unfortunately, for anything I *really* care about, I end up using a passphrase with (probably) much lower entropy. :-/ |
| 16:59 | Apage43 | That's probably not an issue, as Math.random() is probably just seeded around the time, and not pulling from any system RNG. At best they can predict the numbers that would be generated -on that page- |
| 17:00 | Apage43 | which has implications if you do JS crypto (badly), but otherwise probably not |
| 17:02 | Apage43 | typically though there has to be some locality involved |
| 17:03 | Apage43 | e.g. if you generate two keys of some description with java.util.Random, anyone who can get the first can predict bits of the next one (and vice versa) |
| 17:03 | rodnaph_ | hey - i'm trying to set up a browser connected nrepl session with piggieback, but i'm falling a bit flat as i think i may have misunderstood the intention of the library. does anyone have experience who could help? |
| 17:05 | rodnaph_ | specifically - i'm expecting to be able to connect to nrepl via my editor and dynamically update and evaluate clojurescript straight to the connected browser... am i mistaken that this is what it provides? |
| 17:14 | Apage43 | rodnaph_: you can get a cljs repl connected to a browser yes https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments |
| 17:15 | Apage43 | What *piggieback* does is make the interaction with the cljs repl actually have nREPL behavior instead of behaving as if you evald' an expression in a repl that reads input from you, which is what you get if you follow that article |
| 17:15 | Apage43 | piggieback is just for making running a repl in a repl a bit smoother, but it is not *required* |
| 17:16 | Apage43 | should probably try to get set up without it first |
| 17:16 | rodnaph_ | ok, i'll have to read that a few times i think ;) |
| 17:16 | rodnaph_ | yah i have used the standard browser connected repl before, but i was using vim + slime + screen. |
| 17:17 | rodnaph_ | i'm switched to vim-fireplace now, which afaik, speaks nrepl. so i was experminenting to see if it would talk to the repl -> and to the browser. seamlessly. |
| 17:17 | Apage43 | ah |
| 17:17 | Apage43 | well |
| 17:18 | Apage43 | vim-fireplace supports code eval, but doesn't give you a repl buffer |
| 17:18 | Apage43 | if you switched its repl session to cljs that -could- work.. but it might confuse it |
| 17:20 | rodnaph_ | hmm... ok, i'm just going to keep on playing then and see what i can make work. thanks v much for the info. |
| 17:36 | addywaddy | newbie here :) |
| 17:36 | addywaddy | got a question regarding restructuring. https://gist.github.com/addywaddy/b3a19cc7f70fb33201d2. Any ideas? |
| 17:38 | tomoj | addywaddy: not clear what you want |
| 17:38 | tomoj | your second example is an error |
| 17:38 | tomoj | &([:a :b] [:c :d]) |
| 17:38 | lazybot | java.lang.IllegalArgumentException: Key must be integer |
| 17:38 | tomoj | you want to make sure there are 3 args and not 2? or you want to make sure the remaining args are all vector pairs? or..? |
| 17:38 | addywaddy | tomoj: ah sorry |
| 17:39 | tomoj | anyway easiest way to ensure the function is not called in an incorrect way is to not call it in an incorrect way :P |
| 17:39 | addywaddy | what I want is to past on the list of arrays to bar expanded. |
| 17:42 | tomoj | (let [foo (fn [first & rest] [first rest])] (apply foo :name '([:a :b] [:c :d]))) |
| 17:42 | tomoj | &(let [foo (fn [first & rest] [first rest])] (apply foo :name '([:a :b] [:c :d]))) |
| 17:42 | lazybot | ⇒ [:name ([:a :b] [:c :d])] |
| 17:42 | tomoj | you mean like that? |
| 17:50 | mikerod_ | What is a good way to generate a tree structure in clojure when you have a root node, a function determining if a node has children, and a function that gets the children of a node? I'm thinking analogously to `tree-seq` except I don't have a tree to walk, instead I just have the root node. |
| 17:51 | tomoj | mikerod_: that's what tree-seq expects |
| 17:52 | tomoj | well obviously you mean something different |
| 17:52 | mikerod_ | tomoj: I know, but tree-seq doesn't return a data structure that represents the tree. At least that isn't what I gather from it. |
| 17:53 | addywaddy | :tomoj I think I need to use apply: https://gist.github.com/addywaddy/b3a19cc7f70fb33201d2 |
| 17:56 | tomoj | mikerod_: I see |
| 17:57 | malesch | tree zipper and node/edit |
| 17:58 | gilles | hi |
| 17:59 | mikerod_ | What I mean is, tree-seq doesn't return a structure that preserves the hierarchy. It seems the intended use of tree-seq is to walk an existing tree data structure represented as root. |
| 18:00 | mikerod_ | malesch: Thanks. I have started to explore the clojure.zip lib. I'll look into the node/edit. |
| 18:01 | tomoj | here's my stack-consuming version https://www.refheap.com/paste/7afe71b0e23cadf87de5a0e99 |
| 18:01 | tomoj | I think that's what you mean? |
| 18:02 | tomoj | hmm, or https://www.refheap.com/paste/bb4fb39b2173a06def02d1e45 |
| 18:03 | tomoj | ? |
| 18:05 | mikerod_ | tomoj: Thanks for these examples. This is along the lines of what I am looking for. |
| 18:06 | mikerod_ | I'm surprised that there are no functions provided in core clojure that is similar to this already. |
| 18:11 | tomoj | it sort of seems like cheating to use clojure.walk |
| 18:12 | tomoj | the clojure.zip idea is interesting since your args are almost the same as zipper's, except missing make-node |
| 18:12 | tomoj | which is the thing that clojure.walk does for us in my example |
| 18:13 | mikerod_ | tomoj: Yeah, I can see what you mean. |
| 18:57 | tieTYT2 | why do the code snippets here use the int function? http://www.drdobbs.com/architecture-and-design/the-clojure-philosophy/240150710?pgno=3 |
| 18:58 | tieTYT2 | what would go wrong without it? |
| 18:58 | hiredman | ,(int \c) |
| 18:58 | clojurebot | 99 |
| 18:58 | dnolen | ,(- \A 65) |
| 18:58 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number> |
| 18:59 | hiredman | ,(inc (int \c)) |
| 18:59 | clojurebot | 100 |
| 18:59 | tieTYT2 | oh right |
| 18:59 | mebaran151 | I'm trying to get lein ritz to work but I think it's choking on the space in Program Files: here is the error I get on nrepl-ritz-jack-in: Exception in thread "main" java.io.IOException: Cannot run program "C:\Program": CreateProcess error=2, The system cannot find the file specified; right after the Compiling Clojurescript prints |
| 18:59 | mebaran151 | |
| 18:59 | tieTYT2 | jesus, this sample could be simpler |
| 18:59 | mebaran151 | anybody here run lein-ritz on Windows with emacs? |
| 19:16 | TimMc | *sigh* |
| 19:16 | TimMc | Short-timer. |
| 19:45 | gdev | ,(tree-seq even? inc [0 1 2 1 1 4 3 1 6 3 3]) |
| 19:45 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: [0 1 2 1 1 ...]> |
| 19:45 | gdev | ,(tree-seq even? seq [0 1 2 1 1 4 3 1 6 3 3]) |
| 19:45 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: [0 1 2 1 1 ...]> |
| 19:46 | gdev | ,(tree-seq sequential? seq [0 1 [2 1] 1 [4 3 1] 6 3 3]) |
| 19:46 | clojurebot | ([0 1 [2 1] 1 [4 3 1] ...] 0 1 [2 1] 2 ...) |
| 21:05 | holo | hi |
| 21:06 | holo | ,(apply merge-with (comp flatten vector) [{:a "ab"} {:a "ac"} {:a "ad"}]) |
| 21:06 | clojurebot | {:a ("ab" "ac" "ad")} |
| 21:06 | holo | is there a more concise way to return this result? |
| 21:11 | Raynes | $google flatland useful |
| 21:11 | lazybot | [flatland/useful · GitHub] https://github.com/flatland/useful |
| 21:11 | Raynes | holo: If you use that, there is a function in flatland.useful.seq that will let you do |
| 21:11 | Raynes | (s/groupings ffirst (comp val first) [{:a "ab"} {:a "ac"} {:a "ad"}]) |
| 21:11 | Raynes | {:a ["ab" "ac" "ad"]} |
| 21:11 | Raynes | Not really more concise though. |
| 21:13 | holo | (inc Raynes) ; thanks, I think I may just get there some useful functions |
| 21:13 | lazybot | ⇒ 30 |
| 21:24 | amalloy | &(reduce #(update-in %1 [(ffirst %2)] (fnil conj []) (val (first %2))) {} [{:a "ab"} {:a "ac"} {:a "ad"}]) |
| 21:24 | lazybot | ⇒ {:a ["ab" "ac" "ad"]} |
| 21:24 | amalloy | a no-dependencies approach |
| 21:30 | holo | (inc amalloy) ; fnil is amazing! didn't know about it. thanks |
| 21:30 | lazybot | ⇒ 54 |
| 21:31 | n_b | ,(doc fnil) |
| 21:31 | clojurebot | "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched." |
| 21:32 | holo | this takes handling nil values to a different level |
| 21:39 | mange | Is there a reason why fnil stops at three replacements? |
| 21:43 | amalloy | four args is already a lot for a function; if you're worried 0-4 of the first four args may be nil, you need a more sophisticated approach than fnil :P |
| 21:43 | xeqi | maybe combine it with partial? |
| 21:44 | mange | Or I might want something like (apply fnil f defaults) for something. |
| 22:16 | benkay | has anyone worked with the clj-crypto library? it's throwing an error "No matching method found: init for class javax.crypto.Cipher" |
| 22:19 | holo | if map entries type is likely to deprecate, so is key and val? |
| 22:31 | gdev | Raynes, what is your talk going to be about and did you ever go shopping? |
| 22:38 | Raynes | gdev: Talk is about laser and I did not go shopping. |
| 22:38 | Raynes | https://github.com/Raynes/laser |
| 22:38 | Raynes | Probably going to pull an all nighter on this sucker. |
| 22:39 | Raynes | Because I was too lazy to write but half of it a day before I give it. :p |
| 22:42 | gdev | cool, if you need any help lemme know |
| 22:54 | shriphani | hi. I am trying to read a gzipped text file in clojure and when I do this : https://www.refheap.com/paste/14332 , I get an array of size 4300 but doing zcat filename | wc -l gives me 8 million. What am I doing wrong ? |
| 22:56 | hiredman | you certainly don't get an array out of that |
| 22:58 | shriphani | hiredman, I thought for returned a list no? |
| 23:03 | shriphani | hiredman, I changed the for to a map and I still get 4300 only. |
| 23:15 | benkay | can anyone hook me up with contact information for macourtney? |
| 23:32 | shriphani | hi. what is the alternative to using doall while line-seq-ing over a large file (several GBs). |
| 23:32 | n_b | shriphani: What, exactly, are yo trying to do? |
| 23:33 | n_b | apply a function to each line? |
| 23:33 | shriphani | n_b, I am going over a very large gzipped text file and yes applying a function to a line. |
| 23:33 | n_b | and what does the fn do? |
| 23:33 | n_b | does it have side-effects, and do you need the return value? |
| 23:33 | shriphani | the issue here is that when I use zcat <file> | wc -l , I get 8 million lines and using (doall (line-seq ..)), I get 4300. |
| 23:33 | shriphani | currently just identity |
| 23:34 | n_b | Do the results look right, or do they look like gzip junk? |
| 23:34 | shriphani | using zcat they look ok and the first 4300 look right as well |
| 23:35 | shriphani | I am able to get lines beyond that using zcat |
| 23:35 | shriphani | but I can't get > 4300 using doall |
| 23:36 | shriphani | so my guess is that maybe I shouldn't use doall. |
| 23:39 | n_b | my guess would actually be the GZip class not implementing bufferedreader |
| 23:39 | n_b | and getting closed |
| 23:41 | shriphani | n_b, I used (reduce (fn [x y] (+ x 1)) 0 (line-seq in)) and then I got 4300 again |
| 23:42 | shriphani | n_b, I cast the GZIPInputStream as an io/reader and I cast that as a BufferedReader |
| 23:42 | shriphani | is that wrong ? |
| 23:44 | shriphani | n_b, then is it possible to read that file in? It seems like a very simple task... |
| 23:52 | n_b | I'm honestly not too familiar with all the InputStream stuff in Java-land, just going off of former experience with reader issues |
| 23:53 | shriphani | ah. your estimate seems to be correct. GZIPInputStream doesn't implement BufferedReader (so says S/O). |
| 23:54 | n_b | I'm sure there's a UnbufferedInputStreamObjectFactoryAbstractFactoryImpl that'll solve it for you somewhere in java.util then :P |
| 23:54 | tomoj | naturally, it's not a Reader? |
| 23:54 | shriphani | I am surprised at how java regularly shows up to make life hell for me... |
| 23:55 | n_b | Clojure does very little to abstract away the host platform |
| 23:56 | shriphani | so what is the work-around for this? Is there a way to read this .gz file ? |