2013-09-10
| 00:00 | ddellacosta | callen: is there a way to link to a session in himera? |
| 00:02 | callen | zanes: not really. I'm very sick, my throat hurts, and I'm cringing and shaking at just swallowing food. |
| 00:03 | zanes | callen: Oh no! |
| 00:03 | callen | ddellacosta: screenie |
| 00:04 | ddellacosta | callen: naw, I won't make you deal with my IE8 woes. I'm going to poke at it and see if I can reproduce it in an isolated environment with the latest version of CLJS, and if so I'll file a bug report. |
| 00:04 | TEttinger | callen, kittens make sick times better http://imgur.com/gallery/iYfbrwb . just adopt all the cats at the local humane society in a fevered daze |
| 00:05 | callen | TEttinger: don't say that. I love dogs and cats. |
| 00:12 | callen | TEttinger: thank you for the therapeutic kitty |
| 00:12 | TEttinger | get well soon |
| 00:12 | callen | TEttinger: thank you ;_; |
| 00:13 | TEttinger | we need you back and having to repeat yourself to people who ask poor questions in 24 hours |
| 00:15 | callen | I can't tell if that's genuine sympathy or a characterization. |
| 00:16 | TEttinger | callen, you fill a role here. if you're sick, #clojure has no bouncer for poorly asked questions. |
| 00:17 | callen | well don't that just warm the cockles. :) |
| 00:17 | TEttinger | and we do seem to get a lot lately |
| 00:17 | callen | TEttinger: I'm more worried about the bad answers than I am the bad questions these days ;) |
| 00:18 | coventry` | How can I tell lein to run clojure built from source, in such a way that I will end up with clojure/test-closure on my classpath? |
| 00:18 | TEttinger | when I'm here I'm probably too forgiving with people who really should get the advice "read a book/tutorial" and I try to solve their problems when they won't learn from it. and I also usually fail to solve their problems. |
| 00:18 | rhg | checkouts |
| 00:18 | callen | coventry`: ^^ what rhg said. |
| 00:18 | coventry` | Great. I assumed that wasn't going to work, because it's not a lein project. |
| 00:19 | callen | oh wait |
| 00:19 | callen | source? |
| 00:19 | clojurebot | source is http://github.com/hiredman/clojurebot/tree/master |
| 00:19 | rhg | oh |
| 00:19 | callen | coventry`: is it a single file? |
| 00:19 | rhg | ehm |
| 00:20 | rhg | add it to the cclasspath manually? |
| 00:21 | callen | it sounds like it should either be made into a lein project, symlinked, or copied. |
| 00:21 | akurilin | Does ring by default turn on the stacktrace middleware in dev profile? I've never seen the ring stacktrace for 500s until now, and I never enabled it explicitly. |
| 00:22 | callen | akurilin: lein ring |
| 00:22 | callen | ring doesn't "do" anything |
| 00:23 | rhg | callen be right ofc |
| 00:23 | akurilin | I guess this is the first time I'm doing an html content type GET, which explains why I haven't seen it before. |
| 00:23 | coventry` | Thanks, guys. I'll make clojure-test into a project, and symlink to that from checkouts/ |
| 00:24 | callen | coventry`: good choice. |
| 00:24 | callen | I need to start charging y'all. |
| 00:24 | callen | surcharge for "sick and dying" support. |
| 00:25 | akurilin | callen, thanks for pointing that out, found out that stacktraces are on by default from the docs. |
| 00:26 | akurilin | Not that anybody can read those things until a couple of months in. |
| 00:26 | akurilin | stacktraces, not docs. |
| 00:26 | akurilin | :) |
| 00:26 | coventry` | callen: If I succeed with this, it might reduce the number of stupid questions. I hope that's sufficient reward. :-) Anyway, off to bed. Hope your recovery is swift and painless. |
| 00:29 | callen | coventry`: your questions aren't crazy. |
| 00:36 | fkey | Hey there, trying to solve a issue the clojure way, and can't decide the best route. Bascially given a list of coordinates, i want to draw lines connecting each coordinate. For the last pair of coordinates, i want to determine the direction in which the line was drawn and then draw a arrow head at the end. |
| 00:37 | fkey | currently i got a bunch of procedural code and want to do away with it |
| 00:38 | fkey | so, for the connecting of arrows, using reduce does sound like a nice solution |
| 00:39 | fkey | but theres no way to determine if you are currently on the last item being evaluated, and i rather now calculate the direction vector every time reduced is called...seems wasteful |
| 00:41 | ambrosebs | fkey: map-indexed is often useful. |
| 00:41 | fkey | so , you think its fair to do something like |
| 00:41 | fkey | ah |
| 00:42 | fkey | meh still..i rather not do a if statement in each function map call..seems wastefulk |
| 00:42 | fkey | was planning on doing something like |
| 00:43 | fkey | (defn drawConnectionWithArrow [canvas points] (reduce drawLines ...) (drawArrow points ...)) |
| 00:43 | ambrosebs | seems like you need a branch somewhere though? |
| 00:43 | ambrosebs | ah |
| 00:43 | ambrosebs | see butlast. |
| 00:44 | ambrosebs | probably what you want |
| 00:44 | ambrosebs | you can then feed the everything except the last thing into one fn, then the (last ..) into the other one. |
| 00:44 | fkey | hmm |
| 00:45 | fkey | as far as functional programming goes though, in clojure is it alright do do the above what i have posted? Seems a little procedural... but works |
| 00:46 | ambrosebs | with reduce? |
| 00:46 | ambrosebs | nothing wrong with that. |
| 00:46 | ambrosebs | unless it's too slow. |
| 00:47 | fkey | ambrosebs: well just function call right after the other... i mean i can probably do something like have drawLines return the last 2 points it operated on, then i can do (drawArrowAtTail (drawLines ... )) |
| 00:47 | ambrosebs | oh. yes that's fine. |
| 00:47 | fkey | not sure what is more succinct though |
| 00:48 | fkey | i just like the idea of have a function operate on the return value of another function |
| 00:48 | ambrosebs | fkey: seems better to separate them |
| 00:49 | fkey | oh yeah? |
| 00:49 | ambrosebs | you can then run whichever you want in any order. |
| 00:49 | ambrosebs | or at the same time |
| 00:49 | fkey | hmmmm true true |
| 00:50 | fkey | i think back in common lisp, you had to use let or do to perform multiple forms in a function |
| 00:50 | mtp | progn |
| 00:50 | mtp | and no |
| 00:50 | fkey | or w/e you want to call it..still getting use to that being alright in clojure |
| 00:51 | ambrosebs | fkey: a `do` can still be readable. Says "side effects!" to me. |
| 00:51 | MisterSinister | Could someone teach me how to use if-let? |
| 00:51 | ambrosebs | so don't be afraid of putting extra ones. |
| 00:52 | fkey | ambrosebs: alright. i watched a talk on monads, i forgot who gave it but was talking about haskell and how they dealt with ouput and whatnot..i liked the idea |
| 00:52 | fkey | although my previous code isn't following monadic design at all heh |
| 00:53 | fkey | wasn't sure if it was something to strive for in clojure |
| 00:53 | francis_wolke | MisterSinister: clojuredocs.org |
| 00:53 | ambrosebs | fkey: not often. |
| 00:53 | MisterSinister | francis_wolke: I've looked at it, and I still don't really get the idea. I also suspect I might be thinking of the wrong tool to refactor my particular code pattern |
| 00:53 | MisterSinister | Could I gist it to you and see if you can suggest anything? |
| 00:54 | MisterSinister | I've seen that pattern before, and I dunno how to refactor it away. |
| 00:54 | francis_wolke | yea |
| 00:54 | ambrosebs | MisterSinister: put it here if you want. |
| 00:54 | MisterSinister | ambrosebs: It'll be tidier in a gist than me pasting it in here. |
| 00:54 | MisterSinister | Gimme a moment. |
| 00:54 | ambrosebs | sorry I meant the link :) |
| 00:55 | ambrosebs | I figured you were pming. |
| 00:56 | MisterSinister | ambrosebs: PMed. |
| 00:57 | MisterSinister | https://gist.github.com/mrsinister13/6504991 if anyone else wants to help me refactor away this pattern I keep seeing. |
| 00:59 | fkey | ambrosebs:: ty for help |
| 00:59 | ambrosebs | fkey: np |
| 01:01 | francis_wolke | MisterSinister: I fail to see what you'd like to factor out - though prehaps I'm missing something? |
| 01:02 | francis_wolke | MisterSinister: `if-let' is an anaphoric macro, there is no 'it' in either of those examples. |
| 01:02 | ambrosebs | I think MisterSinister want something like `if-every`. |
| 01:03 | ambrosebs | Does that exist? |
| 01:03 | clj_newb_2345 | how does swank/nrepl relate? is nrepl a repalcmenet for swank? |
| 01:03 | MisterSinister | I've never seen an 'if-every' in Clojure. |
| 01:03 | s4muel | clj_newb_2345: Yes. |
| 01:03 | ambrosebs | well it would be if-every-let :P |
| 01:04 | MisterSinister | Because what I'm trying to avoid is having to retype the same destructure and the same method call to the same let binding. |
| 01:04 | clj_newb_2345 | so I should not use the lein-swank [plugin? |
| 01:04 | francis_wolke | MisterSinister: macros.... |
| 01:04 | MisterSinister | francis_wolke: This is why I'm asking for help - I suck at them and wouldn't even know where to begin. |
| 01:04 | ambrosebs | MisterSinister: what do you want to write instead? |
| 01:05 | MisterSinister | Something like this: |
| 01:05 | francis_wolke | MisterSinister: aplogies, but I don't answer questions for people who won't read. |
| 01:06 | xeqi | clj_newb_2345: if you are used to swank it continues to work, but is unmaintained. nrepl is the prefered mechanism moving forward |
| 01:06 | MisterSinister | francis_wolke: What do you mean? It's not like I haven't read about macros - I just haven't ever written one and am unsure how to proceed. |
| 01:06 | ambrosebs | The best place to start with a macro is what you want the output to be. |
| 01:07 | MisterSinister | Yeah - I'm trying to think that through right now. |
| 01:07 | francis_wolke | MisterSinister: If you need some material on them, buy or pirate a book. Sit down with it, and read the chapter on macros - look at the examples, write the code, experiment, write some more code, experiment... |
| 01:08 | MisterSinister | francis_wolke: And I've tried that, and haven't gotten very far. Which is why I thought I could come to a channel full of people obviously better than I am at this to ask for some help with something I've tried to solve in the past but failed horribly, as I'm not even sure where to begin. |
| 01:09 | ambrosebs | francis_wolke: please, newbie questions are more than welcome here. |
| 01:09 | ambrosebs | writing your first macro is not easy. |
| 01:11 | fkey | ambrosebs: can you take a quick look at my coding style? For some html5 canvas stuff i usually end up writing code like so http://pastebin.com/iTYMVVXs |
| 01:11 | fkey | oh, i messed up the parenthesis ...but the overall style..is it alright? or am i still thinking to procedurally? |
| 01:12 | francis_wolke | ambrosebs: acknowledged. |
| 01:14 | fkey | i probably can get away with the (first Points) and (restPoints) with parameter deconsturction |
| 01:14 | fkey | i think thats the name... |
| 01:15 | ambrosebs | fkey: yes, [p & ps] |
| 01:15 | clj_newb_2345 | in nrepl |
| 01:15 | clj_newb_2345 | how do I get the last command? |
| 01:15 | clj_newb_2345 | i.e. UPARROW in bash/zsh |
| 01:16 | clj_newb_2345 | so basiclaly, I want the last expression I valuated to be thrown back into the current line |
| 01:16 | clj_newb_2345 | so I can edit it and rerun it |
| 01:16 | xeqi | clj_newb_2345: it depends on what nrepl client you are using |
| 01:16 | clj_newb_2345 | what emacs command can I run to report this info to you? |
| 01:17 | ambrosebs | ,(drop 2 [1 2 3 4 5]) |
| 01:17 | clojurebot | (3 4 5) |
| 01:17 | xeqi | clj_newb_2345: emacs was sufficent. then you are using nrepl.el. Try M-p |
| 01:17 | ambrosebs | what's the function for [1 2 3 4 5] => [4 5]? |
| 01:17 | xeqi | for reference, there are also nrepl clients for vim, eclipse, and a standalone one |
| 01:18 | clj_newb_2345 | ah, M-p works, thanks |
| 01:18 | xeqi | $findfn [1 2 3 4 5] [4 5] |
| 01:18 | clj_newb_2345 | I was trying C-p but it was sending me to preivous line |
| 01:18 | lazybot | [] |
| 01:19 | xeqi | $findfn 2 [1 2 3 4 5] [4 5] |
| 01:19 | ambrosebs | ,(take-last 2 [1 2 3 4 5]) |
| 01:19 | clojurebot | (4 5) |
| 01:19 | lazybot | [clojure.core/take-last] |
| 01:19 | ambrosebs | wow. |
| 01:19 | ambrosebs | that's epic. |
| 01:21 | srruby | $findfn 2 [1 2 3 4 5] [4 5] |
| 01:21 | heath | ohai bear #clojure |
| 01:21 | lazybot | [clojure.core/take-last] |
| 01:21 | ambrosebs | fkey: ^^ use take-last 2 |
| 01:21 | heath | "the value of values" by ye ole rick |
| 01:21 | srruby | $findfn first [1 2 3 4 5] 4 |
| 01:21 | heath | rich, rather |
| 01:22 | lazybot | [] |
| 01:22 | heath | he's saying values should be immutable, just wondering why everyone seems to agree with him and not pipe up :) |
| 01:23 | fkey | ambrosebs: it amazes me how theres always a function in clojure for opearting on a data set..but then again |
| 01:23 | ambrosebs | heath: cos he's right? |
| 01:23 | fkey | i think rich hickey said few data types, many functions |
| 01:23 | srruby | $findfn [1 2 3 4 5] 1 |
| 01:23 | heath | ambrosebs: why is he right? |
| 01:23 | lazybot | [clojure.core/first] |
| 01:23 | ambrosebs | heath: I can't explain it better than rich. |
| 01:24 | heath | he didn't explain it |
| 01:24 | heath | "do we want to go back, no" |
| 01:24 | heath | that's about it |
| 01:24 | heath | s/it/all\ he\ said |
| 01:24 | fkey | ambrosebs: ty ty ty once again, i really appreciate the input |
| 01:25 | clj_newb_2345 | is there a way to have "(use '[clojure.tools.namespace.repl :only (refresh)])" auto executed at the start of every "lein repl" ? |
| 01:26 | heath | he mentions comparibility and equality around the 10 minute mark |
| 01:26 | heath | but you can compare values even if they aren't immutable |
| 01:26 | ambrosebs | heath: so the biggest thing for me that immutable values just never change. |
| 01:27 | xeqi | clj_newb_2345: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L296 |
| 01:27 | ambrosebs | heath: if you have a language that facilitates that like Clojure, you have to think less about "will this change here"? |
| 01:27 | clj_newb_2345 | is this a hint to read the rest of the file? :-) |
| 01:27 | ambrosebs | heath: transforms the way you program. |
| 01:27 | ambrosebs | well, if you weren't programming in a "functional" style already. |
| 01:27 | francis_wolke | clj_newb_2345: look for :injections |
| 01:28 | MisterSinister | Immutability is awesome. |
| 01:28 | MisterSinister | It's what actually drew me to Clojure. |
| 01:28 | xeqi | clj_newb_2345: I woudln't wory about it, maybe just :repl-options 's :init and :init-ns |
| 01:29 | ambrosebs | that's a local view however. bigger things like concurrency and databases like datomic use immutability to their advantage. |
| 01:29 | ambrosebs | datomic can easily give you an immutable snapshot of you database, that never changes. |
| 01:29 | francis_wolke | clj_newb_2345: ignore me xeqi is correct. |
| 01:29 | clj_newb_2345 | noted |
| 01:29 | clj_newb_2345 | /ignore ... |
| 01:30 | ambrosebs | and Clojure's atoms and refs show that you can have managed mutability holding immutable values without deadlocks or concurrency problems. |
| 01:30 | ambrosebs | and it's fast! |
| 01:30 | ambrosebs | and efficient! |
| 01:31 | ambrosebs | how shit I love immutability! ;) |
| 01:31 | ambrosebs | *holy |
| 01:31 | ambrosebs | haha |
| 01:32 | heath | ah, if i would have just shut up and listened, he does explain a little later :) |
| 01:33 | ambrosebs | heath: is your background heavy with mutability? |
| 01:33 | heath | mostly |
| 01:34 | ambrosebs | heath: it's a different world out here, it may take some rubbing off. |
| 01:34 | heath | why dynamic and not static |
| 01:35 | ambrosebs | types? |
| 01:35 | heath | i thought he was referring to static typing :P |
| 01:35 | heath | turns out clojure is dynamic :) |
| 01:35 | ambrosebs | I think Rich often says dynamic to mean types and runtime. |
| 01:35 | MisterSinister | heath: I came from Java. Mutability was burned into my brain too. |
| 01:35 | ambrosebs | at least that's my take on it |
| 01:37 | heath | most of my functional programming comes from my excursions with haskell |
| 01:37 | MisterSinister | Yay, I've used if-let correctly. |
| 01:37 | MisterSinister | \me does a happy dance. |
| 01:37 | MisterSinister | FFF |
| 01:37 | MisterSinister | Better. |
| 01:37 | ambrosebs | heath: nice. immutable haven there. |
| 01:37 | heath | yerp |
| 01:37 | ambrosebs | MisterSinister: yay! |
| 01:38 | heath | most of my professional work is javascript and soon to be python |
| 01:38 | MisterSinister | Brb |
| 01:38 | heath | erlang has the same typing as clojure |
| 01:39 | heath | anyway, at this point i'm just picking a fight for no reason, i should listen to the guy while transfer pdfs to the kindle |
| 01:39 | ambrosebs | heath: they're both strong dynamically typed langs. |
| 01:39 | heath | right |
| 01:40 | heath | when i think of immutability, i think of strong and static |
| 01:40 | ambrosebs | right, fair enough. |
| 01:40 | ambrosebs | they tend to have good support for immutability. |
| 01:41 | ambrosebs | the functional ones, that is. |
| 01:42 | ambrosebs | immutability also makes it much nicer to build a type system on top of Clojure. |
| 01:44 | gvickers | Made this as part of a plugin system to load .clj files dynamically and make sure they have the required function. It seems messy and a very un-clojure way of doing things. Prehaps dynamically loading the jar's would be better? Anyone have any experience with this sort of thing? https://www.refheap.com/b18653541d9bb3409904b3a51 |
| 01:46 | ambrosebs | gvickers: you have to roll your own solution to that often. |
| 01:46 | ambrosebs | gvickers: I don't think there's a particular accepted way to do it. |
| 01:47 | ambrosebs | gvickers: FWIW it looks about right to me. |
| 01:48 | sdegutis | gvickers: another option is to use read-string on the file's contents and look for a list starting with (defn the-required-function ...) |
| 01:48 | sdegutis | Probably not 100% foolproof, but probably good enough. |
| 01:49 | ambrosebs | sdegutis: if you want to go that ^ route, use jvm.tools.analyzer. |
| 01:49 | ambrosebs | gvickers: ^ rather |
| 01:49 | ambrosebs | It seems any other solution would be more complicated than your current one. |
| 01:52 | gvickers | Hmmm thank you. I assumed this sort of thing would be more common with established design patterns. Thanks for your help! |
| 01:53 | ambrosebs | Racket is way ahead of Clojure in that regard unfortunately. |
| 01:54 | xeqi | gvickers: lein does something similar with https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/utils.clj#L53 |
| 01:55 | sdegutis | ambrosebs: now's our time to copy whatever they're doing and catch up |
| 01:56 | ambrosebs | sdegutis: I have no idea how to write lazy-require :) |
| 01:56 | sdegutis | What's it do? |
| 01:56 | xeqi | gvickers: are you using the ref somewhere else? |
| 01:56 | ambrosebs | only load a namespace when a var is used. |
| 01:57 | sdegutis | Ooooh. Yeah. |
| 01:57 | ambrosebs | do want. |
| 01:57 | sdegutis | That's probably not even a good idea. |
| 01:57 | sdegutis | Because namespaces could have side effects upon loading that you want happening early. Maybe. |
| 01:57 | sdegutis | And other stuff. |
| 01:57 | gvickers | xeqi: yea |
| 01:58 | ambrosebs | sdegutis: yes, turns out Racket handles all of this. |
| 01:58 | ambrosebs | sdegutis: See Flatt's keynote at Clojure/West |
| 01:59 | gvickers | I gotta check out Racket |
| 01:59 | sdegutis | ambrosebs: ok thx |
| 02:03 | heath | i guess this is my real question: how can one consider a value immutable if it's there's dynamic typing? |
| 02:03 | heath | s/it\'s// |
| 02:03 | sdegutis | heath: can you change the value of 3? |
| 02:04 | sdegutis | 3 = 2 |
| 02:04 | heath | a = 3 |
| 02:04 | sdegutis | (now 3 + 3 = 4) |
| 02:04 | heath | a = 2 |
| 02:04 | heath | a + b |
| 02:04 | ambrosebs | they are unrelated. The type system helps you reason about your code, immutable values just never change. |
| 02:04 | sdegutis | heath: a represents a value, a is not a value |
| 02:04 | ambrosebs | heath: can you explain what you think links static typing and immutability? |
| 02:05 | heath | isn't a representation simply a variable? |
| 02:05 | heath | collections, numbers, i guess these are the things considered values within clojure |
| 02:06 | sdegutis | heath: what is your strongest language besides Clojure? |
| 02:06 | heath | clojure isn't my strongest :) |
| 02:06 | sdegutis | heath: what is your strongest language? |
| 02:07 | heath | javascript -> python -> haskell || agda -> erlang || c++ |
| 02:08 | sdegutis | heath: in Python, you can create a list like X = [1, 2, 3], and then you can actually delete 3 out of X, and anyone who has access to X now sees [1, 2] right? |
| 02:08 | heath | sure |
| 02:08 | sdegutis | heath: in Clojure what we mean by "immutable" is that if I have X pointing to [1 2 3], and I "remove" 3 from it which gives me [1 2], anyone else who had access to X before I did that still has [1 2 3] |
| 02:09 | heath | ambrosebs: a = 1; a cannot equal anything else, that's how i see the link between immutability and static typing |
| 02:09 | sdegutis | heath: All I did was create a new copy of [1 2 3] that doesn't have 3 in it. I didn't "mutate" the list. |
| 02:09 | sdegutis | ambrosebs: nice tangent :P |
| 02:10 | heath | functions reference older copies of values, hm. |
| 02:10 | sdegutis | heath: No, not that. |
| 02:11 | sdegutis | heath: Even inside the same function, I can create X = [1 2 3] and create Y = X, and "remove" 3 from X, and Y is still [1 2 3] even though X is now [1 2] |
| 02:11 | xeqi | and becareful of the ""remove" 3 from X" part |
| 02:11 | sdegutis | heath: because when we say we're "removing" an element from a list in Clojure, we really mean something more like X = X.copy, X.remove_last |
| 02:12 | heath | that's what i was getting at sdegutis |
| 02:12 | heath | s/getting\ at/said :) |
| 02:12 | ambrosebs | heath: there is nothing fundamental about immutable data structure or immutable variables that requires a static type system. |
| 02:12 | sdegutis | heath: This is all discussed in the Programming Clojure book. Please read it. |
| 02:13 | heath | but let's say you have a function that which will reference a variable each time it is called, if that variable is changed to represent an entirely different type, you will get a different result everytime the function is invoked |
| 02:13 | heath | s/which// |
| 02:14 | sdegutis | heath: that's lexical scoping. Values are distinct from from variables. |
| 02:15 | sdegutis | heath: that's why this works ##(for [x [1 2 3]] (inc x)) |
| 02:15 | lazybot | ⇒ (2 3 4) |
| 02:15 | sdegutis | heath: it's not that 1 is being mutated, but that "x" changes to hold a different value each time |
| 02:15 | heath | the 'vary' part of 'variable' |
| 02:15 | ambrosebs | try "local binding" |
| 02:16 | ambrosebs | it's an immutable link from a name to a value. |
| 02:18 | andyfingerhut | I hope I'm not simply muddying the water by giving a similar example like (for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x)) |
| 02:18 | andyfingerhut | Each time through the for, x is bound to a different value. In my example, each of those values has a different type. So the name x names a value with a different type in different iterations. Each of those values is immutable, though. |
| 02:20 | ambrosebs | A static type system might type `x` as (Vector Any), but either way, it's still immutable. |
| 02:21 | sdegutis | andyfingerhut: add # before it and it evals like magic :) |
| 02:21 | sdegutis | No matter where it is in your message. |
| 02:22 | andyfingerhut | sdegutis: Thanks. I haven't kept up with all the bot-magic available. |
| 02:22 | andyfingerhut | #(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x)) |
| 02:22 | sdegutis | Wait let me test it. #(+ 1 2) |
| 02:22 | sdegutis | Maybe it's two. |
| 02:22 | sdegutis | Testing ##(+ 1 2) |
| 02:22 | lazybot | ⇒ 3 |
| 02:22 | sdegutis | Okay yeah two. |
| 02:22 | andyfingerhut | ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x)) |
| 02:22 | lazybot | ⇒ (3 3 2) |
| 02:23 | andyfingerhut | ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (type x)) |
| 02:23 | lazybot | ⇒ (java.lang.String clojure.lang.PersistentHashSet clojure.lang.PersistentVector) |
| 02:23 | sdegutis | Heh for a second I misread that as an exception and was wondering what was wrong with the code which seemed fine. |
| 02:29 | zRecursive | ##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x)) |
| 02:29 | lazybot | ⇒ (3 3 2) |
| 02:32 | rhg | Heh |
| 02:38 | clj_newb_2345 | what does defroutes return, and how do I "intercept it" ? So for example, I'm runing my ring/compojure server via : (run-server (site #'all-routes) {:port 3000})) ---- now, suppose I wnat to update my routes; how can I setup it up so that I can dynamically update the routes? |
| 02:40 | SegFaultAX | clj_newb_2345: It just returns a function. |
| 02:46 | mange | clj_newb_2345: If you use that line to start your server then you should be able to re-evaluate your (defroutes all-routes ...) form and the server will automatically pick up the new version. |
| 02:47 | mange | The trick is that your #' introduces another level of indirection that looks up the function in the all-routes var when it's invoked. |
| 02:49 | MisterSinister | Does anyone know if there's some function that takes a collection and returns every ith item in it? |
| 02:49 | MisterSinister | I don't wanna have to write it if it exists already. |
| 02:50 | mange | take-nth, I think? |
| 02:50 | clojurebot | Huh? |
| 02:50 | MisterSinister | Lol@clojurebot. |
| 02:51 | MisterSinister | Thanks mange, you're absolutely right. |
| 02:51 | MisterSinister | I swear, Clojure's thought of everythign you could ever want from sequences. |
| 02:52 | MisterSinister | ,(doc take-nth) |
| 02:52 | clojurebot | "([n coll]); Returns a lazy seq of every nth item in coll." |
| 02:55 | akurilin | Quick question about function purity in Clojure. Say I have this map with config settings for my Ring app somewhere in a configs.clj. If I wanted to be completely pure I'd just pass this map along to every call that might need it. On the other end of the spectrum I could read it from anywhere in the codebase as immutable global state. What is the sweet spot in Clojure for this kind of tradeoffs? |
| 02:55 | akurilin | Should I have a convention where, for example, I never reference that var outside of say, the top level functions in my controllers. |
| 02:56 | ambrosebs | akurilin: if it never changes I think a def is fine. |
| 02:57 | akurilin | ambrosebs, is the idea then that for testing I just override the def with appropriate settings? |
| 02:58 | ambrosebs | akurilin: ah, good point |
| 02:59 | akurilin | The prob is that I'd have to either load a test-only config file for lein test runs, which is I believe what Rails does, or I could wrap all tests in with-redefs fixtures. |
| 03:01 | ambrosebs | akurilin: maybe a top-level atom might be useful. |
| 03:05 | MisterSinister | Also, holy shit source code for if-let. |
| 03:06 | ambrosebs | MisterSinister: *mind blown* |
| 03:06 | ambrosebs | it's if... and let |
| 03:07 | MisterSinister | If I actually had to write if-every, I'd probably have some trouble. |
| 03:11 | MisterSinister | ,(doc drop-nth) |
| 03:11 | clojurebot | Titim gan éirí ort. |
| 03:11 | MisterSinister | Dafuq. |
| 03:12 | MisterSinister | Why is clojurebot telling me to get down and stay down in Gaelic? |
| 03:12 | ambrosebs | ##(doc drop-nth) |
| 03:12 | lazybot | java.lang.RuntimeException: Unable to resolve var: drop-nth in this context |
| 03:12 | ambrosebs | haha |
| 03:12 | ambrosebs | these bots.. |
| 03:12 | MisterSinister | OK, looks like I'll have to write it. |
| 03:14 | MisterSinister | Maybe I'll have to bite the bullet and actually learn for. |
| 03:14 | MisterSinister | ,(doc for) |
| 03:14 | clojurebot | "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ... |
| 03:16 | ambrosebs | MisterSinister: something like this: https://gist.github.com/frenchy64/6505818 |
| 03:16 | MisterSinister | That is a very nice macro you got there. |
| 03:16 | MisterSinister | \me borrows it for his utilities. |
| 03:18 | ambrosebs | MisterSinister: haven't tested it. |
| 03:18 | ambrosebs | actually just updated it too. |
| 03:18 | ambrosebs | forgot an unquote |
| 03:18 | MisterSinister | I'll do a few macroexpands with it. |
| 03:19 | MisterSinister | In the let? |
| 03:19 | MisterSinister | For rhs? |
| 03:19 | ambrosebs | yes, should be fixed. |
| 03:20 | ambrosebs | you might want to steal if-let's error reporting too. |
| 03:20 | MisterSinister | Probably. |
| 03:21 | MisterSinister | I need to figure out how to call this thing. |
| 03:21 | MisterSinister | I get it in theory. |
| 03:21 | ambrosebs | like if-let |
| 03:21 | ambrosebs | there's an example on the gist now |
| 03:21 | MisterSinister | OK. |
| 03:22 | MisterSinister | Ah, I see now. |
| 03:22 | MisterSinister | Awesome. |
| 03:23 | MisterSinister | Thanks! |
| 03:27 | MisterSinister | Is there a macro that automatically destructures a map whose only keys are symbols (i.e. a record) and binds to the non-symbol equivalents of each key? |
| 03:28 | MisterSinister | For instance, if I had {:foo "a" :bar "b} |
| 03:28 | callen | MisterSinister: bravo on coming up with something I haven't seen requested before |
| 03:28 | MisterSinister | It would expand into {:keys [foo bar]} |
| 03:28 | callen | seriously, bravo. |
| 03:28 | MisterSinister | callen: Are you being sarcastic? |
| 03:28 | callen | MisterSinister: do you want this for fn arg destructuring? |
| 03:28 | callen | no, very sincere. initially. |
| 03:28 | callen | the initial problem statement was unique |
| 03:28 | callen | the final request sounds like it won't be |
| 03:29 | MisterSinister | Yeah, I did want it for function arg destructuring. |
| 03:29 | MisterSinister | But ordinary let destructuring would be nice also. |
| 03:29 | callen | MisterSinister: a few points of order: don't do that. Just pass a map around |
| 03:29 | callen | MisterSinister: you do *not* want implicit symbol injection like that. it makes it impossible to know where the fuck they came from. |
| 03:29 | MisterSinister | I see. |
| 03:29 | callen | also, the macro can't possibly know what keys are in the map |
| 03:29 | callen | the map doesn't exist at compile-time, ya dig? |
| 03:30 | MisterSinister | Yeah, I dig. |
| 03:30 | MisterSinister | Oh well. |
| 03:30 | callen | instead, I will (apply hash-map rest) where the fn restructuring is [arg1 arg2 & rest] |
| 03:30 | callen | and rest is something like [:a 1 :b 2] |
| 03:31 | callen | MisterSinister: avoid unnecessary/low-productivity sources of magic. Save the brainpower for solving your actual problem. |
| 03:31 | MisterSinister | callen: Still something I'm learning about, admittedly. |
| 03:31 | maxthoursie | Hi. The style guide says use (:kw object-like-map) for objects and (collection-like-map :kw) for collections. Whats the difference between objects and collections? |
| 03:31 | ambrosebs | [arg1 arg2 & {:as rest}] might be clearer. |
| 03:32 | callen | ahhhh fuck. |
| 03:32 | callen | ambrosebs: just outclassed me. Thanks. |
| 03:32 | ambrosebs | sniped. |
| 03:33 | ambrosebs | xD |
| 03:33 | callen | is there any better drug than happy users? |
| 03:33 | MisterSinister | None whatsoever. |
| 03:33 | MisterSinister | :D |
| 03:33 | callen | I have like 3 users and making them happy is FUNNNNNN |
| 03:33 | MisterSinister | People on here are so nice. |
| 03:33 | callen | MisterSinister: I'm not. the rest are. mostly. |
| 03:33 | ambrosebs | haha |
| 03:33 | maxthoursie | "The style guide" might be vauge, I was refering to http://dev.clojure.org/display/community/Library+Coding+Standards |
| 03:34 | callen | for any who run into it, do not listen to batsov's style guide. |
| 03:35 | maxthoursie | callen: that guide differ on that point |
| 03:35 | maxthoursie | but since I don't understand the library coding stadards, it makes no differnce to me right now |
| 03:35 | maxthoursie | :) |
| 03:35 | MisterSinister | callen: Actually, that was a very nice response. |
| 03:35 | MisterSinister | I never expected that. |
| 03:36 | maxthoursie | (= nice (rest ppl)) |
| 03:36 | MisterSinister | So that makes callen (first ppl). |
| 03:37 | MisterSinister | Also, maxthoursie, wouldn't it be (every? nice? (rest ppl)) |
| 03:37 | MisterSinister | ? |
| 03:37 | maxthoursie | MisterSinister: indeed, was just thinking about it |
| 03:38 | Ember- | I prefer (-> ppl (make-nice) (throw-a-party-with)) |
| 03:38 | callen | Ember-: looks kinda side-effecty |
| 03:38 | MisterSinister | They make new people. |
| 03:38 | callen | Ember-: wouldn't the throw-a-party-with fn create a lot of garbage to collect? |
| 03:38 | MisterSinister | It's referentially transparent. |
| 03:38 | maxthoursie | no fun to party with only new ppl |
| 03:38 | Ember- | callen: sure it would. Good that we have an efficient gc |
| 03:38 | Ember- | I'd like one into my apartment too |
| 03:39 | callen | Ember-: and HotSpot (TM ORACLE TOUCH IT AND WE KILL YOU) |
| 03:39 | Ember- | my wife is doing a decent work but there's always room for improvement |
| 03:39 | callen | my landlord actually pays for cleaners. I have no wife :( |
| 03:39 | callen | I started out that sentence bragging, then saw your comment about your wife :P |
| 03:39 | Ember- | I own the flat I live in and I have a wife |
| 03:39 | Ember- | I have no landlord |
| 03:39 | MisterSinister | Ember-: Some of us are lucky like that. |
| 03:40 | callen | Ember-: I'm young and live in the bay area. I'm not sore about being a renter. Nobody expects me to own land. |
| 03:40 | callen | or a flat. |
| 03:40 | Ember- | hehe |
| 03:40 | Ember- | I live in Helsinki Finland |
| 03:40 | maxthoursie | I think I use a generational gc, I only clean up the young collection, I never get to cleaning it all |
| 03:40 | MisterSinister | I think my brain needs better gc. |
| 03:40 | Ember- | and I'm youngish (31) |
| 03:40 | callen | maxthoursie: I used to have that problem, but I started collecting more often and it fixed the problem. |
| 03:41 | callen | Ember-: I've been a working-coder for 7 years but I'm younger than you. |
| 03:41 | maxthoursie | callen: That's probably exactly what I would need |
| 03:42 | Ember- | callen: I've founded a software company, ran it and sold it |
| 03:42 | Ember- | had 11 ppl working in it when we sold it |
| 03:43 | Ember- | bragging contest(tm) |
| 03:43 | callen | Ember-: I've worked for 3 startups, started one, and joined one as a CTO. No exits/surviving successes yet. Last one was a near miss though. :( |
| 03:43 | MisterSinister | CTO? |
| 03:43 | Ember- | chief technology officer |
| 03:43 | callen | for which the responsibilities vary *wildly* depending on how mature the company is. |
| 03:44 | Ember- | indeed |
| 03:44 | MisterSinister | Ah. |
| 03:44 | MisterSinister | I'm just a grad student. |
| 03:44 | Ember- | in a bit larger company that feller would actually be responsible of technology choices being used in the company |
| 03:44 | MisterSinister | I use Clojure for implementing algorithms I'm working on. |
| 03:45 | Ember- | in a small startup that is just a title |
| 03:45 | callen | a CTO at a startup can be anything from a glorified code monkey, to a PM, to a strategist, to a futurist. |
| 03:45 | Ember- | that guy *will* do *anything* |
| 03:45 | Ember- | CTO in a startup will do sales too |
| 03:45 | Ember- | and maybe even marketing |
| 03:45 | callen | Ember-: I was half PM/cheerleader, half hacker. I implemented the 2nd version of the core algorithm our product was based around, a neuroscientist did the first version. |
| 03:45 | MisterSinister | So CTO = Chief Trouble-solving Officer? |
| 03:46 | callen | Ember-: I've done sales before, but not for that company, only for the company I founded. |
| 03:46 | Ember- | MisterSinister: ha :) |
| 03:46 | callen | MisterSinister: to be fair, the CEO does plenty of problem solving too, just of a different sort typically :) |
| 03:46 | Ember- | callen: oh, you're still continuing on the bragging contest? :) |
| 03:46 | MisterSinister | Or possibly Chief Trick-turning Officer, by the sounds of it. |
| 03:46 | callen | Ember-: more just catharsis. Like I said, last one was a near-miss. Kinda need to talk about it. |
| 03:46 | MisterSinister | Also, holy shit, this code. |
| 03:46 | Ember- | I created a SPA framework back when SPA was pretty much unheard of which gave our product a competetive edge |
| 03:46 | callen | Haven't really had a chance to sit down and talk it out with anybody who would understand. |
| 03:46 | MisterSinister | (if ((comp contains?) (set (keys vertex-map)) u) |
| 03:46 | MisterSinister | yeah.... |
| 03:47 | Ember- | that product had a distributed versioning data model |
| 03:47 | callen | most people who haven't done startups aren't sympathetic at all. |
| 03:47 | Ember- | but lol, this is so stupid |
| 03:47 | Ember- | I actually have some work to do :) |
| 03:47 | MisterSinister | callen: Try me. |
| 03:47 | callen | nah. I need sleep. meeting at 10 am. |
| 03:48 | MisterSinister | This is why I love being at GMT+12. |
| 03:48 | MisterSinister | I exist in everyone else's bedtimes. |
| 03:49 | seancofield | MisterSinister: bedtime is a movable concept :) |
| 03:51 | MisterSinister | seancofield: Depends on your line of work. |
| 03:51 | MisterSinister | What kind of music do you guys like to code to? |
| 03:51 | MisterSinister | I need some. |
| 03:51 | seancofield | I work from home full time and my team is spread across several timezones... |
| 03:51 | MisterSinister | seancofield: So your concept of 'bedtime' is 'whenever i can find an hour'. |
| 03:52 | seancofield | if i had my way, i'd sleep 'til noon and work 'til midnight :) |
| 03:53 | MisterSinister | Likewise. Unfortunately, I have to teach classes, and they start rather too early for my liking. |
| 03:53 | callen | seancofield: I have psychotic coworkers who think meetings before lunch time is anything other than torture, so I can't do that :( |
| 03:53 | callen | (I exaggerate for dramatic effect, I love my coworkers. Srsly.) |
| 03:53 | seancofield | I did some traning today... fortunately the client was in Australia so it was 8-10pm for me :) |
| 03:54 | callen | seancofield: I taught some Clojure today! also where's your r? |
| 03:54 | callen | did you change from corfield to a mathematical topology? |
| 03:54 | MisterSinister | callen: Yay for you teaching Clojure! I wish I could. |
| 03:54 | seancofield | lol... i clearly couldn't type when i signed in on my other machine! |
| 03:55 | callen | seancorfield`: you should just use a persistent IRC session. |
| 03:56 | seancorfield | better? :) |
| 03:56 | seancorfield | teaching clojure is good :) |
| 03:56 | callen | yes but you should eliminate the schelp altogether with a persistent IRC session. |
| 03:56 | callen | schlep* |
| 03:56 | seancorfield | callen: it's complicated :) |
| 03:57 | callen | persistent IRC sessions aren't complicated :( |
| 03:57 | callen | you use ZNC or GNU Screen. |
| 04:04 | seancorfield | windows... |
| 04:04 | callen | seancorfield: you can still do it. |
| 04:05 | callen | seancorfield: i will even halp :) |
| 04:05 | seancorfield | i like the setup i have... i use erc in emacs for IRC |
| 04:05 | ucb | seancorfield: you could bounce via znc |
| 04:06 | callen | which is my point |
| 04:06 | ucb | oh, it's been suggested already :) |
| 04:06 | callen | seancorfield: you can use any client you want :) |
| 04:07 | callen | ucb: hi! |
| 04:07 | ucb | callen: ! |
| 04:07 | ucb | callen: colloquy doesn't play nice with ZNC mind you |
| 04:07 | ucb | there's a znc thing for ERC though |
| 04:07 | ucb | I used it for a while |
| 04:10 | ucb | callen: how you? |
| 04:11 | callen | been absurdly ill and fighting to meet a deadline |
| 04:12 | ucb | not a great combination |
| 04:12 | callen | never taken as good care of myself while sick as I have at this job while sick. |
| 04:12 | ucb | so that's a good thing then |
| 04:12 | callen | I have to basically defend the use of Clojure and Datomic for a project in front of most of the engineers at my company in two days and I can barely speak. |
| 04:13 | ucb | do it mime style with plenty memes on every slide -_- |
| 04:13 | callen | I'm probably going to set some ground-rules before beginning the talk. |
| 04:13 | callen | ucb: considering that option :P |
| 04:13 | ucb | heh |
| 05:29 | glosoli | hmm how can one do OR in query using clojure.jdbc |
| 05:29 | glosoli | ? |
| 05:29 | glosoli | clojure.java.jdbc" |
| 06:00 | TEttinger | congrats Clojure! You're the #1 Lisp dialect since january 1st 2013 in terms of projects created on github. Unless you have an odd definition of what is lisp. |
| 06:01 | TEttinger | https://dl.dropboxusercontent.com/u/11914692/LanguageStats.txt got this off the Github API today |
| 06:01 | TEttinger | behind prolog because github thinks PDF files are prolog source |
| 06:04 | ambrosebs | kaw: did you figure out how to provide arguments to reduce with core.typed? |
| 06:06 | kaw | ambrosebs: No, I think I could still use some help with it.. but I looked at the example project and got a little further |
| 06:07 | ambrosebs | kaw: FYI there's also #typed-clojure |
| 06:07 | kaw | I can't look at it in detail now because I'm at work and it wasn't a work project, but is there a simple solution? |
| 06:07 | kaw | Aha, might look into that |
| 06:08 | ambrosebs | kaw: what was the problem again? |
| 06:08 | kaw | Well, when you pass a non-empty sequence to map you get a non-empty sequence back out |
| 06:08 | ambrosebs | and you're passing that to reduce? |
| 06:08 | ambrosebs | as the 3rd arg? |
| 06:08 | kaw | Yeah |
| 06:09 | kaw | Which I don't think should be a type error if I can guarantee that the original sequence isn't empty? |
| 06:10 | ambrosebs | You should be hitting this funciton type of reduce: [[a c -> a] a (Option (Seqable c)) -> a] |
| 06:10 | ambrosebs | that's the most general one. |
| 06:10 | ambrosebs | it doesn't expect a non-empty seqable. |
| 06:11 | ambrosebs | So I suspect the error is somewhere else in the call to reduce. |
| 06:11 | ambrosebs | Did you get a big polymorphic error from reduce? |
| 06:12 | kaw | Hmm |
| 06:12 | kaw | Well, can't remember the details now, but it was the two-argument reduce, not the three-argument one (was mistaken saying it was the third arg, sorry) |
| 06:12 | ambrosebs | ah ok. |
| 06:12 | kaw | Not sure if that would influence anything |
| 06:13 | kaw | But my core problem was that map didn't seem to preserve nonemptiness |
| 06:13 | kaw | My code would have broken if the sequence was empty, but I could guarantee that it wasn't empty |
| 06:14 | ambrosebs | a quick way to cast to nonempty is (let [s (map ...) _ (assert (seq s))] (reduce ... s)) |
| 06:14 | ambrosebs | map isn't accurate enough yet to figure that out. |
| 06:15 | kaw | Hm, okay |
| 06:15 | kaw | I guess I'd like to keep the typed stuff at the top level as much as possible |
| 06:16 | ambrosebs | kaw: as in, you don't mind the assertion? |
| 06:16 | ambrosebs | or you'll skip checking that function? |
| 06:17 | kaw | Well, maybe I'll add it if it's the only way.. depends on how many such things I have to change all over my project |
| 06:18 | kaw | Maybe skipping the tricky functions would be an option, I haven't really looked into skipping yet |
| 06:18 | ambrosebs | kaw: map could be made more accurate. I'll have a look. |
| 06:19 | kaw | But I guess I can see that just preserving nonemptiness would be a bit hackish |
| 06:19 | kaw | Since there's actually much more that it preserves |
| 06:19 | ambrosebs | kaw: Maybe not, because a lot of functions have different behaviour based on emptiness. |
| 06:20 | ambrosebs | it may be worth adding. |
| 06:20 | kaw | True |
| 06:20 | kaw | But I mean, I can see how it would be a challenging function to type |
| 06:21 | ambrosebs | kaw: it would have to be hard-coded in general, but I think an arity [[a -> b] (NonEmptySeqable a) -> (NonEmptyLazySeq a)] would be useful. |
| 06:21 | ambrosebs | that wouldn't need hard coding. |
| 06:21 | ambrosebs | perhaps even for variable arguments of non-empty seqables. |
| 06:30 | ambrosebs | kaw: (cf (map inc [1 2 3])) => (NonEmptyLazySeq AnyInteger) |
| 06:30 | ambrosebs | works well |
| 06:31 | ambrosebs | shall push a release for you to play with. |
| 06:32 | kaw | Wow, thanks, I'll look into it when I get home |
| 06:33 | kaw | Good to have the project dev so easily accessible |
| 06:38 | ambrosebs | kaw: Try 0.2.5-20130910.101144-9 |
| 06:38 | ambrosebs | repository info for snapshots is in README |
| 06:59 | Fender | hi there, I have a question: I deploy my JAR (created with lein jar) manually to a server and I want to fetch all the dependencies over there, what is the program I need? |
| 07:00 | Fender | I suppose it is maven / leiningen, however, the question seems so basic that it's hard to find something about it |
| 07:02 | Fender | of course I dont want to pull all my source on the cloud server and run "lein deps" over there |
| 07:03 | hyPiRion | Fender: would it be viable to do `lein uberjar` instead, and deploy that jar? |
| 07:03 | Fender | hmm, this is how I do it right now |
| 07:04 | Fender | but I hate to upload all the complete uberjar after just fixing a minor error in my source |
| 07:05 | hyPiRion | Then I'd just use git and push the source code up, and pull it from the server |
| 07:05 | hyPiRion | *on the server |
| 07:05 | Fender | hmm, this is also not the "clean solution" |
| 07:06 | Fender | I thought the whole thing about maven is to just run one command and it automatically fetches all JAR dependencies |
| 07:06 | hyPiRion | yes? |
| 07:07 | clojurebot | yes isn't is |
| 07:07 | Fender | I mean if lein does such a great job why shouldnt there be something as simple as a jar dependency fetcher |
| 07:08 | Fender | however, it is hard to find anything useful if you google for "maven jar fetch dependencies" |
| 07:08 | Fender | and lein in the query doesnt really help either |
| 07:08 | justin_smith | mvn deps? |
| 07:09 | Fender | hmm, let me check |
| 07:11 | justin_smith | well there is no mvn deps command, I wonder what 'lein deps' runs |
| 07:11 | Fender | hmm, didnt find anything either |
| 07:11 | supersym | :refer-clojure excludes from the core namespace, but how to exclude the other ns functions? :exclude on the required coords doesn't seem to work (anymore)? |
| 07:12 | Fender | I'd like "X deps myjar.jar" that downloads myjars deps, the question is "what is X?" |
| 07:13 | Fender | why is project.clj and pom.xml in the jar if not for this very purpose? |
| 07:13 | justin_smith | mvn dependency:get |
| 07:14 | justin_smith | figures the java version is more verbose |
| 07:15 | supersym | ok nvm, this is definitly due to LT |
| 07:17 | Fender | alternatively, a "lein deps" on a jar would be even nicer |
| 07:17 | Fender | supersym, I dont understand what you mean with coords |
| 07:18 | supersym | (require '[some.lib :excludes [some-func]) |
| 07:18 | supersym | I guess not coordinates,...those are the vectors in :dependencies |
| 07:19 | justin_smith | is it :exclude or :excludes? |
| 07:19 | Fender | do you need this when you require it? this IMO makes much more sense when you 'use the dependency |
| 07:19 | Fender | ok, afk |
| 07:19 | supersym | Fender: yeah I've been hardly using 'use but for a few of those cases perhaps :) |
| 07:19 | ambrosebs | ,refer |
| 07:19 | clojurebot | #<core$refer clojure.core$refer@1dfe879> |
| 07:20 | ambrosebs | ,(doc refer) |
| 07:20 | clojurebot | "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to somethin... |
| 07:20 | clgv | vision for JDK 10+: "No more primitives, make everything objects" |
| 07:20 | ambrosebs | supersym: (:refer some.lib :exclude [some-func]) I think |
| 07:20 | supersym | my mistake, I had it correct here |
| 07:21 | clgv | interesting statement. since I do not think they want to sacrifice performance for numerical computations, the goal is probably to have efficient numeric objects |
| 07:21 | supersym | ambrosebs: right, thanks |
| 07:22 | justin_smith | clgv: maybe packed up numerics, all ready for simd |
| 07:22 | justin_smith | standardized groups of 128 or whatever |
| 07:23 | clgv | well wont happen before 2017 anyway and most likely later... |
| 07:48 | Fender | if efficient "primitive objects" were possible, I think they would have gone in that direction a long time ago |
| 08:19 | ivan | JVMLS 2013 for your youtube-dl needs https://www.refheap.com/66950723e1aa930701728f696/raw |
| 08:34 | clgv | Fender: well, but do you think they will sacrifice performance for numerical computation? |
| 08:53 | Fender | clgv: No, that would be also "stupid" :) Then again, Oracle isnt exactly known for its wise decisions wrt Java in the last years |
| 08:53 | Fender | frankly, I have no clue why they'd do that |
| 08:53 | Fender | afaik, the Java "deciders" are as efficient as a committee", i.e. not |
| 09:57 | ljos | Anyone know of any resources on using clojurescript in phantomjs? |
| 10:03 | ljos | I am especially wondering how to do the /require/ part as it seems like from the examples that phantomjs uses requirejs to do that that. |
| 10:12 | jjttjj` | Hmm not sure where I should even ask this, but how do I properly escape a string that contains quotes that's being sent within clojure code to nrepl in elisp |
| 10:12 | jjttjj` | https://www.refheap.com/18505 |
| 10:13 | jjttjj` | Where the string being upper-cased has a quote in it |
| 10:14 | jjttjj` | (just using upper-case as an example fn here, that's not what i'm trying to accomplish) |
| 10:15 | wakeup | hi all |
| 10:16 | jjttjj` | hello wakeup |
| 10:17 | wakeup | Am I right to assume that [org.clojure/java.jdbc "0.3.0-alpha4"] is what is currently recommended to work with SQL databases? |
| 10:17 | wakeup | and further more what do I have to do to get the SQLite driver loaded? |
| 10:17 | wakeup | I get a SQLException No suitable driver found for jdbc:sqlite:... |
| 10:18 | jjttjj` | Have you seen the githup page? https://github.com/clojure/java.jdbc |
| 10:18 | coventry` | jjttjj: String manipulation is a pain in elisp. This may get you started. Not sure it's the best way, given that you'll be looking for multiple quotes, some of which may already be escaped. (let ((target "bar \"foo\"")) (string-match "\"" target) (replace-match "\\\\\"" nil nil target)) |
| 10:18 | ljos | wakeup: I used https://github.com/korma/Korma the last time I was doing sqlite work in clojure. |
| 10:18 | wakeup | jjttjj`: thanks I should have scroleld down more |
| 10:19 | wakeup | ljos: I will go with plain param. queries since my use case is very simple |
| 10:20 | jjttjj` | coventry`: cool thanks gonna stare at that until it makes sense :) |
| 10:22 | coventry` | C-h i d m elisp <RET> i string-match <RET> |
| 10:24 | jjttjj` | coventry`: cool |
| 10:26 | wakeup | "SQLException query does not return results" Why would it I do a CREATE? |
| 10:28 | wakeup | is there a version of jdbc/query that doesn't expect a result? |
| 10:35 | jkkramer | wakeup: clojure.java.jdbc/execute! |
| 10:39 | wakeup | jkkramer: using DB-DO-COMMANDS now, thank you anyways |
| 10:49 | ambrosebs | ,(doc *file*) |
| 10:49 | clojurebot | "; The path of the file being evaluated, as a String. Evaluates to nil when there is no file, eg. in the REPL." |
| 10:49 | ambrosebs | is *file* usually relative or absolute? |
| 10:50 | wakeup | Oh yes this is fun... |
| 10:50 | pepijndevos | ,*file* |
| 10:50 | clojurebot | "NO_SOURCE_PATH" |
| 10:51 | wakeup | SIGSEGV (0xb) at pc=0xb6f0abed, pid=6859, tid=2675309376 |
| 10:51 | wakeup | My JRE segfaults when I do a jdbc/query |
| 10:51 | wakeup | while doing some kind of get unicode char thing |
| 10:51 | ToxicFrog | Awesome |
| 10:54 | wakeup | (jdbc/query spec "INSERT INTO store(key, value) VALUES(?, ?)" key value) |
| 10:54 | squidz | cemerick: I'm trying to use clojurescript.test, but I keep running into the following error: TypeError: Undefined is not an Object (evaluating 'Function.prototype.bind.apply') |
| 10:54 | wakeup | any ideas what I am doing wrong? (key and value are strings) |
| 10:55 | squidz | has anybody come across this before? here is my project.clj, plus the full error --> https://www.refheap.com/18507 |
| 10:56 | Bronsa | ambrosebs: *file* should be absolute |
| 10:56 | ambrosebs | Bronsa: thanks. |
| 10:56 | cemerick | squidz: no idea what that is. Looks more like an app- or library-level problem? |
| 10:57 | cemerick | or maybe you're trying to use some JS API that phantom doesn't support? |
| 10:57 | jkkramer | wakeup: what db? are you using the latest driver? are you sure the JRE and db are set up for utf-8 correctly? |
| 10:57 | squidz | cemerick: yeah, I get the same problem with specljs, and when I was playing around with that, starting a new project seemed work fine. Just when I'm trying to use phantomjs with my already existing code seems to freak it out |
| 10:58 | cemerick | squidz: have you gone and looked to see what's going on at the specified line number in the generated js? |
| 10:59 | justin_smith | wakeup: what db? a coworker discoverd utf8 table name bugs in postgres that are still outstanding |
| 10:59 | wakeup | jkkramer: sqlite, org.xerial/sqlite-jdbc "3.7.2", how do I check? |
| 10:59 | squidz | cemerick: yeah this is being called: (js/Function.prototype.bind.apply orig-fn nargs) |
| 11:00 | ciphergoth | is this the right place to talk about ring? I have an idea on how ring could be extended to make my life better :) |
| 11:00 | wei_ | how do you test compojure routes with sessions? specifically with sandbar stateful sessions, if anyone's using that |
| 11:01 | ciphergoth | I'm looking at the method "set-body" in ring-servlet. It tests if :body is a string, a seq, an InputStream or a File, and writes the body to the servlet output stream in each case |
| 11:01 | wakeup | jkkramer: could you try to reproduce if I gave you a minimal gist? |
| 11:01 | jkkramer | wakeup: does (System/getProperty "file.encoding") say utf8? |
| 11:02 | ciphergoth | https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L81 |
| 11:02 | jkkramer | wakeup: not at the moment, have to get back to work. guessing it's a problem with sqlite driver or something. google shows some results for "java sqlite segfault" |
| 11:02 | ciphergoth | it would be neat if it had a clause that read (fn? body) (body (.getOutputStream response)) |
| 11:02 | wakeup | jkkramer: yes it does |
| 11:02 | squidz | cemerick: I tried setting it up on windows and linux and I get the same error. Phantomjs may be to blame |
| 11:03 | cemerick | squidz: do the tests in question work under e.g. chrome or firefox? |
| 11:05 | gfredericks | I think I am opposed to macros that just wrap things in (var) |
| 11:05 | squidz | cemerick: I haven't tried. Can I call one of clojurescript.tests run functions from the console? if so which one? |
| 11:07 | cemerick | squidz: all of the test-* fns work under any suitable cljs REPL |
| 11:10 | squidz | cemerick: it seems to work. It returns cljs.core.PersistentArrayMap {} after running run-all-tests in the console. I think it may be related to this: https://github.com/ariya/phantomjs/issues/10522 |
| 11:10 | sm0ke | Hello why is this giving stream closed error? (with-open [rdr (reader "src/examples/utils.clj")] (take 2 (line-seq rdr))) |
| 11:11 | llasram | sm0ke: Lazy evaluation |
| 11:11 | llasram | sm0ke: Well, lazy sequences |
| 11:11 | sm0ke | aha |
| 11:11 | cemerick | squidz: heh, yeah, that'll do it |
| 11:11 | sm0ke | doall? |
| 11:12 | llasram | sm0ke: That's what it's there for :-) |
| 11:13 | cemerick | squidz: you could try getting slimerjs to work with clojurescript.test? Looks like it's easy to do, and might give you relief from the phantom issue? https://github.com/cemerick/clojurescript.test/issues/10 |
| 11:13 | cemerick | 'course, slimerjs might have the same problem (or a whole different set of them) |
| 11:13 | sm0ke | hmm ... hey are you the one with abracad repo? |
| 11:13 | sm0ke | i am using it..thanks for open sourcing |
| 11:13 | llasram | sm0ke: Oh, yep. That's me. |
| 11:13 | llasram | sm0ke: Oh! Awesome |
| 11:14 | squidz | hm yeah it may. I read that adding this function seems to do the job, but i'm not sure where would be a good place to put it https://github.com/c9/smith/blob/master/tests/public/test.js#L2-L7 |
| 11:15 | squidz | maybe in my runner.js |
| 11:16 | squidz | adding it seemed to change nothing :/ maybe I just have to give slimerjs another shot, but IIRC it didn't work/had the same problem when I tried last time |
| 11:18 | cemerick | squidz: that code would need to be added to your generated test js, not in the runner. You can just transliterate it to ClojureScript if you want, and include it in your codebase (with suitable guards to not overwrite an existing bind impl.) |
| 11:18 | sm0ke | hello i am new to clojure , is actor based concurrency encouraged in clojure? If yes what libraries are most common ? |
| 11:19 | dnolen | sm0ke: not encouraged, though I'm sure there are proponents, also there's core.async which gives you CSP. |
| 11:20 | squidz | cemerick: is there an easy way of adding it to my compiled js without translating it to clojurescript to compile it? |
| 11:20 | cemerick | squidz: :libs or :foreign-libs...but, it's only 5 lines... |
| 11:20 | sm0ke | thanks |
| 11:21 | squidz | cemerick: after pasting it into the head of my compiled js it seems to be working now. Thanks |
| 11:22 | tbaldridge | sm0ke: actors couple concurrency, state management, and processes all together in a single "thing" that can't be decoupled. In core.async, we have queues for concurrency, go blocks for processes, and atoms/refs for state management. |
| 11:22 | tbaldridge | sm0ke: this allows you to create stateless queue processors, or processes that share a single mutable state for instance |
| 11:23 | sm0ke | tbaldridge: isnt single mutable instance bad? |
| 11:23 | sm0ke | state* |
| 11:23 | tbaldridge | sm0ke: "power through pulling things apart" is probably a motto of the Clojure community. |
| 11:24 | tbaldridge | sm0ke: Clojure provides primitives for allowing safe mutating of shared references, but yes, in general we should avoid state, but no matter what you do, you'll always have "mutable state". |
| 11:24 | tbaldridge | sm0ke: notice how Erlang users like to say "no mutable state". They still have it, it's just hidden as the arguments to the function that processes the next message. |
| 11:24 | mdrogalis | I'd get a kick if you guys renamed core.async to "actresses". |
| 11:25 | sm0ke | ok one more thing? actors libraries if propery designed run several thousand actors on a sigle thread? how is this in clojure core.async? |
| 11:25 | mdrogalis | sm0ke: go blocks are extremely light weight. |
| 11:26 | sm0ke | is go blocks something similar to golang channels? sorry i am very new to the scene! |
| 11:26 | tbaldridge | sm0ke: we can do that as well, go processes can be as light as a few hundred bytes (or less). And they do not map 1:1 to threads. |
| 11:27 | tbaldridge | sm0ke: yes, core.async is basically a implementation of many of Go's channel features on Clojure (and the JVM). |
| 11:27 | tbaldridge | sm0ke: good way to get started, https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj |
| 11:28 | sm0ke | thanks guys! i am enjoying learning clojure! |
| 11:28 | tbaldridge | sm0ke: awesome! |
| 11:28 | mdrogalis | :) |
| 11:29 | sm0ke | also since we are at it? do we have a high performance rest server already written? |
| 11:29 | fredyr | go blocks are similar to goroutines, isn't it? |
| 11:29 | sm0ke | :) |
| 11:30 | tbaldridge | fredyr: close, I'm not exactly sure how Go's goroutines are implemented, but they should be similar |
| 11:30 | fredyr | right |
| 11:30 | mdrogalis | tbaldridge: You recall the code review I sent you about buffered, spatial aware queues? |
| 11:31 | tbaldridge | mdrogalis: yes |
| 11:31 | mdrogalis | tbaldridge: I took your approach through the entire simulation. It's getting close to finished. That bit of code is 1/4 it's original size, 1x times faster, and testable. |
| 11:32 | mdrogalis | 1 thousand x faster* ^ |
| 11:32 | tbaldridge | mdrogalis: nice! |
| 11:32 | mdrogalis | Blew my mind man. |
| 11:33 | sm0ke | hmm http-kit and compjure seemsto be doing pretty well http://www.techempower.com/benchmarks/#section=data-r6&hw=i7&test=json |
| 11:34 | mdrogalis | Is there any reason to use reducers over pmap when the latter works okay? |
| 11:34 | tbaldridge | sm0ke: yes, look into compojure and ring, and then those two run on a bunch of JVM servers. |
| 11:35 | tbaldridge | mdrogalis: it really depends on the task, pmap will convert a vector to a seq. Reducers will keep it as a vector, and since the structure of vectors is basically a tree, reducers will allocate a thread to each branch. |
| 11:36 | tbaldridge | mdrogalis: so pmap will try to allocate a thread to each item (up to a max number of threads). reducers will allocate a thread to each branch (up to a max). pmap processes in order, reducers will process in whatever order offers the best performance. |
| 11:36 | tbaldridge | mdrogalis: so reducers can be faster when you don't have side effects in the code. |
| 11:39 | rkneufeld | mdrogalis: reducers do also let you compose transformations in a pretty nifty way (completely separate from how it is executed) |
| 11:40 | mdrogalis | tbaldridge: Ahh, thanks. That's a useful bit of knowledge. :) |
| 11:40 | mdrogalis | rkneufeld: Yeah, you know I've been using reducers since it came out and I still don't *really* understand how it does that. |
| 11:44 | tbaldridge | mdrogalis: so there are two aspects of this. What rkneufeld mentioned is that you can chain a bunch of functions together that won't end up creating tons of LazySeq allocations that are simply thrown away. |
| 11:45 | tbaldridge | mdrogalis: consider this (-> (range 1000) (map inc) (map dec)), here we have to create cons cells in between each map. With reducers these allocations don't happen. Read Rich's reducers blogs for more info there. |
| 11:45 | tbaldridge | mdrogalis: the other side is the fork/join stuff I was talking about. This talk goes into details on that: http://www.youtube.com/watch?v=ZampUP6PdQA |
| 11:46 | wakeup | Can someone try to run (segv) from this paste http://paste.lisp.org/display/138889 ? On my machine it segfaults the jre! |
| 11:46 | tbaldridge | Not about reducers, but these ideas are the same ones that reducers use |
| 11:46 | wakeup | I want to know if others can reproduce this? |
| 11:46 | wakeup | You need clojure.java.jdbc and an jdbc sqlite backend |
| 11:47 | wakeup | Oh and this will touch /tmp/sqlite-seegv ! |
| 11:48 | wakeup | All help would be much appreciated! |
| 11:48 | nDuff | wakeup: Including a project.clj for the dependencies you used wouldn't hurt. |
| 11:49 | tbaldridge | wakeup: looking at the clojure jdbc docs I'm not sure that your query syntax is right: "Given a database connection and a vector containing SQL and optional parameters," |
| 11:49 | tbaldridge | Your query and params are not in a vector |
| 11:50 | wakeup | hmm |
| 11:50 | wakeup | you're right |
| 11:50 | wakeup | still shouldn't segfault but I'll try |
| 11:52 | mdrogalis | tbaldridge: I've read the reducers post a bunch of times. It's still hard for me to understand. |
| 11:53 | mdrogalis | Fortunately, I guess I dont have to in this case. Using it is very easy |
| 11:58 | tbaldridge | wakeup: agreed, but I don't think that input is being validated, so it's probably crashing something deep down in the jdbc drivers |
| 12:22 | sdegutis | Phew. |
| 12:29 | sdegutis | Hey guys wanna see my new Clojure website? |
| 12:29 | sdegutis | Just deployed. |
| 12:30 | ambrosebs | sdegutis: sure! |
| 12:36 | gfredericks | (defmacro as->>> [args] `(as->> ~(last args) ~@(butlast args))) |
| 12:46 | sdegutis | gfredericks: Do you mean as->>> in the definition? |
| 12:56 | gfredericks | sdegutis: no |
| 12:58 | sdegutis | gfredericks: Oh you must be using C 1.6 |
| 12:58 | sdegutis | Clojure 1.6 |
| 12:59 | TimMc | sdegutis: Such a tease. |
| 13:00 | lgs32a | is anybody here going to hack through the clojure cup? |
| 13:00 | sdegutis | lgs32a: I'm terrible at those. |
| 13:01 | jjttjj` | I'm gonna try it, I'm also probably going to do terrible and never submit anything though |
| 13:01 | sdegutis | Also some Rubyists are on the judge panel and I'm not super comfortable with them judging my Clojure code. |
| 13:02 | lgs32a | I consider doing a chess-web-app |
| 13:02 | lgs32a | but i think it would be nice to work on it as two people |
| 13:03 | lgs32a | client-side could be done using something like raphel on js and pedestal |
| 13:03 | lgs32a | server side clojure |
| 13:04 | lgs32a | also pedestal service |
| 13:07 | sdegutis | I'm not sure I understand what Pedestal offers. |
| 13:08 | lgs32a | its basically a bunch of libraries like domina, enlive packed together |
| 13:08 | lgs32a | partly offering wrappers, mainly to enhance functionality |
| 13:08 | lgs32a | then it gives you this "development server" |
| 13:08 | nDuff | ...well, the dataflow model is the big thing. |
| 13:08 | tbaldridge | sdegutis: and a very opinionated view of how state should be handled when it comes to a UI |
| 13:08 | sdegutis | nDuff: Oh? |
| 13:08 | lgs32a | yes the dataflow model |
| 13:09 | sdegutis | tbaldridge: Yeah the one thing that stuck out to me was it constantly swapped a giant ref at each event received. |
| 13:09 | lgs32a | whats wrong with that? |
| 13:09 | tbaldridge | sdegutis: the gist is this, implement your app state as a database, then run a dataflow over that to generate a list of changes to the ui. |
| 13:09 | tbaldridge | sdegutis: yep, transactional UIs |
| 13:09 | sdegutis | tbaldridge: Hmm. |
| 13:14 | lgs32a | but its not just the ui |
| 13:14 | lgs32a | also the complete state of the client is in that dataflow model |
| 13:15 | lgs32a | i recently wrote a small chat-app with that and i must say that it ends up in very little code at all |
| 13:15 | tbaldridge | lgs32a: well yes, client side apps are mostly UI, but I get your point. |
| 13:15 | sdegutis | Sounds like Rails. |
| 13:15 | lgs32a | the events can be recorded and replayed |
| 13:15 | tbaldridge | sdegutis: how on earth is that? |
| 13:15 | sdegutis | tbaldridge: in that I don't fully understand it :) |
| 13:16 | sdegutis | And that it sounds very scary. |
| 13:18 | xeqi | tbaldridge: can you reprogram the dataflow in the repl? |
| 13:18 | tbaldridge | xeqi: that I'm not sure, I do know that it's data-driven, so maybe? |
| 13:19 | xeqi | heh, gotta find the hooks into the system implementing the dataflow |
| 13:21 | loliveira | hi folks! can somebody please tell me why I can't get the whole body's text? If I change from [:body] to [:p] works, but I can't do that. https://www.refheap.com/18508 I'm using enlive and clj-http. |
| 13:21 | llambda | with clojure.test, what's the best way to test if a certain input causes an expected assertion error? |
| 13:22 | dakrone | loliveira: do you perhaps need to use `:body` to pull the body out after the http/get? |
| 13:22 | xeqi | llambda: (is (thrown? ErrorType ...)) |
| 13:22 | llambda | thank you :) |
| 13:23 | xeqi | llambda: or (is (thrown-with-msg? Type regex ...)) if you want to get more specific |
| 13:25 | loliveira | dakrone: You nailed it. thank you! =) |
| 13:26 | dakrone | loliveira: :) |
| 13:28 | tbaldridge | bbloom: more bedside reading: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf |
| 13:29 | bbloom | tbaldridge: yeah, read that one too. I was greatly amused by the use of Typable |
| 13:29 | bbloom | Typeable* |
| 13:33 | mdrogalis | bbloom & tbaldridge: Looks dense |
| 13:34 | mdrogalis | (to me) |
| 13:35 | bbloom | mdrogalis: it is. |
| 13:35 | bbloom | mdrogalis: http://math.andrej.com/wp-content/uploads/2012/03/eff.pdf is much more approachable |
| 13:35 | tbaldridge | mdrogalis: but it's on my favorite subject, killing monads >:-) |
| 13:36 | mdrogalis | tbaldridge: Can you sum up your objection in 1-2 sentences? |
| 13:36 | mdrogalis | Thanks bbloom :) |
| 13:36 | bbloom | mdrogalis: they don't compose. |
| 13:36 | mdrogalis | Heh, palatable statement. Got'cha. |
| 13:36 | xeqi | but, but, monad tranformers :p |
| 13:37 | bbloom | xeqi: ok, they compose poorly |
| 13:37 | tbaldridge | mdrogalis: memory allocation, poor composition |
| 13:37 | xeqi | oh, oh, how bout those error messages |
| 13:39 | bbloom | tbaldridge: so about types & optimizing effects.... |
| 13:39 | bbloom | tbaldridge: my understanding is that you basically have to do abstract interpretation instead of traditional type checking (ie logic solving) |
| 13:40 | boblarrick | I'm working on adding type hints to my program and wondering how to fix something like "Reflection warning, syncro/core.clj:77:16 - call to com.aerospike.client.Bin ctor can't be resolved." ? |
| 13:40 | bbloom | tbaldridge: what you do is you sub out top-level resources w/ non-resourceful handlers & then record all effect operations |
| 13:40 | bbloom | tbaldridge: you can then basically do algebra on that log |
| 13:40 | mdrogalis | boblarrick: http://clojuredocs.org/clojure_core/clojure.core/*warn-on-reflection* |
| 13:41 | pierre1 | oreos |
| 13:42 | bbloom | tbaldridge: so for example if you have a mutable cell and you see 3 sets in a row, you can throw out 2 :-) |
| 13:43 | tbaldridge | bbloom: as long as the mutable cell isn't being read by another thread :-) |
| 13:45 | bbloom | tbaldridge: but you can prove it isn't if it's bound by a handler in the dynamic extent |
| 13:48 | mdrogalis | I know ZooKeeper versions data on the znodes.. Does anyone know how to actually see the data changes across versions of a znode? Can't find it in the docs anywhere. |
| 13:49 | mdrogalis | Oh, lovely. They have a channel. |
| 13:53 | boblarrick | mdrogalis: Yeah I have warn-on-reflection on, but I don't know what kind of type hint to add to my program to resolve the warning pasted above. How to add a type hint to a call to a java interop constructor? |
| 13:54 | coventry` | What should I do to make clojure a lein project so that I can put it under another directory's checkouts/ dir? I want to access clojure's unit tests in clojure-test, and make sure that I am using the same version of clojure that the tests are coming from. |
| 13:55 | mdrogalis | boblarrick: Ah, I understand. Sorry, I'm not sure how to help. :/ |
| 13:59 | sdegutis | For my next magic trick, I'll be making this website way faster by replacing MongoDB with Datomic. |
| 14:00 | xeqi | sdegutis: can you make if faster by making it static? |
| 14:00 | sdegutis | xeqi: Nope. |
| 14:01 | sdegutis | xeqi: I already used up that trick on the github-wiki version of clojuredocs.org |
| 14:01 | sdegutis | re https://github.com/sdegutis/clojuredocs/wiki |
| 14:05 | scriptor | quick and dumb question, but it's not possible to modify existing protocols by adding new functions, right? |
| 14:06 | SegFaultAX | sdegutis: The source for your clojuredocs thing is insane. |
| 14:06 | sdegutis | SegFaultAX: sorry :( |
| 14:07 | sdegutis | SegFaultAX: Wait, what do you mean by insane? |
| 14:07 | SegFaultAX | sdegutis: A nightmare. |
| 14:07 | sdegutis | SegFaultAX: ok yeah, sorry :( |
| 14:07 | SegFaultAX | sdegutis: I think it's a neat project, but you should definitely clean it up. |
| 14:07 | llasram | ~gentleman |
| 14:07 | sdegutis | SegFaultAX: I hacked it up as a proof-of-concept the other night. |
| 14:07 | clojurebot | Huh? |
| 14:08 | llasram | Ahh |
| 14:08 | llasram | ~gentlemen |
| 14:08 | clojurebot | You can't fight in here. This is the war room. |
| 14:08 | llasram | There we go |
| 14:08 | SegFaultAX | Heh |
| 14:08 | SegFaultAX | sdegutis: You can easily improve it. |
| 14:08 | sdegutis | SegFaultAX: It doesn't make sense to clean it up until the community generally agrees that it's a good direction to move in. |
| 14:08 | SegFaultAX | sdegutis: That's not really how it works. |
| 14:09 | llasram | scriptor: No, but you don't need to, and probably wouldn't be that helpful if you could. You can always just provide a new parallel protocol. Which as a side-benefit you can actually implement separately |
| 14:09 | sdegutis | SegFaultAX: It's kind of dumb to have 2 versions of clojuredocs running about, because the examples will be spread between two places. So if the community prefers the original, then this one should die. |
| 14:09 | scriptor | yeah, that's what I assumed |
| 14:09 | SegFaultAX | sdegutis: You need to put some effort behind it to show that your thing is actually viable before people will even consider adopting it. |
| 14:09 | scriptor | it'd probably be a nightmare to retroactively add the implementation for all types and records that support the protocol |
| 14:09 | SegFaultAX | sdegutis: Naw, I think the root idea is pretty cool. |
| 14:09 | sdegutis | SegFaultAX: Oh I think I see the confusion. That source file is only the initial seeder, and it isn't necessary anymore since it was used. |
| 14:10 | coventry` | SegFaultAX, sdegutis: Are you talking about main.clj? It's a one-off script for pulling in the data from the old website, isn't it? So how much benefit would there be to cleaning it up? |
| 14:10 | sdegutis | coventry`: Right, that's what I'm saying. |
| 14:11 | sdegutis | SegFaultAX: The real meat is in the actual wiki files, and that part's already done. So I could just as easily delete main.clj and the githib wiki would still be a valid proposal to the community. |
| 14:11 | SegFaultAX | coventry`: A lot, I think. It would be better if it emitted data and also had a formatter that could create the wiki or whatever. |
| 14:12 | sdegutis | SegFaultAX: But that's just a variation of YAGNI. |
| 14:12 | SegFaultAX | sdegutis: If you don't care about making it useful, maybe. |
| 14:12 | sdegutis | SegFaultAX: It already *was* useful. It's no longer needed. |
| 14:12 | sdegutis | SegFaultAX: What else does it need to be used for? |
| 14:12 | SegFaultAX | Unless you need to entirely reformat it. |
| 14:12 | SegFaultAX | In which case you have to re-write it, because you don't have the /data/ anymore. |
| 14:13 | sdegutis | SegFaultAX: Reformatting the existing wiki requires an entirely different script that would do HTML scraping on the existing wiki files. |
| 14:13 | SegFaultAX | sdegutis: Okay. |
| 14:13 | sdegutis | SegFaultAX: (Well actually just Markdown scraping) |
| 14:13 | SegFaultAX | Nevermind. |
| 14:14 | sdegutis | SegFaultAX: I'm just confused about your rationale. It seems like you're suggesting it be cleaned up in preparation for some abstract vague future feature. |
| 14:15 | SegFaultAX | sdegutis: Okay. |
| 14:16 | sdegutis | SegFaultAX: But you're right, if someone says "hey can you generate wikidocs for clojure-ring using this thing?" then I'll certainly clean it up in preparation for that. |
| 14:17 | SegFaultAX | I thought you were trying to create a migration path away from the utterly outdated clojuredocs site. That's clearly not the plan, you just wanted to reformat their data. |
| 14:17 | coventry` | What's an example of a lein project with .java files? |
| 14:17 | sdegutis | SegFaultAX: Oh, I see the misunderstanding. |
| 14:17 | technomancy | coventry`: reply, I guess? |
| 14:17 | sdegutis | SegFaultAX: No, this wasn't to create a migration path away from it. It was to write an experimental static wiki-based replacement for it. And that's already done. |
| 14:18 | coventry` | technomancy: thanks. |
| 14:18 | SegFaultAX | sdegutis: Thanks for the clarification. |
| 14:18 | sdegutis | SegFaultAX: I'm glad that's cleared up :) |
| 14:20 | sdegutis | It's hard being so confused so often. |
| 14:20 | sdegutis | So, I had this really weird idea that's kind of related to Clojure... |
| 14:22 | sdegutis | I want to write a simple Lisp interpreter in ObjC, where symbols starting with a period turn into a function that calls the given method on the receiver with args. So you could do (.length my-str) and it calls [my-str length]. But you could also do (map .length my-strs) because .length is just a function. |
| 14:22 | sdegutis | But every time I write a Lisp interpreter, I get really confused as to how '() and (rest ()) should work, and how they're related to nil. |
| 14:23 | sdegutis | So I basically want to copy Clojure in this regard. |
| 14:23 | sdegutis | ,(rest ()) |
| 14:23 | clojurebot | () |
| 14:23 | sdegutis | Weird. |
| 14:23 | SegFaultAX | That's why we have next |
| 14:23 | SegFaultAX | ,(next ()) |
| 14:23 | clojurebot | nil |
| 14:24 | SegFaultAX | But in most lisps, () is just another name for nil. |
| 14:24 | sdegutis | Right, because they focus on list-based recursion which favors that relationship. |
| 14:24 | scriptor | ,((just [first rest next]) '()) |
| 14:24 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: just in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:24 | scriptor | ,((juxt [first rest next]) '()) |
| 14:24 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer> |
| 14:24 | scriptor | fuck it |
| 14:24 | sdegutis | LOL |
| 14:24 | sdegutis | :) |
| 14:25 | TimMc | scriptor: Drop those brackets. |
| 14:25 | SegFaultAX | It doesn't really have anything to do with list-based recursion. |
| 14:25 | sdegutis | ,((juxt first rest next) '()) |
| 14:25 | clojurebot | [nil () nil] |
| 14:25 | scriptor | ah |
| 14:25 | SegFaultAX | It's more to do with how cons are structured. |
| 14:25 | technomancy | first vs next is a laziness distinction |
| 14:25 | sdegutis | SegFaultAX: Really? I thought the purpose was to make truthy comparisons see () as false so they know when to branch out in recursive functions. |
| 14:25 | technomancy | rest vs next rather |
| 14:26 | SegFaultAX | sdegutis: Again, () is just an alias for nil traditionally. |
| 14:26 | SegFaultAX | And it has to do with cons cells, not list recursion. |
| 14:26 | sdegutis | Okay. |
| 14:27 | technomancy | the reason rest returns a seq is that it avoids forcing anything |
| 14:27 | coventry` | If I want to make a project file for clojure, should test/java go in both :java-source-paths and :test-paths? |
| 14:27 | technomancy | coventry`: lein doesn't support tests written in java |
| 14:27 | SegFaultAX | sdegutis: It happens that it's convenient to stop recursion when the cdr is nil. |
| 14:28 | sdegutis | I see. |
| 14:28 | coventry` | Thanks, technomancy. |
| 14:28 | sdegutis | ,((juxt first rest next) ()) |
| 14:28 | clojurebot | [nil () nil] |
| 14:29 | sdegutis | I think I'll have to skip the whole lazy sequences thing in my interpreter. It's really confusing to me from an implementation stand-point. |
| 14:29 | scriptor | sdegutis: check out http://clojure.org/sequences |
| 14:29 | sdegutis | Thanks. |
| 14:29 | SegFaultAX | ,(cons 1 ()) |
| 14:29 | clojurebot | (1) |
| 14:29 | SegFaultAX | ,(cons 1 nil) |
| 14:29 | clojurebot | (1) |
| 14:29 | scriptor | it's actually not too bad once you get your head around it |
| 14:30 | sdegutis | I get lazy sequences when actually using Clojure, like I understand that (map prn [1 2 3]) won't print them until it's asked for that number of elements, and that it caches whatever elements have been consumed so far (so it won't repeat side-effects). |
| 14:31 | coventry` | sdegutis: Why not write an Objective-C backend to clojurescript's compiler? Could be huge. |
| 14:31 | SegFaultAX | Clojure hides these details from us with higher level abstractions (or just differently named functions). We very often don't think about cars and cdrs like you might in traditional lisps. |
| 14:31 | sdegutis | coventry`: (1) There's already one in Chicken Scheme that probably works with ObjC, (2) I'm not smart enough nor do I have enough time to become smart enough, (3) I don't see the practical application of that |
| 14:32 | sdegutis | coventry`: Rather I just want this so I can script my window manager from in-process without having to resort to heavy-hitters like MacRuby/RubyCocoa/PyObjC or lame languages like F-Script or Lua. |
| 14:32 | scriptor | sdegutis: skim the java sources for lazy-seq some day, it's actually fairly straightforward |
| 14:32 | dnolen | coventry`: clojurec already supporting ObjC |
| 14:32 | scriptor | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java |
| 14:33 | sdegutis | scriptor: cool, thanks :) |
| 14:33 | coventry` | dnolen: Thanks. |
| 14:33 | scriptor | the hardest part is the naming (sv, s, etc.) |
| 14:33 | dnolen | coventry`: personally I think it makes more sense to just script your ObjC applications with ClojureScript directly given JavaScriptCore.framework support around the corner |
| 14:36 | coventry` | dnolen: interesting. |
| 14:44 | sdegutis | dnolen: That was actually the plan with the first Zephyros release, which was scripted using embedded JS via JSCocoa (basically the same as JavaScriptCore.framework, just not made by Apple). |
| 14:45 | sdegutis | dnolen: But embedding JS into ObjC and trying to interface with *all* of C and ObjC turns out to be actually really ugly and have some insidious caveats, especially around struct params/returns and out-params. |
| 14:46 | SegFaultAX | Fortunately you probably don't need *all* of ObjC. |
| 14:46 | sdegutis | dnolen: That's why I moved it to a unix-socket-based protocol that communicates via a simple JSON-based Ruby-like message-passing protocol. Sure, it's not as easy, but it's cleaner. |
| 14:47 | sdegutis | SegFaultAX: Right, that's why I'm going to write my own lisp interpreter in it. The intentional limitation of it will be that it can *only* handle ObjC types for params/returns. That simplifies it a *ton*. And it means I also don't need to pull in libffi either. |
| 14:48 | sdegutis | I think it'll be straight-forward to mimic a minimalist vision of Clojure in it. It won't have everything, but that's okay too, since it's just for in-process scripting. |
| 14:50 | dnolen | sdegutis: I don't know too much about JSCocoa, but its looks appears permeated with scope creep. From my basic poking around at what's coming down the pipe with JSC.framework looks simpler/nicer. |
| 14:51 | sdegutis | dnolen: yeah, I had to turn off a lot of features of JSCocoa to get it working like JSC. Although right before I abandoned the embedding-scripting idea, I was about to take on writing a JSC-like framework that would be simpler than JSCocoa and do a lot less (and be a little less buggy as a side-effect). |
| 14:52 | sdegutis | dnolen: good thing I didn't, since Apple's doing it themselves :) |
| 14:52 | sdegutis | dnolen: Also have you been looking into integrating CljS with JSC.f? |
| 14:53 | sdegutis | If done right, it could be really neat, although I'm not sure what for yet. |
| 14:53 | dnolen | sdegutis: I don't know what there really is to "integrate". It works. Ejecta is a good model and the next JSC.f enables that style of integration. |
| 14:54 | dnolen | sdegutis: i.e. not trying to transparently bridge - just protocols that enable communication between the parts - and you provide them. |
| 14:54 | dnolen | "not trying to transparently bridge everthing" is what I mean. |
| 14:57 | sdegutis | Ah. |
| 14:59 | sdegutis | Shameless plug: I just deployed a new version of www.cleancoders.com, go buy stuff from it :) |
| 14:59 | sdegutis | It's a Clojure web app so it's kind of on-topic ;) |
| 15:04 | coventry` | What's the "right" way to grovel pom.xml to get the version of the main application out? The following gives me the answer at the head of the returned list, but it would be nice to know make sure I'm getting it from the right place in the tree. (->> "/home/coventry/clojure/alien/clojure/pom.xml" java.io.File. parse xml-seq (filter #(= (:tag %) :version))) |
| 15:05 | coventry` | (That's after (use 'clojure.xml)). |
| 15:07 | coventry` | Oh, maybe I want to use clojure.data.zip.xml instead. |
| 15:13 | muhoo | for serializing access to an i/o resource... agents? |
| 15:14 | muhoo | i was using a homemade work queue, but now i think that was overkill. |
| 15:14 | gfredericks | I've used agents for serialization before |
| 15:14 | gfredericks | the locking macro looks straightforward, I'm not sure why nobody seems to use it |
| 15:15 | TimMc | gfredericks: A coworker is using it in some current work. |
| 15:15 | bbloom | gfredericks: b/c locks don't compose? :-) |
| 15:17 | TimMc | Specifically, there are two loops that both wake up and run the same action under different conditions, but they shouldn't run at the same time. |
| 15:18 | gfredericks | bbloom: that's prollably it |
| 15:23 | asteve | how do I call function "run-local" inside of core.clj under the namespace name.space? |
| 15:23 | asteve | name.space.core.run-local? |
| 15:23 | gfredericks | so you're intentionally not associating files with namespaces? |
| 15:24 | asteve | no |
| 15:24 | callen | muhoo: could use core.async too. |
| 15:24 | asteve | at the top of core.clj is (ns name.space.core |
| 15:25 | gfredericks | asteve: okay so the namespace is called name.space.core then, not name.space |
| 15:25 | gfredericks | asteve: and the function could be called from clojure code by (name.space.core/run-local) |
| 15:25 | asteve | gfredericks: I see that now, thank you for the clarification |
| 15:25 | tbaldridge | muhoo: yeah, that's like 10 lines of core.async code |
| 15:25 | callen | tbaldridge: if that. |
| 15:26 | callen | tbaldridge: I like how learning to use core.async feels like I've acquired super powers. |
| 15:26 | callen | "I can do this! I know core.async!" |
| 15:26 | callen | "PICK MEEE PICK MEEE, I KNOW THE ANSWERRRRRR" *waves hand frantically in the air* |
| 15:28 | fredyr | trying to understand the state machine stuff feels far from super powers tho |
| 15:29 | fredyr | prolly me being thick |
| 15:29 | gfredericks | callen: xkcd/208? |
| 15:30 | fredyr | hah |
| 15:31 | sdegutis | Ha. |
| 15:31 | sdegutis | Oh man I thought today's xkcd was gonna be about Lisp. |
| 15:31 | tbaldridge | fredyr: no, it can be hard to understand if you don't have someone explaining it to you. I hope to go over some of that stuff at the Conj |
| 15:32 | sdegutis | tbaldridge: Do those get recorded and put online? |
| 15:32 | callen | gfredericks: actually, I'm far more powerful than that, I have Instaparse. |
| 15:32 | sdegutis | tbaldridge: I'd love to see your talk eventually but I can't go this year. |
| 15:32 | callen | gfredericks: GLL based parser combinators for CFG and context sensitive parsing FTWWWWWWWWW |
| 15:32 | tbaldridge | sdegutis: yeah, they end up on youtube after a few weeks. Or they did last year |
| 15:32 | sdegutis | Cool. |
| 15:33 | fredyr | tbaldridge: oh, looking forward to that then |
| 15:44 | danielszmulewicz | Good people, what's your preferred way to host private libraries? I did `lein install`on some project that is not on clojars or maven, but I have yet to organize a private repo. What's your recommendations? |
| 15:44 | mdrogalis | danielszmulewicz: Archiva is working out alright for my place. |
| 15:45 | danielszmulewicz | mdrogalis: is it lightweight? |
| 15:45 | callen | it's an apache project. |
| 15:45 | mdrogalis | danielszmulewicz: What do you mean? |
| 15:45 | technomancy | danielszmulewicz: a private repo can just be a directory you rsync to an nginx server |
| 15:46 | danielszmulewicz | technomancy: that's what I mean by lightweight. Cool solution. That's my style. |
| 15:46 | callen | I'm a fan of using things like Unison and a private server for this. |
| 15:46 | callen | technomancy: which is written in OCaml, by the by. |
| 15:46 | danielszmulewicz | Thanks. |
| 15:46 | technomancy | callen: sweet. what's the advantage over rsync? |
| 15:47 | technomancy | I thought it was mostly about being 2-way, which isn't as relevant here |
| 15:47 | callen | technomancy: 2 way, not requiring any real active thought. |
| 15:48 | callen | it just "goes" |
| 15:48 | callen | I recommend it when people ask me how to migrate away from Dropbox/GDrive. |
| 15:48 | callen | I used to use Unison years and years ago. It's gotten better since too. |
| 15:48 | technomancy | heh; I just use rsync for that =) |
| 15:48 | callen | not every likes draining volition to transport state. |
| 15:48 | callen | everyone* |
| 15:48 | callen | but I get your meaning. |
| 15:49 | technomancy | oh, so unison is a daemon? |
| 15:49 | sdegutis | Why do people migrate away from Dropbox? |
| 15:49 | sdegutis | I just got Dropbox and am super happy with it. |
| 15:49 | technomancy | proprietary gunk |
| 15:49 | nDuff | ...why would anyone trust Dropbox in the first place? |
| 15:49 | mtp | because you don't control the dropbox infra |
| 15:49 | mtp | and they don't care about your data |
| 15:49 | sdegutis | nDuff: what's not to trust? |
| 15:50 | mtp | what IS there to trust |
| 15:50 | mtp | if they take a shredder to your data, their responsibility ends with "SORRY" |
| 15:50 | rlb | technomancy: unison just a bidirectional sync program -- haven't messed with it in a while, but wasn't using a daemon back when I was. |
| 15:50 | rlb | "unision's just" |
| 15:50 | rlb | technomancy: it tries to keep track of state, etc. |
| 15:50 | sdegutis | mtp: I'm as likely to lose my data with them as I am by hosting it on my own personal backup hard drives. |
| 15:50 | rlb | (to handle conflicts, etc.) |
| 15:50 | rlb | iirc |
| 15:51 | nDuff | sdegutis: ...well, for an example...there was a bug mid-2011 when they disabled password authentication by mistake for a 4-hour period |
| 15:51 | nDuff | sdegutis: ...so anyone could impact the target users' files without their credentials. |
| 15:51 | nDuff | s/impact/interact with/ |
| 15:51 | sdegutis | nDuff: Sounds like they won't be making that mistake again any time soon (nor have they apparently). |
| 15:51 | mtp | sdegutis: why yes, you are, but then it's at least YOUR FAULT |
| 15:52 | nDuff | sdegutis: sure, but it answers the question re: trust. |
| 15:52 | mtp | that is not a selling point to dropbox |
| 15:52 | mtp | it's more of a warning to take salient backups |
| 15:52 | sdegutis | nDuff: They've earned my trust so far by doing one job and doing it well for as long as I've had an account with them. |
| 15:52 | _________ | can anyone give me an example where one would actually use a set of vectors and a vector of sets? |
| 15:52 | nDuff | sdegutis: I'm not telling you not to trust them. I'm only saying that I don't. |
| 15:52 | mtp | yes, but it'd be contrived |
| 15:52 | technomancy | my main gripe with dropbox is how they encourage their users to spam their friends in order to get higher quotas |
| 15:53 | technomancy | so. annoying. |
| 15:53 | sdegutis | technomancy: Hey btw... |
| 15:53 | mtp | _________: a more helpful question would be for me to ask "what do you represent using vectors" and (separately) what do you represent using sets |
| 15:53 | sdegutis | Oh never mind, you'll probably say no. |
| 15:53 | mtp | and once we've agreed on an understanding, going from there |
| 15:54 | sdegutis | mtp: what? make sentient backups? |
| 15:54 | mtp | salient |
| 15:54 | mtp | "backups that not only back up, but that you can restore from" |
| 15:54 | sdegutis | oh man, my imagination just went crazy for a second |
| 15:55 | mtp | good. stay with that. :) |
| 15:55 | callen | sentient people know what sentient means. |
| 15:55 | _________ | mtp i was looking for where a combination of them could be used but me being a clojure rookie i think i put the question wrong. like you said, what can vectors be used to represent and what can sets be used to represent? |
| 15:55 | callen | _________: what's with the nick :| |
| 15:55 | mtp | well, you were the one who wanted an example |
| 15:55 | mtp | also, this has nothing to do with clojure specifically |
| 15:56 | sdegutis | I usually use vectors to represent param lists. |
| 15:56 | mtp | _________: the only examples i can come up with are utterly contrived and wouldn't make any sense. i want you to help me com eup with a concrete example from those two questions |
| 15:57 | sdegutis | _________: your nick makes me uneasy for some reason :) |
| 15:57 | _________ | callen i've Textual as my IRC client don't really know how to set a nick and it gave me this default, utterly absurd nick |
| 15:57 | sdegutis | Like I'm talking to The Invisible Man. |
| 15:57 | mtp | maybe you should learn how to operate the tools you're using before you jump in. :) |
| 15:57 | TEttinger | or webchat |
| 15:57 | TEttinger | _________, sets are often used in checks for whether something has a value that equals one taken from a certain set of values |
| 15:57 | sdegutis | _________: use LimeChat, it's great on Mac. |
| 15:58 | TEttinger | ,(#{:a :b :c} :c) |
| 15:58 | sdegutis | Least buggy and most sane client I've ever used. |
| 15:58 | clojurebot | :c |
| 15:58 | TEttinger | ,(#{:a :b :c} :d |
| 15:58 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 15:58 | TEttinger | ,(#{:a :b :c} :d) |
| 15:58 | clojurebot | nil |
| 15:58 | TEttinger | useful for filter and stuff |
| 15:58 | sdegutis | (some #{:simple :easy} java.Swing) ;=> nil |
| 15:59 | tbaldridge | sdegutis: (inc limechat) |
| 16:01 | sdegutis | If you were going to implement a really minimalist subset of clojure.core in a simple Lisp that doesn't have lazy sequences and is also hosted, what primary functions would you have? |
| 16:03 | callen | (inc irssi) ; which works everywhere. |
| 16:03 | lazybot | ⇒ 1 |
| 16:05 | sdegutis | As long as you're okay with text-based clients. |
| 16:06 | ^_^ | callen: Dunno what you're complaining about. :-P |
| 16:06 | coventry` | What's the right way to point lein at a local build of clojure, in the defproject :dependencies? Just putting [org.clojure/clojure "1.6.0-master-SNAPSHOT"] in there doesn't work. Putting a symlink in checkouts/ doesn't work, because it's not a lein project. |
| 16:06 | callen | coventry`: clojure is just a jar. |
| 16:06 | callen | coventry`: repeat that three times to yourself. |
| 16:07 | Guest99251 | coventry`: mvn install your build of Clojure |
| 16:08 | muhoo | tbaldrid_: to be fair, it was also like 10 lines of lamina. but i'm still wondering if it's not the correct thing to use a queue for this. will play with agents instead in a bit |
| 16:10 | callen | muhoo: it's just critical section serialization, no? |
| 16:10 | coventry` | Guest99251: Thanks, mvn install DWIW. |
| 16:12 | kovas | looks like a partial lineup of clojure conj talks has been released |
| 16:12 | kovas | http://lanyrd.com/2013/clojureconj/schedule/ |
| 16:13 | hhenkel | Hi all, I got a question regarding http://www.luminusweb.net/docs#guestbook_application (CRUD Applications with Clojure). When I do test the example application "guestbook" I get a non empty textarea resulting in a failing check. Anyone aware of what is causing this? |
| 16:15 | callen | this conj is looking pretty awesome. |
| 16:15 | hhenkel | The textarea is described as <textarea rows="4" cols="50" name="message"> in the home.html |
| 16:16 | kovas | looks like there something for everyone |
| 16:16 | kovas | i sure it will be great but wasn't blown away by the lineup |
| 16:17 | dnolen | nice Andy Keep talking about compilers |
| 16:18 | kovas | that will be cool |
| 16:18 | kovas | dnolen: did u submit a talk? |
| 16:18 | dnolen | kovas: I did not |
| 16:18 | kovas | yeah me neither |
| 16:19 | kaw | I'm getting a "No such var: comp/namespaces, compiling:(cljs/closure.clj:318:8)" when trying to "lein cljsbuild once", does anyone have any idea what might cause that? |
| 16:20 | kaw | Just to be clear, cljs/closure.clj isn't part of my code, I assume it's part of ClojureScript -- some sort of version mismatch between two components in my project setup, maybe? |
| 16:22 | dnolen | kaw: what version of ClojureScript? |
| 16:22 | dnolen | kaw: are you specifying a version? |
| 16:23 | dnolen | kaw: if not, you should - I recommend 1859, 1877 is a little buggy and we need patch it up a bit - plus projects need to catch up with the breaking change around keyword identical anyhow. |
| 16:24 | dissipate__ | other than clojure, what are the top picks for FP languages in industry? Haskell and OCaml? |
| 16:24 | dnolen | dissipate__: Scala |
| 16:25 | dissipate__ | dnolen: so, haskell, ocaml, clojure, scala |
| 16:25 | dnolen | dissipate__: which is more a hybrid, but more likely users use it in an FPish way |
| 16:25 | dissipate__ | dnolen: and non OOP languages? haskell and clojure? |
| 16:29 | dissipate__ | dnolen: is the fact that the playing field of non-OOP FP languages is down to 2 choices a good thing or a bad thing? |
| 16:30 | dnolen | dissipate__: I don't really see how it matters much. |
| 16:30 | dissipate__ | dnolen: well, it matters in the sense that i only have to learn 2 languages to cover the space. |
| 16:31 | hhenkel | Okay solved the problem by myself. Seems like the indentation in the example file results in a textarea with blanks... |
| 16:33 | dissipate__ | kmicu: do you reeketh of the cube farm? |
| 16:36 | armadillo | ; |
| 16:38 | armadillo | (+ 1 2) |
| 16:38 | clojurebot | 3 |
| 16:40 | sheldonh | does core have a non-short-circuiting (and)? |
| 16:41 | nDuff | sheldonh: well, you can always get that behavior with a let doing your evaluation early. |
| 16:41 | nDuff | sheldonh: ...might I ask the circumstance? |
| 16:41 | sheldonh | nDuff: hmmm... okay, i'll try again |
| 16:42 | kaw | dnolen: Thanks, setting [org.clojure/clojurescript "0.0-1859"] seemed to fix it |
| 16:42 | dissipate__ | nDuff: what about lazy let? |
| 16:42 | kaw | Well, it's still failing really, but it looks like it's failing at my code now |
| 16:43 | coventry` | sheldonh: It is short-circuiting. E.g., ##(and nil (do (println \.) 1)) |
| 16:43 | lazybot | ⇒ nil |
| 16:43 | sheldonh | nDuff: like, say you were using midje, and didn't know you could make prerequisites optional, and then found out, but were still curious :) |
| 16:43 | nDuff | ,(let [n (do (println "hello") nil)] 10) |
| 16:43 | clojurebot | hello\n10 |
| 16:43 | coventry` | (It's worth looking at the source, which does as nDuff suggests.) |
| 16:44 | nDuff | ...or, to be a little more explicit... |
| 16:44 | kurtis | Hey guys, sorry for asking here but #leiningen seems idle. Has anyone had problems running 'lein repl' in OSX? |
| 16:44 | nDuff | ,(let [n (do (println "hello") nil)] (and false n)) |
| 16:44 | clojurebot | hello\nfalse |
| 16:44 | sheldonh | cool. i must have screwed it up when i tried. thanks |
| 16:46 | llasram | kurtis: host firewall? |
| 16:46 | justin_smith | kurtis: I think most lein users are on osx actually, it worked last I tried it (main maching is linux but I have an osx machine) |
| 16:46 | justin_smith | what error are you getting? |
| 16:47 | coventry` | sheldonh: Sorry I misread your question. |
| 16:48 | llasram | justin_smith: This is what they posted in #leiningen: https://dpaste.de/0GI28/ |
| 16:48 | kurtis | llambda, My firewall is disabled and I'm just trying to run it locally. (literally just executing 'lein repl') |
| 16:48 | llasram | kurtis: Wrong `ll` user :-) |
| 16:48 | kurtis | whoops, that was meant for llasram sorry :) |
| 16:48 | llasram | kurtis: The lein repl tasks works is by launching an `nrepl` server then attaching a local client to it |
| 16:49 | kurtis | llasram, Yeah, I saw that after further reading. I went ahead and launched a "headless" nrepl server. At that point, there were no problems. I tried to connect to it but then it refused my connection and I believe ended up crashing |
| 16:49 | llasram | kurtis: Hmm. That really is suggestive of a host firewall, or potentially network configuration issues |
| 16:50 | llasram | kurtis: Sorry, no other ideas here |
| 16:50 | kurtis | llasram, haha no problem! I'll keep investigating. I wonder if it has anything to do with OSX's weird application-level security? Although I run Django and all sorts of other apps without problems |
| 16:51 | coventry` | kurtis: If you do "python -m SimpleHTTPServer" and browse to localhost:8000 does it show your directory listing? |
| 16:52 | kurtis | coventry`, Yep, and just to check on the hostname resolution -- both 127.0.0.1:8000 and localhost:8000 work |
| 16:53 | kurtis | Here's my output from 'lein repl' in case anyone might have a better idea than myself: https://dpaste.de/0GI28/ |
| 16:54 | llambda | heh poor llasram...you had the `ll` first :( |
| 16:55 | kurtis | Other than ~/.lein -- are there files stored anywhere else? Maybe I had a bad initial install and something corrupt has persisted? |
| 16:55 | justin_smith | kurtis: all the jars are under ~/.m2 |
| 16:55 | coventry` | kurtis: Presumably you saw this, and checked that non-HTTP traffic is working, too? https://github.com/heroku/heroku-buildpack-clojure/issues/19#issuecomment-9366427 |
| 16:57 | TimMc | sheldonh: What's your use-case for non-short-circuiting and? |
| 16:58 | kurtis | coventry`, Thanks, I'll read into that more. It might be a good work-around although I think (unless it's just ignorance on my part) this should work fine? -- justin_smith I appreciate it! I'll wipe that directory as well |
| 17:01 | coventry` | kurtis: I meant that you might have a firewall which is only allowing HTTP through, as all of the traffic you've mentioned so far is HTTP. Does "nc -l -v 1234" let you "telnet localhost 1234"? |
| 17:04 | asteve | was .getLong replaced with something from 1.2->1.4? |
| 17:06 | kurtis | coventry`, Makes sense! I just ran that command and from another terminal tried to telnet to localhost. Received connection refused from 'localhost' but it automatically retried at 127.0.0.1 which worked |
| 17:06 | kurtis | I take that back |
| 17:06 | kurtis | Let me copy + paste the copy to dpaste |
| 17:07 | kurtis | coventry`, Here's my output: https://dpaste.de/UpOHq/ |
| 17:08 | coventry` | OK, and if you type into the telnet window and hit return, does the input show up in the nc window? |
| 17:08 | kurtis | coventry`, Yep |
| 17:08 | coventry` | OK, it's not that, then. |
| 17:09 | kurtis | Should I try wiping ~/.lein and ~/.m2 and reinstall lein? |
| 17:10 | llasram | kurtis: It certainly can't make things worse :-) |
| 17:10 | kurtis | haha cool. I'll give it a shot |
| 17:12 | kurtis | Hmm, the problem is still there :/ https://dpaste.de/IOnHD/ |
| 17:13 | kurtis | I guess Leiningen doesn't like my Mac haha. It works fine on my linux boxes but -- that's not ideal for work |
| 17:15 | justin_smith | kurtis: what about specifying a port? |
| 17:16 | kurtis | justin_smith, I'll give it a shot. I think I've done that once before but I can't hurt |
| 17:16 | llasram | You know, there was a recent change in Leinigen to change how the repl-port is communicated |
| 17:16 | llasram | kurtis: Are you trying to do this w/in a project? |
| 17:17 | kurtis | justin_smith, Tried 8080. Same error |
| 17:18 | kurtis | llasram, Interesting. And no -- not at this moment. Although I have tried both from within a projeect and just from my home directory |
| 17:18 | llasram | kurtis: Hmm. Well, that blows one theory. But you can try downgrading a version |
| 17:19 | kurtis | llasram, True! Any suggestion on how to do that? Just grab the appropriate script from github? (different tag/release I'm assuming) |
| 17:19 | llasram | Try: lein upgrade 2.3.1 |
| 17:19 | llasram | kurtis: The `upgrade` command actually lets you hit arbitrary versions |
| 17:20 | llasram | Actually, you might try even older. I've found 2.1.2 to be very stable |
| 17:21 | kurtis | Yeah, 2.3.1 didn't do the trick. Let me try that |
| 17:22 | kurtis | llasram, 2.1.2 worked. |
| 17:22 | justin_smith | yeah, 2.1.2 is golden (using it here myself) |
| 17:22 | kurtis | Am I missing out on anything important by down-grading? I'm not a clojure expert -- trying to replace a Django API w/ Clojure (learning on the job haha) |
| 17:23 | llasram | kurtis: Nothing super-major. 2.2 turned on profile separation, but then 2.3 turned it off again :-) |
| 17:23 | technomancy | it could at least help you find the root cause |
| 17:23 | kurtis | haha cool. Well I will use this to get started and maybe file a bug report to see if the core lein developers might have some ideas. Thanks guys! |
| 17:23 | technomancy | hopefully you don't stay on the old version once you figure out what's going on |
| 17:24 | llasram | kurtis: Anyway, several nice improvements, and you don't want to stay old forever |
| 17:24 | llasram | kurtis: ^^ core lein developers == #{technomancy, ...}, btw |
| 17:25 | kurtis | oh haha |
| 17:25 | kurtis | Well I'm in the right place :) |
| 17:26 | kurtis | technomancy, Should I file a Github Ticket? |
| 17:26 | technomancy | kurtis: not sure what can be done there if you can't provide a repro case |
| 17:27 | kurtis | technomancy, hmm. True. Maybe cycle through all versions from 2.1.2 to 2.3.1 and see where the breakage occurs? |
| 17:27 | coventry` | Sounds like a good application for git bisect, though. (Not that I've ever done one of those.) |
| 17:27 | kurtis | Although if I can't help anyone reproduce the problem since I don't know what it is myself |
| 17:27 | kurtis | Are you guys using Java 6 or 7 with OSX? |
| 17:28 | technomancy | oh, did you find a version that works? |
| 17:28 | kurtis | technomancy, Yeah the 2.1.2 worked |
| 17:28 | technomancy | oh, I missed that |
| 17:29 | technomancy | in that case maybe a ticket would be warranted |
| 17:32 | kurtis | technomancy, Thanks. I went ahead and created one. https://github.com/technomancy/leiningen/issues/1321 -- Let me know if you guys need anymore information or want me to test anything. I appreciate the help and awesome project! |
| 17:32 | kurtis | coventry`, Thanks for the suggestion on switching versions too. Hopefully not a permanent solution but at least I can get started :) |
| 17:33 | coventry` | kurtis: That was llasram, I think. |
| 17:34 | llasram | Without lazybot to keep track of karma everyone is confused about who gets credit |
| 17:35 | kurtis | haha sorry, thank you llasram |
| 17:57 | dissipate__ | does the partial function return a closure? |
| 17:57 | sheldonh | TimMc: it was just curiosity. the use case was bogus (not knowing how to make midje prerequisites optional) |
| 17:58 | coventry` | ,(do (use 'clojure.repl) (source partial)) |
| 17:58 | clojurebot | Source not found\n |
| 17:59 | justin_smith | dissipate_> if passed a locally bound fn, it will wrap that in a closure, if that is what you mean |
| 17:59 | noprompt | if i'm using lein ring server with an :init option and an exception occurs during somewhere in the :init fn, how do i safely terminate the application? |
| 18:00 | justin_smith | noprompt: (System/exit numeric-code) |
| 18:00 | dissipate__ | justin_smith: i'm reading a warning about 'partial' in 'clojure programming'. |
| 18:01 | justin_smith | 0 is success, by convention, anything else indicates an error |
| 18:01 | justin_smith | dissipate_> yes, since it calls fn, that fn creates a closure, which has performance implications since it is created at runtime |
| 18:02 | dissipate__ | justin_smith: is the use of 'partial' discouraged for any argument arity over 4? |
| 18:02 | noprompt | justin_smith: i tried that with (System/exit 1) and it just hangs. |
| 18:02 | noprompt | ie. i still need to use C-c to stop it. |
| 18:02 | justin_smith | no, all core functions special case below 4 or so args if they are vararg |
| 18:02 | justin_smith | noprompt: maybe some thread is hanging? I have never seen that issue |
| 18:03 | dissipate__ | justin_smith: i don't understand. |
| 18:03 | noprompt | justin_smith: actually no that did the trick. i must have forgotten to save the file the first time. |
| 18:03 | justin_smith | the reason it has seperate versions for each arg count below 5 is because that is how things are written in core |
| 18:03 | justin_smith | for efficiency reasons |
| 18:04 | dissipate__ | justin_smith: and functions that have a fixed arity? |
| 18:04 | justin_smith | well you wouldn't special case those, would you |
| 18:05 | dissipate__ | justin_smith: so if i have a function of a fixed arity of 50, what happens? |
| 18:05 | justin_smith | as opposed to? the function would be annoying to use for one |
| 18:06 | justin_smith | I may not understand your question |
| 18:06 | dissipate__ | justin_smith: just trying to figure out these efficiency issues. |
| 18:06 | noprompt | ughh, actually scratch that (System/exit 1) does not work. :-( |
| 18:07 | justin_smith | the efficiency issue with varargs is that it creates a sequence to hold the args, when generally the first thing your function does is break it back down again |
| 18:07 | justin_smith | so you have a small gain by not having to create it if short arg counts are more common |
| 18:07 | justin_smith | the issue with partial is the calls to fn at runtime need to create a lexical closure, which can't be optimized ahead of time |
| 18:08 | dissipate__ | justin_smith: interesting. makes sense, thanks for the info. |
| 18:08 | justin_smith | similar issues with allocating a bunch of data, with likely a short lifespan |
| 18:08 | justin_smith | np |
| 18:08 | noprompt | maybe it has something to do with nrepl |
| 18:10 | dissipate__ | justin_smith: well, now i see much better by looking at the source: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L2388 |
| 18:11 | dissipate__ | justin_smith: strange that the book didn't just point to the source, it's much less confusing. |
| 18:11 | justin_smith | ,(source partial) |
| 18:11 | clojurebot | Source not found\n |
| 18:12 | justin_smith | weird |
| 18:12 | justin_smith | in a real repl that would work |
| 18:12 | dissipate__ | justin_smith: perhaps clojurebot doesn't have the core loaded up |
| 18:13 | justin_smith | ,((partial + 1) 1) |
| 18:13 | clojurebot | 2 |
| 18:15 | amalloy | ~def partial |
| 18:15 | amalloy | justin_smith: source is in clojure.repl, which is not loaded by default *except* in repls |
| 18:16 | callen | lancepantz: herro :) |
| 18:16 | callen | amalloy: me gusta. |
| 18:16 | justin_smith | amalloy: it found the source function, it just didn't find source code |
| 18:16 | dissipate__ | amalloy: thanks |
| 18:17 | justin_smith | amalloy: oh, you mean as a caveat to suggesting using that function, good point |
| 18:19 | justin_smith | ,#'source |
| 18:19 | clojurebot | #'clojure.repl/source |
| 18:22 | TEttinger | ,(source source) |
| 18:22 | clojurebot | Source not found\n |
| 18:24 | Apage43 | https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L156-L163 |
| 18:24 | Apage43 | see also https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L134-L154 |
| 18:25 | Apage43 | expects the var to have a :file and :line on its metadata, then prints the first form on that line |
| 18:26 | Apage43 | (which means if you do something like (comment 'blah) (defn foo []) in a file on the same line, and (source foo), you'll see (comment 'blah), I think |
| 18:27 | Apage43 | interesting thing it does though |
| 18:28 | bbloom | is there a shorthand for integer (not long) literals? |
| 18:28 | Apage43 | it reads all the lines before the line the function starts on, then has the reader read a single form, but through a *proxy* that is also dumping each character it reads into a stringbuilder |
| 18:28 | Apage43 | that's how it gets the comments and such |
| 18:29 | Bronsa | bbloom: nope |
| 18:29 | bbloom | booo ok thanks |
| 18:30 | amalloy | bbloom: integer literals are amazingly difficult to construct |
| 18:30 | bbloom | amalloy: ? |
| 18:30 | amalloy | well, (int 10) isn't an integer literal. it's a literal list containing a symbol and a long |
| 18:31 | amalloy | how can you create an actual integer literal, eg for some poorly-written macro that demands to be given an int? |
| 18:31 | bbloom | it's for some java interop |
| 18:31 | bbloom | amazing i can't do 10I or something |
| 18:31 | bbloom | 10i |
| 18:31 | bbloom | or whatever |
| 18:32 | amalloy | i know. i was just saying it's very hard |
| 18:32 | bbloom | it's not hard, it's impossible :-P |
| 18:32 | amalloy | (if you need an actual literal. which in this case you don't) |
| 18:32 | bbloom | yeah, i don't need an actual literal, but it would certainly be nice :-) |
| 18:32 | Bronsa | amalloy: you can "create" an integer literal during macro-expansion |
| 18:32 | amalloy | Bronsa: yes, i was about to link to http://stackoverflow.com/questions/18280626/clojure-annotations-and-integers/18296618#18296618 |
| 18:32 | bbloom | heh, #long 5 |
| 18:33 | bbloom | er i mean #int 5 |
| 18:33 | amalloy | bbloom: that's a good idea, actually |
| 18:33 | Bronsa | bbloom: hmm, not sure if that's going to work though |
| 18:33 | Apage43 | you can get an Integer =P |
| 18:33 | Apage43 | sort of |
| 18:33 | Bronsa | there's not an invokePrim that returns an int |
| 18:34 | amalloy | Bronsa: right, it could only actually return Integer |
| 18:34 | Bronsa | I think that the tagged literal function would box the int returning it |
| 18:34 | Apage43 | yep |
| 18:34 | bbloom | numerics suck in all languages ever :-/ |
| 18:34 | clojurebot | I don't understand. |
| 18:35 | Apage43 | #java.lang.Integer[5] |
| 18:35 | bbloom | rather than goofy hacks… could we just fix for realzies please? |
| 18:38 | Bronsa | I wonder, if the problem with supporting int and the other primitives in invokePrim is only the (very) large number of interfaces that would need to be generated -- can't we generate those interfaces dynamically as we need them instead of generating all the possible interfaces? |
| 18:42 | dissipate__ | bbloom: are you saying the numeric values in clojure are a hack? |
| 18:43 | bbloom | dissipate__: why is your perspective always so negative? |
| 18:44 | dissipate__ | bbloom: consider it a side effect of dealing with OOP and imperative languages for years |
| 18:44 | callen | dissipate__: more accurate to consider it an aspect of having a bad attitude. |
| 18:45 | dissipate__ | callen: i have a good enough attitude to learn clojure, right? |
| 18:53 | TimMc | dissipate__: Clojure's host, the JVM, has iffy numerics. It's a compromise. |
| 19:09 | clj_newb_2345 | does nrepl have an equiv of "C-c" ? i.e. I want to cancel /kill my last command |
| 19:10 | amalloy | clj_newb_2345: C-c C-c works in slime, dunno about nrepl |
| 19:11 | clj_newb_2345 | java still seems hung |
| 19:11 | clj_newb_2345 | I think I will just kill the nrepl buffer |
| 19:15 | clj_newb_2345 | given a java.io.OutputStream |
| 19:15 | clj_newb_2345 | is there a clojure builtin for writing a string to said OutputStream? |
| 19:15 | clj_newb_2345 | (rahter than writing single chars at a time) |
| 19:27 | dissipate__ | TimMc: how are the numerics on .NET? |
| 19:29 | ThatOneGuy | clj_newb_2345: check out this namespace http://clojure.github.io/clojure/clojure.java.io-api.html |
| 19:30 | s4muel | clj_newb_2345: Take a look at java.io.writer -- OutputStream by nature writes byte by byte, you probably want to send encoded characters to that stream (via a writer). Also, what ThatOneGuy said ;) |
| 19:32 | ThatOneGuy | clj_newb_2345: a really simple function in clojure.core for writing strings and other simple data is 'spit' http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/spit |
| 19:32 | clj_newb_2345 | sample code would relaly help :-) |
| 19:32 | ThatOneGuy | its the opposite of 'slurp' if you've used that one before |
| 19:34 | ThatOneGuy | if you can go all the way back to the file abstraction that is probably a good function to use, but if you are given an OutputStream then just using the 'writer' and 'with-open' from clojure.java.io should be easy |
| 19:35 | xeqi | clj_newb_2345: C-c C-b will interrupt, there is a list of keybindings at https://github.com/clojure-emacs/nrepl.el#clojure-buffer-commands |
| 19:35 | mrcheeks | clj_newb_2345: I don't do any clojure coding yet, but this looks straightforward, especially with an internet connection to lookup docs and example: http://stackoverflow.com/questions/7756909/in-clojure-1-3-how-to-read-and-write-a-file |
| 19:35 | clj_newb_2345 | ThatOneGuy: noted, thanks! |
| 19:36 | s4muel | clj_newb_2345: look at the source for 'spit' -- it's likely exactly what you want, except you replace the file with the OutputStream. |
| 19:37 | ThatOneGuy | (with-open [w (writer clj_newb_2345_s_OutputStream)] (.write w "super awesome string I want to write")) |
| 19:39 | Apage43 | also clojure.java.io/copy is quite handy |
| 19:40 | clj_newb_2345 | got my file IO working :-) |
| 19:44 | TimMc | dissipate__: I haven't used .NET. |
| 19:58 | clj_newb_2345 | does clojure's "while" not have a correponding "beak" ? |
| 19:59 | technomancy | clj_newb_2345: no, but reduce has the equivalent |
| 19:59 | clj_newb_2345 | technomancy: how so? |
| 20:00 | clj_newb_2345 | can you explain it for mortals |
| 20:00 | clj_newb_2345 | who have not written their own clojure project manager? |
| 20:00 | clj_newb_2345 | :-) |
| 20:01 | technomancy | you can return (reduced x) from your reducer fn and it will short-circuit the rest of the collection |
| 20:01 | technomancy | ,(doc reduced) |
| 20:01 | clojurebot | "([x]); Wraps x in a way such that a reduce will terminate with the value x" |
| 20:01 | bja | clojure.core.reducers/reduce fwiw |
| 20:02 | technomancy | ,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj x acc))) [] [2 3 4 0 3 2 1]) |
| 20:02 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection> |
| 20:02 | technomancy | ,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj acc x))) [] [2 3 4 0 3 2 1]) |
| 20:02 | clojurebot | [2 3 4] |
| 20:03 | clj_newb_2345 | noted |
| 20:03 | clj_newb_2345 | thanks |
| 20:03 | technomancy | np |
| 20:09 | noprompt | has anyone used the cljs-http library |
| 20:09 | noprompt | that was a question :-| |
| 20:10 | callen | noprompt: https://github.com/yogthos/cljs-ajax |
| 20:10 | noprompt | callen: i was looking at this one https://github.com/r0man/inflections-clj |
| 20:11 | callen | viri for virus is actually wrong. |
| 20:12 | callen | virus in software plural is viruses, virus in biology plural is virii |
| 20:15 | callen | viruses is the safer option. |
| 20:15 | noprompt | whoops |
| 20:16 | noprompt | callen: sorry i meant https://github.com/r0man/cljs-http |
| 20:17 | noprompt | grabbed the wrong url |
| 20:29 | serycjon | Hello! Is there any way to temporarily remap Caps-lock for /leave |
| 20:30 | serycjon | (oh sorry |
| 22:20 | cjfrisz | ambrosebs: I'm trying to follow up on that JIRA, but I forgot how to get run the type checker on a cljs namespace |
| 22:20 | ambrosebs | (cljs.core.typed/check-ns 'my.ns) in a CLJ REPL |
| 22:21 | cjfrisz | ambrosebs: ah, there's my problem: I was trying to use clojure.core.typed |
| 22:23 | cjfrisz | ambrosebs: ok, I got 5 type errors from stuff in cljs.core: vector, first, fnext, and 2 for assoc |
| 22:24 | cjfrisz | Is this expected and the JIRA is resolved, or did I encounter an unexpected problem |
| 22:24 | ambrosebs | cjfrisz: could you past them? |
| 22:24 | ambrosebs | *paste |
| 22:25 | cjfrisz | ? |
| 22:26 | ambrosebs | what are the errors? |
| 22:26 | cjfrisz | ambrosebs: Yes, sorry, should have been more specific |
| 22:26 | cjfrisz | ambrosebs: here's the paste https://gist.github.com/cjfrisz/09c7359d22987378478f |
| 22:27 | cjfrisz | ambrosebs: They're all "found untyped var" |
| 22:27 | ambrosebs | that sounds about right. |
| 22:27 | ambrosebs | I don't think they have types yet |
| 22:28 | cjfrisz | ambrosebs: That's what I figured |
| 22:28 | ambrosebs | so that's a good thing :) |
| 22:28 | cjfrisz | But at least the type checker seems to run |
| 22:28 | ambrosebs | yes |
| 22:29 | ambrosebs | cjfrisz: you can use (ann ^:no-check v t) to skip any functions that are missing annotations. |
| 22:29 | ambrosebs | cjfrisz: or you can add them by using a fully qualified `ann`. |
| 22:30 | cjfrisz | ambrosebs: then I'd have to think about the types of those things! :-) |
| 22:30 | ambrosebs | cjfrisz: steal them! https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj#L663 |
| 22:30 | ambrosebs | cjfrisz: don't bother trying assoc, it needs to be hard coded. |
| 22:30 | cjfrisz | ambrosebs: sweeeeeeet |
| 22:31 | cjfrisz | ambrosebs: I think I remember you talking about trying to work out the type for that |
| 22:32 | ambrosebs | cjfrisz: still dreaming :) |
| 22:32 | cjfrisz | ambrosebs: it struck me as a thing I probably wouldn't knock out with my brain turned off and youtube videos on |
| 22:33 | ambrosebs | :) |
| 22:37 | ddellacosta | I'm having a heck of a time figuring out how to understand where this exception is originating |
| 22:37 | ddellacosta | https://www.refheap.com/18526 |
| 22:38 | Apage43 | me too |
| 22:38 | ddellacosta | to complicate things, I'm using a patched version of https://github.com/thegeez/clj-browserchannel (jetty-adapter). Any tips on how to figure it out? |
| 22:39 | Apage43 | it looks to me like a socket is getting closed before you finish writing to it |
| 22:40 | Apage43 | in this context, I expect that's something like a long-polling HTTP request |
| 22:40 | cjfrisz | ambrosebs: I stole the types from base_env.clj got "Cannot parse type: (APersistentVector x)" |
| 22:40 | cjfrisz | Added ^:no-check to all the annotations and got the same thing |
| 22:41 | ddellacosta | Apage43: yeah, that's about as much as I can figure out as well. It seems to happen after a session is established, and when the first bind message is sent (in browser channel, the protocol seems to be like "test, then bind" |
| 22:41 | ddellacosta | ) |
| 22:41 | ambrosebs | cjfrisz: try cljs.core/IVector instead of APersistentVector |
| 22:41 | Apage43 | it's already something that jetty is only printing to the DEBUG level log. I wouldn't worry about it. |
| 22:41 | ddellacosta | Apage43: yeah, I guess you're right, I could just leave it well enough alone--it works otherwise--but feels "dirty" not knowing where this is coming from or why. Don't like it. |
| 22:42 | Apage43 | ddellacosta: you could confirm by watching the chrome network inspector something |
| 22:42 | Apage43 | or even using that inspector's "copy request as cURL" command feature and see if you can start a longpoll request and cause the exception when you ctrl-c curl |
| 22:43 | ddellacosta | Apage43: interesting idea--I'll give that a shot. Hadn't thought to look in the chrome network inspector, but I see a canceled test call already--so that seems like a good lead. Thanks, I'll see what I can figure out from this! |
| 22:45 | clj_newb_2345 | [02:15:55.899] TypeError: cljs.core.async.impl.dispatch.exists_QMARK_ is undefined @ http://crfx:3000/static/main.js:27781 |
| 22:45 | clj_newb_2345 | this is what I get from use cljs.core.async |
| 22:45 | clj_newb_2345 | use [cljs.core.async :only [chan <! >! put!]] |
| 22:45 | clj_newb_2345 | in particular -- what is this bug, and how do I get rid of it? |
| 22:53 | cjfrisz | ambrosebs: Now I'm getting "Cannot parse type: (Option (EmptySeqable x))" |
| 22:53 | cjfrisz | I assume it has to do with that EmptySeqable, but perusing cljs.core didn't turn up anything immediately obvious to me |
| 22:53 | ambrosebs | do you know where EmptySeqable is coming from? |
| 22:54 | ambrosebs | oh it might be Option. |
| 22:54 | ambrosebs | try (U nil (EmptySeqable x)) |
| 22:56 | cjfrisz | ambrosebs: That got me to "Cannot parse type: (EmptySeqable x)" |
| 22:56 | ambrosebs | try (I (cljs.core/ISeqable x) (ExactCount 0)) |
| 22:56 | ambrosebs | which type are you copying? |
| 22:58 | ambrosebs | maybe this is more useful :) (def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (ExactCount 0))) |
| 22:58 | cjfrisz | ambrosebs: let me know if you don't have time to deal with my pestering right now; I feel like I'm throwing a lot of whining your way |
| 22:58 | clj_newb_2345 | alright |
| 22:59 | clj_newb_2345 | in ptojrect.clj, how do I specify what version of clojurescript ot use |
| 22:59 | ambrosebs | cjfrisz: will do :) |
| 23:00 | ambrosebs | cjfrisz: just hanging out at home today. |
| 23:03 | cjfrisz | ambrosebs: it seems happy with the def-alias for EmptySeqable, now I'm trying to figure out NonEmptySeqable |
| 23:04 | ambrosebs | (def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1))) |
| 23:04 | ambrosebs | (def-alias NonEmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1))) |
| 23:04 | ambrosebs | cjfrisz: come to #typed-clojure |
| 23:04 | cjfrisz | Ah, didn't know about CountRange |
| 23:04 | cjfrisz | ambrosebs: good call |
| 23:22 | ddellacosta | I have a proxy. I need to call the protected member of a parent class on the instance, outside the definition of the proxy. Is this possible, or do I need a different mechanism (gen-class...?) to do this? |
| 23:40 | amalloy | &(doc proxy-super) |
| 23:40 | amalloy | Raynes: lazybot is gone again. any idea why? |
| 23:43 | amalloy | ddellacosta: ^ |
| 23:43 | amalloy | if you need to do it from a scope that is not inside the definition of the proxy, you are probably out of luck, but also crazy |
| 23:44 | ddellacosta | amalloy: the problem is that the method I have to call is protected, and I have to call it outside of the proxy--after I've created an instance. Not sure how to do this without adding a new method which is public, and therefore seems like I have to use gen-class |
| 23:44 | ddellacosta | amalloy: hmm why crazy? |
| 23:49 | amalloy | ddellacosta: i mean, i could be wrong. if it's a protected method for a reason, then accessing it willy-nilly from anywhere doesn't sound like a good plan |
| 23:50 | amalloy | but i suppose people sometimes make things protected for no reason |
| 23:50 | seangrove | amalloy: I think especially in the Java world |
| 23:50 | amalloy | you can just define your own version of it that's public and delegates to the protected one |
| 23:51 | ddellacosta | amalloy: that's what I intend to do. I was hoping I could do that with proxy, but seems pretty clear I have to use hen-class. :-( |
| 23:51 | ddellacosta | *gen-class |
| 23:52 | amalloy | wow, is proxy-super not thread-safe? the source looks that way |
| 23:52 | clj_newb_2345 | when communicating data back and forth clojure and clojurescript over a websocket, is json the ideal way to serialize? |
| 23:53 | xeqi | clj_newb_2345: I'd consider edn |
| 23:53 | clj_newb_2345 | wait, can't I just use "read" ? |
| 23:53 | ddellacosta | amalloy, seangrove: why I'm calling a protected method: I'm extending Apache Shiro, and need to invalidate the cache. I'm only using authorization capabilities of Shiro so I don't rely on their framework to manage the overall flow--I using bits and pieces as suits me. As such, I'm doing stuff like what "framework implementers" (according to their docs) do, more or less, so I have some reasonable use-cases for calling protected |
| 23:53 | ddellacosta | methods. |
| 23:53 | ddellacosta | *I am using bits and pieces |
| 23:53 | clj_newb_2345 | xeqi: http://clojure.github.io/clojure/clojure.edn-api.html ? |
| 23:54 | ddellacosta | clj_newb_2345: yep, edn is nice if you have a clojure <-> cljs thing going |
| 23:54 | clj_newb_2345 | ddellacosta: is there an example? |
| 23:54 | dissipate_ | clj_newb_2345, ideally you wouldn't have to worry about it at all. see web frameworks like opa and mojito. |
| 23:54 | clj_newb_2345 | well |
| 23:54 | xeqi | clj_newb_2345: yep, those are the read functions on the clojure side |
| 23:54 | clj_newb_2345 | I'm going sorta minimal |
| 23:55 | dissipate_ | clj_newb_2345, but i've been told that running clojurescript on the back end is blasphemy |
| 23:55 | ddellacosta | clj_newb_2345: er, I mean, it's just calling str/ read-string on either side, more or less |
| 23:55 | clj_newb_2345 | well |
| 23:55 | clj_newb_2345 | there are security issues no? |
| 23:55 | xeqi | not with the edn readers |
| 23:55 | xeqi | with clojure.core/read, possibly |
| 23:58 | ddellacosta | clj_newb_2345: yes, use clojure.edn/read-string, not clojure.core/read-string |
| 23:58 | clj_newb_2345 | noted; was confused; but undersand the difference now |
| 23:58 | clj_newb_2345 | thanks |
| 23:59 | ddellacosta | np |