2014-11-27
| 00:58 | mcblumperson | hey malakas |
| 01:19 | postpunkjustin | Is (go (while true ...)) considered an idiomatic way to read from a core.async channel? |
| 01:20 | postpunkjustin | I mean, to repeatedly take from that channel |
| 01:20 | postpunkjustin | I'm looking at this specifically and it just seems... odd: https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj#L91 |
| 01:22 | tomjack | postpunkjustin: that example assumes the channels never close, I think |
| 01:23 | postpunkjustin | Yeah, I'm not super excited about making that assumption. |
| 01:24 | justin_smith | yeah, it should be (while-let ...) I would think |
| 01:25 | postpunkjustin | justin_smith: yeah, that sounds perfect |
| 01:25 | justin_smith | if there were such thing as while-let |
| 01:25 | tomjack | one possibility is (go-loop [] (if-let [x (<! ch)] (do (stuff-with x) (recur)) (done))) |
| 01:25 | postpunkjustin | there easily can be |
| 01:26 | justin_smith | fair point, yeah :) |
| 01:27 | postpunkjustin | tomjack: That'll definitely work. Is it just me, or is that hella Erlangish? |
| 01:28 | tomjack | dunno, but that might be appropriate if erlang is a language designed for communicating processes :) |
| 01:28 | postpunkjustin | Yeah, not an insult by any means. It's just eerie. |
| 01:35 | postpunkjustin | Yep, while-let works great. Thanks! |
| 01:56 | dmahanta | why does group-by on a list returns a null (group-by :a ({:b 1 :a "User1"} {:b 1 :a "User1"} {:b 2 :a "User2"})) |
| 01:56 | dmahanta | but if i do this i get values (group-by :a [{:b 1 :a "User1"} {:b 1 :a "User1"} {:b 2 :a "User2"}]) |
| 01:56 | dmahanta | i am trying to group-by a result from zipmap |
| 01:57 | dmahanta | which lways returns a () |
| 01:57 | postpunkjustin | If you don't quote that list of maps, it uses the first map as a function |
| 01:58 | postpunkjustin | ,(group-by :a '({:b 1 :a "User1"} {:b 1 :a "User1"} {:b 2 :a "User2"})) |
| 01:58 | clojurebot | {"User1" [{:b 1, :a "User1"} {:b 1, :a "User1"}], "User2" [{:b 2, :a "User2"}]} |
| 02:02 | TEttinger | ,(group-by :a [{:b 1 :a "User1"} {:b 1 :a "User1"} {:b 2 :a "User2"}]) ; vectors are more idiomatic in clojure |
| 02:02 | clojurebot | {"User1" [{:b 1, :a "User1"} {:b 1, :a "User1"}], "User2" [{:b 2, :a "User2"}]} |
| 02:05 | dmahanta | thanks got it |
| 04:17 | dysfun | is there any documentation on how clojure implements persistent maps? |
| 04:17 | dysfun | i was about to resort to reading the code but would prefer something a bit more designed for humans than computers |
| 04:20 | dysfun | aha, i've found http://lampwww.epfl.ch/papers/idealhashtrees.pdf, which is apparently what they're based on |
| 04:22 | luxbock | dysfun: there's also this blog post: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice.html |
| 04:22 | dysfun | thanks |
| 04:25 | Glenjamin | http://hypirion.com/musings/understanding-persistent-vector-pt-1 is good for vectors |
| 04:27 | akkad | I don't how people debug these sorts of errors https://gist.github.com/fa2a102a4427aa22fa33 |
| 04:36 | dysfun | oh wow, that's special |
| 04:36 | dysfun | i think too much of the java stack is layered with too much magic :/ |
| 06:32 | mandelum | Hello, complete noob here, I would like to see how you could cycle through the themes in lighttable with some simple code? anywone wants to help? |
| 06:32 | mandelum | so that you could cycle though all themes supefast |
| 06:34 | mandelum | I know enough about clojure to know that there is some super clean and elegant way of doing this, but I have never actually coded in clojure |
| 06:35 | luxbock | mandelum: seems like this would be more of a LightTable question than a Clojure one |
| 06:36 | mandelum | but I am quite sure it is possible with like one line of code, no? |
| 06:36 | mandelum | you change the string in the end of this line [:editor :lt.objs.style/set-theme "default"] |
| 06:39 | luxbock | yeah I have no experience with LT so I don't really know how it would work |
| 06:39 | plllx | M why do you want to cycle through themes |
| 06:40 | plllx | like to identify one that you want or something? |
| 06:42 | TEttinger | mandelum: I imagine you'd define a hook or whatever LT calls user scripts |
| 06:43 | mandelum | probably, but no big deal |
| 06:43 | mandelum | :) |
| 06:51 | TEttinger | (lt.objs.style/set-theme (rand-nth (lt.objs.style/get-skins))) |
| 06:51 | TEttinger | mandelum, that should set the theme to a random theme from the installed list of themes |
| 06:51 | plllx | :) |
| 06:53 | TEttinger | you can stick that line in a command, https://github.com/LightTable/LightTable#commands (in the :exec stuff, after the (fn [] ) |
| 06:53 | TEttinger | but I must go to bed |
| 06:56 | martinklepsch | [humor/OT] Hello World, Enterprise Edition http://wiki.jetbrains.net/intellij/Developing_and_running_a_Java_EE_Hello_World_application |
| 07:16 | triss | hey all. if I've got an atom whose value is true or false whats the simplest way of setting it? |
| 07:17 | triss | currently i do: |
| 07:17 | triss | (defn recording-on [] (swap! recording (fn[r] true))) |
| 07:17 | triss | is there a neater way than using swap? I don't need to check what the value is currenlty |
| 07:20 | opqdonut | triss: reset! |
| 07:21 | opqdonut | ,(doc reset!) |
| 07:21 | clojurebot | "([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval." |
| 07:30 | triss | cheers opqdonut! |
| 07:39 | xelxebar | Playing around with lein-oneoff. Can't seem to get the dependencies to be resolved. Trying to run the example on the oneoff github page throws complaints about how compjure isn't found. |
| 07:40 | xelxebar | compojure* |
| 07:42 | clgv | martinklepsch: but seems to be informative on how to setup such an application skeleton |
| 07:43 | clgv | xelxebar: what's the error message? |
| 07:50 | xelxebar | clgv: Thanks for the help. Essentially "Could not locate compojure/core__init.class or compojure/core.clj on classpath" |
| 07:51 | clgv | xelxebar: nothing else before that? |
| 07:53 | xelxebar | clgv: Well, here's the whole stacktrace http://cwillu.com:8080/118.241.146.97/6 |
| 07:54 | xelxebar | oneoff is supposed to pull deps in to $HOME/.m2 I think and automagiacally set up your classpath from there |
| 07:55 | clgv | xelxebar: that example works like a charm here |
| 07:55 | xelxebar | If I've only got the org.clojure/clojure dep then things seem to run fine |
| 07:56 | clgv | xelxebar: did you copy the whole thing including defdeps? |
| 07:57 | clgv | xelxebar: I updated the deps to most recent versions - still works |
| 07:58 | xelxebar | clgv: Here's the file http://cwillu.com:8080/118.241.146.97/7 |
| 07:58 | clgv | xelxebar: did you try running it as "lein oneoff example.clj"? |
| 07:59 | xelxebar | clgv: yeah. I thought that maybe the shabang thing might have been screwing it up too |
| 08:00 | xelxebar | Thing is, if I strip it down to just the org.clojure/clojure dep then it's fine. (println "Hello, World!") and all that work as expected. |
| 08:00 | clgv | xelxebar: what does "lein version" say? |
| 08:01 | xelxebar | clgv: Leiningen 2.5.0 on Java 1.7.0_71 OpenJDK 64-Bit Server VM |
| 08:01 | clgv | ok |
| 08:05 | xelxebar | clgv: Any other tests you can think of to pin this down? I've evidently got something snafu'd. |
| 08:06 | clgv | xelxebar: no. no idea. |
| 08:06 | clgv | xelxebar: it worked out of the box here. I have never use lein oneoff before |
| 08:12 | xelxebar | :( |
| 08:13 | clgv | xelxebar: well, you can delete the ".m2" folder to start fresh. but all deps need to be redownloaded then |
| 08:15 | xelxebar | clgv: Tried it out. Works with a hello world but not with the example. :-/ |
| 08:16 | clgv | xelxebar: is compojure downloaded to .m2 |
| 08:20 | xelxebar | clgv: oddly enough, yes. as well as ring-jetty-adapter. versions match versions in example |
| 08:30 | clgv | xelxebar: regular projects are out of question? clojure isnt that well suited for cli scripts because of its startup time |
| 08:32 | xelxebar | clgv: I'm just mucking about with Project Euler. Seems a bit much to have 10s or eventually 100s of lein projects just for one off files really. |
| 08:33 | xelxebar | It's doable, but then I feel like I'm just circumventing a problem. lein oneoff should really be running regardless! |
| 08:36 | clgv | xelxebar: just create one project for all of your project euler stuff. one namespaces per exercise should work to structure it |
| 08:36 | Morgawr | just use a repl to call into specific problem solutions :) |
| 08:36 | Morgawr | that's what I did last time, at least |
| 08:36 | clgv | xelxebar: do you really need dependencies for project euler? |
| 08:37 | clgv | xelxebar: does project euler use a recent clojure version? |
| 08:38 | Morgawr | clgv: project euler is a website that gives out math/programming problems and you need to solve them to provide a solution.. I don't think "it" runs anything |
| 08:38 | Morgawr | it's up to you how you solve them |
| 08:39 | enn | I'm having a hard time understanding the use case for clojure.tools.trace/trace with a value. It just prints the value? How is that different than println? |
| 08:39 | clgv | Morgawr: ah ok. didnt they have runtimes up there? |
| 08:39 | clgv | Morgawr: I thought it was similar to 4clojure or spoj |
| 08:40 | clgv | enn: it traces nested calls, right? |
| 08:40 | Morgawr | clgv: not last time I checked (that is, 2 years ago) |
| 08:40 | Morgawr | it's just a text form where you input your solution (usually a number) |
| 08:40 | xelxebar | clgv: No. The "project" is implementation agnostic. It's just a collection of cool problems. |
| 08:40 | clgv | Morgawr: well they have not much info for people without an account, so I couldnt find out ;) |
| 08:40 | Morgawr | yeah, it's super secret club :P |
| 08:41 | xelxebar | Eeeeeuuuuuuler and the iluminati, man. |
| 08:41 | xelxebar | Really though. This is vexing that I can't add deps to a oneoff. :-/ |
| 08:42 | xelxebar | Wish I know how to go about troubleshooting this. |
| 08:42 | clgv | xelxebar: you got the latest version? |
| 08:42 | xelxebar | clgv: of oneoff and leiningen? Yeah. |
| 08:42 | clgv | xelxebar: just create one project. it is a onetime effort that take much less time than you already spent on lein oneoff ;) |
| 08:43 | xelxebar | clgv: Yeah, that might work. |
| 08:43 | xelxebar | clgv: But then I feel like I'm just shoving a latent problem under a rug... |
| 08:46 | clgv | xelxebar: not really. since lein oneoff is an additional plugin from a third party |
| 08:48 | xelxebar | clgv: Well, oneoff isn't working, but we don't know *why*. The root cause could lead to problems down the line. |
| 08:48 | xelxebar | clgv: Also, this is an opportunity to figure out how stuff works under the hood which is useful for debugging future problems too. |
| 08:48 | clgv | xelxebar: if the leiningen project works as supposed, it is very likely lein oneoff's fault ;) |
| 08:48 | xelxebar | clgv: But it works for you! |
| 08:49 | clgv | xelxebar: you overrate the debugging experience for this one ;) |
| 08:49 | clgv | xelxebar: I thought solving project euler problems is the task at hand ;) |
| 08:49 | mandelum | btw if anyone else ever cares about themes http://tmtheme-editor.herokuapp.com/ |
| 08:50 | xelxebar | clgv: Learning Clojure and the process of development in cojure is the actual goal. Project Euler is really just a means for me. |
| 08:50 | clgv | xelxebar: ok, lein oneoff is not a significant part of development in clojure |
| 08:52 | xelxebar | clgv: You're really set on this one aren't you. lol. I'm fine if we can just chock it up to a oneoff problem, but given that you were able to run it fine, this seems likely to be some issue with my environment/setup. |
| 08:52 | mavbozo | xelxebar: sorry, just joined in. have you tried 4clojure.com? |
| 08:53 | mavbozo | it's easier path to learn clojure |
| 08:53 | clgv | xelxebar: I'd recommed to check whether a normal leiningen project with these dependencies works for you |
| 08:53 | xelxebar | mavbozo: I saw where clgv mentioned it above. Seems interesting! |
| 08:54 | mavbozo | xelxebar: it helps you to just focus on the clojure constructs |
| 08:56 | mavbozo | xelxebar: working on project euler problems brings me toward unhealthy obsession with program execution speed. |
| 08:57 | xelxebar | clgv: Good idea. I've created a new lein 'app' and dropped in the deps in lein oneoff. |
| 08:57 | xelxebar | not really sure how to run it though :-/ |
| 08:57 | clgv | lein repl |
| 08:57 | clgv | which editor do you usually use? |
| 09:00 | xelxebar | clgv: Huh. `lein run` spit out "Hello, World" just fine, but `lein repl` is complaining: "Exception in thread "main" java.lang.IllegalStateException: Var null/null is unbound. " |
| 09:00 | xelxebar | I use vim almost exclusively. |
| 09:03 | clgv | is a blowup of factor 6 in memory consumption for clojure hashmaps compared to plain mutable tuples realistic? |
| 09:04 | xelxebar | clgv: Okay... So I upped the version numbers to the most recent and `lein repl` and that previous exception disappeared. |
| 09:04 | xelxebar | Probably has something to do with the version of nrepl I'm using... |
| 09:05 | clgv | or outdated dependencies |
| 09:05 | clgv | there was a huge leap from clojure 1.2.1 to 1.3 - the lein oneoff example seems to be from the 1.2.1 era |
| 09:08 | xelxebar | clgv: Okay. I'll take you're advice and say screw it to oneoff. Would you mind walking me through how I'd set up a project where I could indepedently run any of a bunch of individual files? |
| 09:08 | enn | clgv: afaict, trace doesn't trace any calls at all, only trace-vars and trace-ns do. Trace just prints and returns its evaluated argument. |
| 09:09 | clgv | enn: I thought its readme says otherwise but maybe wrong... |
| 09:09 | clgv | xelxebar: you could use vim fireplace then |
| 09:10 | clgv | xelxebar: it adds clojure integration to vim |
| 09:10 | xelxebar | clgv: Already am! |
| 09:10 | clgv | xelxebar: so you should be able to evaluate code from vim |
| 09:10 | clgv | and have a repl |
| 09:10 | clgv | xelxebar: I dont use that one myself |
| 09:11 | xelxebar | so just `lein new app` should work fine? |
| 09:11 | xelxebar | I really don't know how this dependency magic works |
| 09:11 | clgv | xelxebar: maybe some setup in vim fireplace is required? you have to consult its docs. usually you then have a repl and can switch to the namespace of the file you are editing and run its functions in the repl |
| 09:12 | clgv | xelxebar: e.g. when spinning up the repl, leiningen handles dependency resolution |
| 09:12 | xelxebar | clgv: I've got fireplace running just fine. Guess I'm just wondering if there's some skeletal lein template that will give me only enough to run these files. |
| 09:13 | xelxebar | Would creating a project.clj file manually be enough? |
| 09:13 | clgv | xelxebar: lein new yourprojectname |
| 09:14 | clgv | but yeah, you can also create it manually |
| 09:15 | xelxebar | clgv: goodness. that was an obvious one. :P |
| 09:15 | xelxebar | clgv: Thanks for putting up with all my n00b questions |
| 09:18 | superbob` | I'm building an app with the aid of Freactive, do I loose/break anything by just pulling in vanilla bootstrap? |
| 09:19 | clgv | :D |
| 09:23 | dcunit3d | why does (dec -9223372036854775808) blow up, but not (dec -9223372036854775809) ? |
| 09:23 | mavbozo | ,(dec -9223372036854775809) |
| 09:23 | clojurebot | -9223372036854775810N |
| 09:23 | Bronsa | ,(class -9223372036854775809) |
| 09:23 | clojurebot | clojure.lang.BigInt |
| 09:23 | Bronsa | ,(class -9223372036854775808) |
| 09:23 | clojurebot | java.lang.Long |
| 09:24 | dcunit3d | it's right on the negative minimum for 64 bit numbers |
| 09:24 | Bronsa | dcunit3d: dec doesn't auto promote, so you're getting the overflow for -9223372036854775808 |
| 09:25 | Bronsa | dcunit3d: but -9223372036854775809 is already a bigint so no overflow |
| 09:25 | clgv | ,(unchecked-dec -9223372036854775808) ; :D |
| 09:25 | clojurebot | 9223372036854775807 |
| 09:26 | Bronsa | ,(dec' -9223372036854775808) |
| 09:26 | clojurebot | -9223372036854775809N |
| 09:27 | dcunit3d | Bronsa: that's what i was thinking it was |
| 09:27 | dcunit3d | but assumed that it would promote |
| 09:28 | Bronsa | dcunit3d: no, the normal math ops don't autopromote. you have to use the autopromoting versions |
| 09:28 | Bronsa | e.g. inc' dec' +' -' |
| 09:30 | Bronsa | dcunit3d: btw ##(doc dec) |
| 09:30 | lazybot | ⇒ "([x]); Returns a number one less than num. Does not auto-promote longs, will throw on overflow. See also: dec'" |
| 09:37 | dcunit3d | Bronsa: cool, i keep forgetting that i can look up docs in the repl |
| 09:37 | dcunit3d | i'm trying to do some things with binary using 64bit integers, but running into some issues at the min/max values |
| 09:54 | triss | ok so I'm using assoc to update a maps values... |
| 09:54 | triss | I'd like to update two values and return that |
| 09:55 | triss | what does kvs mean in the help: (assoc map key val & kvs) |
| 09:56 | triss | doe sthis mean I can specify more than one key/value pair to update? |
| 09:56 | ToxicFrog | triss: & is varargs. So yes. |
| 09:56 | ToxicFrog | ,(assoc {} :a 1 :b 2) |
| 09:56 | clojurebot | {:b 2, :a 1} |
| 09:56 | triss | awesome thanks ToxiFrog! |
| 09:56 | ToxicFrog | triss: and indeed if you look at the documentation: http://clojuredocs.org/clojure.core/assoc |
| 09:56 | ToxicFrog | There are examples showing exactly that. |
| 09:58 | triss | doh. I've been using the API ref here: http://clojure.github.io/clojure/clojure.core-api.html |
| 09:59 | triss | many many thanks for that. the docs look a lot nicer here! |
| 10:00 | xelxebar | clgv: I got the proper lein project all set up fine! I'm really curious how leiningen works its dependency magic. |
| 10:02 | clgv | xelxebar: it uses maven central and clojars.org as default repositories to resolve dependencies |
| 10:08 | justin_smith | xelxebar: it's not really magic. Each artifact has a pom file that lists its dependencies, so lein walks the tree, pulling the poms as needed, until there are no more deps to find. Then it does some conflict-resolution so only one version of each artifact is pulled in. Then it downloads all the needed artifacts and sets the classpath so each one is on it. |
| 10:09 | justin_smith | not super different than how a distro package manager works on linux |
| 10:09 | nonuby | yesql (https://github.com/krisajenkins/yesql) makes the claim "Better editor support. Your editor probably already has great SQL support. By keeping the SQL as SQL, you get to use it." however I can't see Im meant to subsitute parameters (?) when open the sql in say pgadmin3 or any other editor? |
| 10:10 | nonuby | unless I do a tedius replace and put back in which kind of isn't a great sell |
| 10:10 | justin_smith | I think it means text editor, not GUI query building tool |
| 10:11 | justin_smith | ie. when I open my sql file in emacs, I get proper indentation, syntax hightlighting, etc. |
| 10:11 | nonuby | possibly seems a odd complain as most will complain like fuck about a random ? |
| 10:11 | nonuby | ? -> "?" |
| 10:12 | justin_smith | emacs doesn't... maybe it's weird |
| 10:14 | nonuby | also Team interoperability. Your DBAs can read and write the SQL you use in your Clojure project.. Easier performance tuning. Need to EXPLAIN that query plan? It's much easier when your query is ordinary SQL. Query reuse. Drop the same SQL files into other projects, because they're just plain ol' SQL. Share them as a submodule.... |
| 10:15 | nonuby | so im not missing some magic trick with some unknown standard parameter subsitution that applicable across all editors, sql query runners... kind of doubting myself for a minute then |
| 10:15 | martinklepsch | are there helpers to download patches from a jira ticket or does everyone click, download and move those files? |
| 10:16 | justin_smith | nonuby: I guess if you can't accept placeholders in your sql, then yesql is unacceptable. But there is nothing else that gets that close to just being sql, other than plain sql files with no clojure integration at all. |
| 10:34 | xelxebar | justin_smith: Appreciate the high-level description. I'm wanting to get a handle off the different layers of abstraction involved. Perhaps it'd be worthwhile directly workind with the clojure jar and jvm for a bit just to get a feel for how things fit together... |
| 10:35 | justin_smith | xelxebar: java -cp jars:go:here clojure.main |
| 10:35 | justin_smith | that's it |
| 10:36 | xelxebar | But then you've gotta worry about classpath stuff, no? |
| 10:36 | justin_smith | right, build it yourself or let lein build it |
| 10:36 | justin_smith | lein is a classpath building tool |
| 10:37 | xelxebar | I'm gonna dig into this for a bit. |
| 10:37 | justin_smith | the "layers of abstraction" are - figure out what artifacts are needed, and build a classpath |
| 10:37 | justin_smith | it doesn't go very deep |
| 10:39 | xelxebar | Hehe. Simple enough. |
| 10:39 | justin_smith | now there are other features that get added to lein, for other tasks at compile / launch time. But you don't need to opt into those. |
| 10:42 | justin_smith | xelxebar: also, there is the option of a) lein cp > classpath.txt b) java -cp $(cat classpath.txt) clojure.main |
| 10:42 | justin_smith | that means you only run lein once for each time you update your deps |
| 10:43 | justin_smith | only have to run it once, that is |
| 10:43 | xelxebar | oh cool |
| 10:44 | justin_smith | though that only runs the clojure.main repl, and "lein repl" gives you the clojure.tools.nrepl one (which has extra stuff like readline bindings, network port to connect to, tab completion) |
| 10:44 | justin_smith | but, as mentioned, you can opt out of all the fanciness if you desire to do so |
| 10:44 | clojurebot | Huh? |
| 10:46 | xelxebar | justin_smith: running the repl directly seems to still have tab completion! |
| 10:47 | justin_smith | ahh, I didn't realize |
| 10:47 | justin_smith | you can use rlwrap to get line editing back |
| 10:47 | justin_smith | (on linux or mac at least - I dunno if you can get rlwrap for windows) |
| 10:49 | xelxebar | How would one go about building a jar say to just run your hello-world.clj, say? |
| 10:49 | justin_smith | the easy way is to declare your main ns in project.clj, and make sure there is a -main taking varargs of string; then use lein uberjar |
| 10:50 | justin_smith | the other way would be to build your own (uber?)jar, but I haven't dived into that |
| 10:51 | xelxebar | What's the difference between the uberjar and jar? An uberjar packes all dep classes in it or something? |
| 10:51 | justin_smith | right, all transitive dependencies |
| 10:52 | justin_smith | it's what I use for deployment, then all the server machine needs is a jvm |
| 10:52 | ToxicFrog | xelxebar: exactly. Uberjar can be distributed standalone because all the deps are built into it. |
| 10:52 | justin_smith | TEttinger2 was even working on a plugin that would bundle the jvm into the executable uberjar, so you wouldn't even need a vm pre-installed on the target |
| 10:53 | justin_smith | at the cost of a very large jar... |
| 10:53 | ordnungswidrig | justin_smith: you should go full throttle and bundle a vm image :-) |
| 10:54 | justin_smith | xelxebar: I guess you could follow this guide if you wanted to build a jar from the command line, but lein does make it very easy https://docs.oracle.com/javase/tutorial/deployment/jar/build.html |
| 10:54 | xelxebar | If we're going that far, might as well compile clojure directly to and elf |
| 10:55 | justin_smith | well, that requires writing a new clojure compiler |
| 10:55 | mavbozo | that's a good solution for devs with > 50 MB/sec data rate internet connection or intranet deployment only |
| 10:55 | xelxebar | Is anyone working on a clojure to C compiler or something? |
| 10:55 | mavbozo | xelxebar: LLVM precisely |
| 10:56 | xelxebar | sexy |
| 10:56 | justin_smith | xelxebar: there have been a few things like that, but nothing usable at the moment. Good luck making a gc and vm that beats java, and clojure really needs a gc and vm. |
| 10:56 | xelxebar | thask for the link, justin_smith |
| 10:59 | SagiCZ1 | is 'enm' not a valid Java identifier? |
| 10:59 | mavbozo | justin_smith: have you heard anything about clojure using erlang vm? |
| 10:59 | justin_smith | SagiCZ1: I can't see why it wouldn't be, unless there is some nasty unicode hiding in there |
| 10:59 | justin_smith | mavbozo: not at all |
| 10:59 | SagiCZ1 | justin_smith: thank you |
| 11:00 | SagiCZ1 | justin_smith: oh it actually was 'enm;' cant believe i didnt see that |
| 11:00 | justin_smith | hmm, does ; count as hidden unicode? lol |
| 11:01 | SagiCZ1 | justin_smith: IMO totally haha |
| 11:04 | piero_d_s | hello |
| 11:04 | piero_d_s | need a little help with melpa |
| 11:05 | piero_d_s | from here: http://melpa.org/#/getting-started |
| 11:05 | piero_d_s | (add-to-list 'package-archives |
| 11:05 | piero_d_s | '("melpa-stable" . "http://stable.melpa.org/packages/") t) |
| 11:05 | piero_d_s | but |
| 11:05 | justin_smith | piero_d_s: maybe someone here can help, but #emacs is more likely to be helpful |
| 11:05 | piero_d_s | ok thanks |
| 11:06 | justin_smith | piero_d_s: there is also #clojure-emacs if this is cider / clojure-mode related |
| 11:06 | piero_d_s | yes indeed, thanks |
| 11:25 | clgv | xelxebar: https://github.com/pixie-lang/pixie |
| 11:28 | xelxebar | clgv: Interesting. I've also peeked at racket a bit before. |
| 11:56 | sm0ke | hello i write a whole app with reagent with :whitespace optimization in cljsbuild profile |
| 11:57 | sm0ke | today i tried to swtich it to :advanced and nothing seems to work |
| 11:57 | sm0ke | is it supposed to be like this? |
| 12:04 | beppu | sm0ke: you have to be careful with advanced compilation, especially if you're using 3rd party js libs: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html |
| 12:09 | sm0ke | beppu: thanks for the link, will have a look |
| 12:18 | Psy-Q | i might be too stupid, but for some reason when i try to scrape an HTML page with enlive, each element i find is surrounded by seemingly random amount of whitespace and linebreaks. is there some convenience function in enlive that would remove that so i don't have to roll my own? |
| 12:19 | Psy-Q | as in here, this would return a lot of "/n Foo - Bar ": https://github.com/psy-q/vinylla/blob/master/crawler/app/src/app/core.clj#L21 |
| 12:20 | justin_smith | Psy-Q: this ensures that when rendered again you get the same content |
| 12:21 | CookedGryphon | does anyone know if it's possible to apply the equivalent of java's synchronised methods to a function invocation (i.e. synchronising without using the locking macro) |
| 12:22 | justin_smith | you can use clojure.string/trim ##(clojure.string/trim "/n Foo - Bar ") |
| 12:22 | lazybot | ⇒ "/n Foo - Bar" |
| 12:22 | justin_smith | hmm |
| 12:22 | justin_smith | you can use clojure.string/trim ##(clojure.string/trim (clojure.string/trim-newline "/n Foo - Bar ")) |
| 12:22 | lazybot | ⇒ "/n Foo - Bar" |
| 12:22 | justin_smith | weird |
| 12:23 | justin_smith | oh, that's not \n, that is /n |
| 12:25 | justin_smith | CookedGryphon: the docs for locking claim that it is the equivalent of Java's synchronized |
| 12:25 | justin_smith | https://clojuredocs.org/clojure.core/locking |
| 12:27 | Psy-Q | oh, did i type /n? sorry! |
| 12:27 | Psy-Q | justin_smith: and thanks, that explains it |
| 12:27 | CookedGryphon | justin_smith: I know, it's the equivalent of a synchronized block, I want to know if anyone has implemented synchronized method annotation |
| 12:27 | Psy-Q | i like the way the transforms and the selectors work in enlive, if i can trim that output and keep it around, that'd be fantastic |
| 12:27 | clgv | CookedGryphon: the clojure compiler would need to support this for regular functions |
| 12:27 | justin_smith | CookedGryphon: clojure supports annotations, but I keep forgetting how it is done. There is a gist from rich hickey on github that demonstrates it |
| 12:28 | justin_smith | but if it's an annotation that drives javac, then yeah it won't help much unless you are getting compiled by javac |
| 12:28 | clgv | is "synchronized" only an annotation? |
| 12:29 | justin_smith | clgv: it is a syntax, which locking claims to be equivalent to |
| 12:29 | clgv | justin_smith: yeah and I think in java the compiler actually does some code generation for that |
| 12:29 | clgv | or adds a special byte code item |
| 12:29 | justin_smith | but there is also @Synchronized as an annotation |
| 12:30 | clgv | justin_smith: does it work the same? or is it just docs? |
| 12:30 | justin_smith | oh, that's a lombok thing I guess... |
| 12:30 | justin_smith | never mind, the annotation is a lombok directive |
| 12:32 | Psy-Q | justin_smith: fantastic, it works with clojure.string/trim. i'll try splitting things now and once the scraper works i guess it's off to code review somewhere :) |
| 12:32 | justin_smith | cool |
| 12:35 | clgv | not only maven downloads the whole internet, the eclipse dialog to install new software does so as well... |
| 12:36 | CookedGryphon | it's not an annotation |
| 12:37 | CookedGryphon | it's a bytecode marker on the function definition, like abstract etc. |
| 12:37 | justin_smith | CookedGryphon: right, I was misled by something from lombok, sorry |
| 12:37 | CookedGryphon | and is different to the synchronized block which inserts a monitor-enter, monitor-exit instruction |
| 12:37 | CookedGryphon | and locking isn't exactly equivalent on a bytecode level to java language's implementation |
| 12:38 | CookedGryphon | which is causing me issues, so I was wondering if anyone knew how I'd go about wiring the compiler up to emit the marked method variation instead |
| 12:38 | CookedGryphon | so I might be able to reimplement locking |
| 12:44 | jballanc | Am I reading this code right: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6596 ? Slurp reads a byte at a time? |
| 12:44 | jballanc | How is that not horribly inefficient? |
| 12:46 | clgv | jballanc: with buffered readers underneath that should be fine |
| 12:46 | clgv | jballanc: at least with respect to os io overhead |
| 12:47 | jballanc | Sure io overhead...I wonder if the JIT can optimize at all |
| 12:47 | jballanc | but it doesn't seem like there's any chance for unrolling or the like |
| 12:48 | clgv | jballanc: what overhead concerns you then? method calls? |
| 12:48 | jballanc | yeah |
| 12:50 | jballanc | I mean, granted that slurp probably isn't the wisest choice for large files to begin with... |
| 12:50 | jballanc | but I've seen it used for such |
| 12:52 | clgv | jballanc: I think `slurp` is just a general purpose "oh lets read that in and try my functions on it" tool |
| 12:53 | jballanc | oh, I know |
| 12:53 | Psy-Q | wouldn't you be using some java reader or such if you need performance? |
| 12:53 | justin_smith | clearly, now one of us must write turbo-slurp |
| 12:54 | jballanc | just, in my experience, since slurp is so easy, and every other IO class in Java is a pain to work with, slurp ends up being used places it probably shouldn't |
| 12:54 | jballanc | justin_smith: I'd settle for something with an API similar to the File libs from Ruby or Python |
| 12:55 | jballanc | i.e. don't make me allocate my own byte[] just because I want to read more than one char at a time |
| 13:07 | justin_smith | jballanc: if the arg to slurp is buffered, the underlying input will be buffered, and the jvm will hella-optimize a small eager loop like that |
| 13:08 | justin_smith | the .read called there isn't always a filesystem read, it's likely calling to a buffer, which is not going to read one char at a time, no matter what you ask for |
| 13:08 | jballanc | justin_smith: that's what I'd hope...just never benchmarked it myself |
| 13:08 | jballanc | ...honestly, I never thought slurp was byte-at-a-time :-/ |
| 13:08 | justin_smith | extra buffering inside slurp would likely hurt performance, since the input is already buffered in all but the most pathological case |
| 13:09 | justin_smith | jballanc: that doesn't matter, because the access to the underlying data is not one byte at a time |
| 13:09 | jballanc | but the loop is one at a time |
| 13:09 | justin_smith | sure, and like I said, the JIT can fix that |
| 13:09 | justin_smith | that's the kind of thing the JIT is very good at |
| 13:09 | jballanc | which still means there's as many calls to read as bytes in the array |
| 13:11 | justin_smith | maybe not, after JIT |
| 13:11 | jballanc | justin_smith: I don't doubt it, but I'd love to know how it's doing that |
| 13:11 | justin_smith | OK, criterium is great for benchmarking, it should be easy to make a few versions of slurp and try them out |
| 13:11 | justin_smith | it will even warn you if JIT isn't on |
| 13:12 | jballanc | will have to give it a go |
| 13:19 | jaaqo | Ehh. c3p0.DtiverManagerDataSource is throwing ClassNotFoundException: com.postgresql.Driver, yet my applications database seems to be working... My setup is as in clojure docs connection pool example word to word basically.. |
| 13:20 | jaaqo | Does it c3p0 fall back to something else or how am I supposed to interpret this |
| 13:21 | justin_smith | jaaqo: weird. If your app can find the driver, c3p0 should find it. can you make a paste of the relevant part of your code? |
| 13:38 | kenrestivo | ok, what is (∀ ? |
| 13:38 | kenrestivo | i know what λ is, but what's the other one? |
| 13:38 | Bronsa | every |
| 13:38 | justin_smith | M-x describe-char in emacs says "for all" |
| 13:38 | Bronsa | ,(doc every?) |
| 13:38 | clojurebot | "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false." |
| 13:38 | justin_smith | so yeah, every |
| 13:38 | justin_smith | kenrestivo: if you are an emacs user, describe-char is awesome |
| 13:39 | kenrestivo | thanks. but, weird. why not just write out "every"? context: http://crossclj.info/fun/clojure.core/deref.html |
| 13:39 | justin_smith | also helpful for things that won't display - you can at least get the name of the non-displayed thing |
| 13:39 | justin_smith | crossclj makes really weird UI decisions |
| 13:40 | justin_smith | great content, odd UI |
| 13:40 | Bronsa | it's not really unusual to use greek symbols in type signatures though |
| 13:40 | Bronsa | kenrestivo: in that context it has the math meaning of forall |
| 13:40 | kenrestivo | ok, thanks. |
| 13:41 | kenrestivo | where do those type declarations come from? |
| 13:41 | daGrevis | hey! what's the idiomic way to check if string is empty? |
| 13:41 | Bronsa | kenrestivo: core.typed |
| 13:41 | kenrestivo | i don't remember seeing them in the actual clojure.core source |
| 13:41 | daGrevis | s/idiomic/idiomatic sorrs |
| 13:41 | justin_smith | daGrevis: #(= % "") or empty? I guess, each have arguments in their favor |
| 13:42 | daGrevis | what arguments if it's not a secret? :) |
| 13:43 | justin_smith | empty? reads more clearly, #(= % "") does the minimum amount of work |
| 13:44 | andyf_ | empty? also returns true for empty collections, not just strings. |
| 13:44 | daGrevis | i read that it was bad to use empty? on coll |
| 13:44 | justin_smith | well, "" is not a coll, so you are in luck there - but what was the reasoning for not using empty? |
| 13:45 | justin_smith | &(doc empty?) |
| 13:45 | lazybot | ⇒ "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))" |
| 13:45 | daGrevis | ^ yes that |
| 13:45 | justin_smith | that doesn't say what you said |
| 13:45 | daGrevis | well i meant to say that :/ |
| 13:45 | justin_smith | it says (not (empty? x)) is (seq x) |
| 13:45 | andyf_ | (seq x) is recommended of (not (empty? x)). It is not saying never use empty? |
| 13:46 | andyf_ | s/of/instead of/ |
| 13:46 | daGrevis | y, my bad. i didnt remember it correctly |
| 13:46 | daGrevis | ,(seq "") |
| 13:46 | clojurebot | nil |
| 13:46 | daGrevis | ,(seq "a") |
| 13:46 | clojurebot | (\a) |
| 13:46 | daGrevis | i could use seq, right? |
| 13:46 | justin_smith | yeah, but that does even more useless work |
| 13:47 | andyf_ | I highly recommend not using (not (seq s)) instead of (empty? s) :-) |
| 13:47 | justin_smith | if what you are really checking for is a non-empty string, I would use #(not= % "") |
| 13:47 | daGrevis | imo (not (empty? %)) sounds the best but docs says that i need to use seq in cases like that so im a bit confused : |
| 13:48 | justin_smith | #(and % (not= % "")) |
| 13:48 | justin_smith | that catches the nil case too |
| 13:48 | andyf_ | daGrevis: It said please, not must |
| 13:48 | daGrevis | andyf_, true that :) |
| 13:48 | justin_smith | the problem is (seq "adfka....askfj") creates a big data structure you don't use at all, since strings are not lazy |
| 13:48 | daGrevis | ,(= "" false) |
| 13:48 | clojurebot | false |
| 13:49 | daGrevis | too bad |
| 13:49 | daGrevis | ahh i'll just use not= |
| 13:49 | daGrevis | ty |
| 13:50 | justin_smith | &(map #(and % (not= % "")) ["hello" nil ""]) |
| 13:50 | lazybot | ⇒ (true nil false) |
| 13:50 | justin_smith | so it correctly only gives you the first of the three |
| 13:50 | daGrevis | i believe it works correctly |
| 13:50 | Bronsa | justin_smith: that's not true, stringseq is like subvec, it just holds the string + index |
| 13:50 | daGrevis | im not sure if I can ever get nil there tho |
| 13:51 | justin_smith | Bronsa: oh? that's excellent news, I had no idea |
| 13:51 | justin_smith | in that case ##(map #(boolean (seq %)) ["hello" nil ""]) |
| 13:51 | lazybot | ⇒ (true false false) |
| 13:52 | justin_smith | or skip the boolean check even |
| 13:52 | daGrevis | pretty readable, imo :) https://gist.github.com/b2dfed11cd5af04a291d |
| 13:53 | verma | clojuredocs API seems to be denying my api requests, because of CORS stuff, I thought it was an open API |
| 13:53 | verma | trying out their package to see if that works |
| 13:54 | justin_smith | daGrevis: what is that .preventDefault method? -- oh wait, cljs |
| 13:54 | justin_smith | verma: as I mentioned before, grimoire has an api that is meant to be queried |
| 13:54 | justin_smith | verma: and if you get issues with that, arrdem is often around to address them |
| 13:55 | verma | nice, justin_smith taking a look now |
| 13:56 | verma | oh nice |
| 13:56 | verma | were the examples there imported over from clojuredocs |
| 13:56 | verma | ? |
| 13:56 | verma | or were they sourced dfifferently? |
| 13:56 | justin_smith | yeah - arrdem made grimoire because clojuredocs was so slow to update |
| 13:56 | verma | arrdem: ^ :P |
| 13:56 | verma | oh ok |
| 13:56 | justin_smith | and he imported the content (with permission) from clojuredocs |
| 13:57 | verma | much nice! |
| 13:57 | razum2um | ,(instance? clojure.lang.LazySeq (seq (hash-map))) |
| 13:57 | clojurebot | false |
| 13:57 | razum2um | why? |
| 13:57 | clojurebot | why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 13:57 | andyf_ | verma: Did you try the cd-client lib, or something else? |
| 13:57 | daGrevis | don't hate firefox :D |
| 13:57 | Bronsa | razum2um: seq has little to do with lazy-seqs |
| 13:58 | verma | andyf_: no not yet, justin_smith already sold me on grimoire |
| 13:58 | razum2um | Bronsa: I ask why getting keys and vals of hash-map isn't lazy |
| 13:58 | razum2um | *they both use seq under the hood in RT.java |
| 13:59 | justin_smith | razum2um: seq isn't a concrete implementation, it's an interface right? |
| 14:00 | razum2um | justin_smith: i talk about this: APersistentMap.ValSeq.create(seq(coll)); |
| 14:00 | verma | I feel the browser interfaces are nice, but they always force the user to go though this generic channel which everyone hopes works (browsers etc.) clojuredocs and grimoire look awesome but such a context switch to interact with them. |
| 14:00 | justin_smith | right, and seq is an interface method |
| 14:00 | verma | I like dash since its a dedicated documentation interface |
| 14:00 | verma | which I can bind to a key |
| 14:01 | justin_smith | razum2um: and the way that coll implements seq, in that context, has no laziness to it |
| 14:01 | verma | but there's one thing about generic tools |
| 14:01 | Bronsa | razum2um: there's no lazyness that could be added to the current impl |
| 14:01 | verma | they suck at user experience :( |
| 14:01 | Bronsa | razum2um: maps are non lazy so all the elements are already realized |
| 14:02 | Bronsa | razum2um: calling vals/keys on a map is a constant operation |
| 14:03 | razum2um | Bronsa: yep, thanks, but still - could we have lazy maps build by (zipmap) from 2 lazyseq's? |
| 14:03 | justin_smith | razum2um: there are lazy-maps in libraries |
| 14:03 | justin_smith | but none in clojure.core |
| 14:03 | justin_smith | and they would have their own seq impl, that would likely be lazy |
| 14:03 | technomancy | https://twitter.com/benontherun/status/537580012892086272 |
| 14:04 | razum2um | justin_smith: ok, thanks :) |
| 14:04 | Bronsa | razum2um: the issue with lazy maps is that they behave in a weird way on conflicts |
| 14:05 | verma | nice api arrdem :) |
| 14:05 | Bronsa | razum2um: e.g. (zipmap '(1 2 1) '(1 2 3)) |
| 14:06 | triss | so i guess the simplest way of getting rid of duplicates in a list is to convert it to a set? |
| 14:06 | triss | how do i do that? |
| 14:06 | Bronsa | triss: there's also dedupe |
| 14:06 | justin_smith | (doc set) |
| 14:06 | Bronsa | ,(dedupe '(1 2 3 1 2 3 4)) |
| 14:07 | clojurebot | "([coll]); Returns a set of the distinct elements of coll." |
| 14:07 | clojurebot | (1 2 3 1 2 ...) |
| 14:07 | Bronsa | uhm. nevermind |
| 14:07 | Bronsa | dedupe is for consecutive duplicate elements |
| 14:07 | Bronsa | ,(dedupe '(1 1 2 2 3 3)) |
| 14:07 | clojurebot | (1 2 3) |
| 14:07 | justin_smith | &(set '(1 2 3 1 2 3 5)) |
| 14:07 | razum2um | ,(set '(1 2 1 2 3 1)) |
| 14:07 | lazybot | ⇒ #{1 3 2 5} |
| 14:07 | triss | ah thanks justin_smith/Bronsa |
| 14:07 | clojurebot | #{1 3 2} |
| 14:08 | triss | and razum2um |
| 14:08 | triss | bit obvious really! |
| 14:08 | razum2um | ,(into #{} '(1 2 3 1 2 3)) |
| 14:08 | clojurebot | #{1 3 2} |
| 14:08 | razum2um | is there a difference between them? |
| 14:09 | justin_smith | $source into |
| 14:09 | lazybot | into is http://is.gd/caQYZB |
| 14:09 | justin_smith | $source set |
| 14:09 | lazybot | set is http://is.gd/CrvBh4 |
| 14:09 | Bronsa | razum2um: don't think so, no the impls should be the same |
| 14:10 | Bronsa | one is in java and the other in clojure but they both loop over the coll + use transients |
| 14:12 | razum2um | justin_smith: nice bots ;) are there any connectors for slack.com/kato.im/hichat for them? |
| 14:13 | justin_smith | not that I know of |
| 14:13 | justin_smith | they are both open source |
| 14:14 | justin_smith | if you want to run one and connect it to one of those chat services |
| 14:14 | justin_smith | a clojure evaluator that responds to IM could be cool |
| 14:14 | justin_smith | jabber would likely be easier |
| 14:15 | jaaqo | exit |
| 14:17 | verma | andyf_: its weird, I can curl the URL and get stuff, so not clojuredocs problem |
| 14:18 | andyf_ | verma: You are trying cd-client lib again? |
| 14:18 | verma | no, I need this to run in clojurescript |
| 14:19 | verma | I was just wondering why it isn't working |
| 14:19 | verma | + not sure grimoire provides search |
| 14:26 | justin_smith | $grim clojure.core/filter |
| 14:26 | lazybot | http://grimoire.arrdem.com/1.6.0/clojure.core/filter |
| 14:26 | justin_smith | verma - search like that, or more general? |
| 14:27 | verma | more general |
| 14:27 | verma | like "fil" -> ["filter" "filtype" ...] |
| 14:27 | verma | I mean I could write my own |
| 14:27 | verma | but it probably won't be as good :) |
| 14:28 | justin_smith | yeah, I seem to recall arrdem was working on something like that, but I don't know how ready it is |
| 14:33 | verma | justin_smith: that would be nice, anyway don't think clojuredocs sent me search results in any specific order, e.g. for "m" I got "sum" as the first result :/ |
| 14:33 | verma | so I would still have to process them a bit |
| 14:35 | verma | may be I should use the API clojuredocs is itself using, instead of the documented one :/ |
| 14:42 | kenrestivo | is this the most idiomatic/bulletproof way to start/stop a go-loop as if it were a daemon/thread? https://www.refheap.com/94123 |
| 14:44 | verma | kenrestivo: closing a chan also always returns nil on waiting <! |
| 14:45 | arrdem | justin_smith: verma: not yet on that API |
| 14:45 | arrdem | in hiding from relatives it's more than likely to get finished today tho |
| 14:45 | verma | arrdem: nice! |
| 14:46 | verma | you can tell your relatives that there's an internet emergency |
| 14:46 | arrdem | lel |
| 14:46 | arrdem | I just don't want to watch frozen for the 50th time |
| 14:46 | arrdem | it's easy |
| 14:47 | arrdem | and my phone is flat so I'm bound to my computer for screening noise :/ |
| 14:47 | arrdem | alright. api time. |
| 14:47 | arrdem | verma: https://github.com/clojure-grimoire/grimoire/issues/84 |
| 14:47 | arrdem | api as proposed |
| 14:51 | verma | arrdem: nice, taking a look |
| 14:56 | justin_smith | kenrestivo: yeah, it should suffice to just shut the loop down when you get nil from the chan, but what you have there should work |
| 14:56 | nybbles | hey i’m using cider with clojurescript and seeing that my namespace gets reset to cljs.user after every command. my setup is based on the chestnut lein template.. any ideas where i should look to figure out why this might be happening? |
| 14:57 | kenrestivo | well the example is contrived; in reality it'll be a subscription not a channel |
| 14:58 | justin_smith | oh, do subscriptions act differently when closed? |
| 14:58 | kenrestivo | i don't know how to close one |
| 14:58 | justin_smith | write nil to it |
| 14:58 | kenrestivo | it's a subscription, it takes its input from its pub channel |
| 14:59 | kenrestivo | oh, i guess i could write to it directly too, duh |
| 14:59 | justin_smith | "By default the channel will be closed when the source closes, but can be determined by the close? parameter." |
| 14:59 | justin_smith | a nil on the source will close the subs |
| 15:03 | kenrestivo | right, but i want to close just one sub |
| 15:03 | kenrestivo | from the top-level bus. so i was going to send an :exit message on the topic channel |
| 15:04 | kenrestivo | which'll get sent to that sub, to that "daemon", and shut it down, i hope |
| 15:04 | kenrestivo | yes, i'm trying to reinvent posix in clojure inside a jvm |
| 15:06 | kenrestivo | kill $processid; sleep 2; kill -9 $processid |
| 15:44 | justin_smith | I love how I get really ambitious ideas when I consume enough caffiene |
| 15:44 | ffwacom | ^ |
| 15:45 | justin_smith | fourth cup of tea: "I know, I could write something like expect for clojure, but wrap not just line oriented text streams, but also apps that use terminal control characters, and GUI apps via vnc" |
| 15:46 | justin_smith | having a lib that helps you wrap a GUI via a json api or text command oriented intput would be awesome tho |
| 16:04 | prachetasp | is there any way to filter out all these joining and leaving lines? I just want to see when people say something |
| 16:05 | justin_smith | prachetasp: it depends on your client, but most clients should provide such a thing |
| 16:05 | prachetasp | justin_smith using the web client right now. I'm on Ubuntu any suggestions for a good client? |
| 16:06 | justin_smith | I use erc because I am an emacs addict. ymmv of course |
| 16:06 | prachetasp | I use emacs too - I'll check it out. thanks |
| 16:07 | justin_smith | prachetasp: in my custom config block I have '(erc-hide-list (quote ("JOIN" "NICK" "PART" "QUIT"))) |
| 16:07 | justin_smith | shouldn't be too hard to translate that to vanilla config, or replicate those settings in your custom block |
| 16:09 | prachetasp | admittedly still an emacs noob :/ |
| 16:10 | prachetasp | but thanks for the config. I'll give it a shot |
| 16:10 | technomancy | probably don't want two levels of quote on that? |
| 16:10 | justin_smith | technomancy: I used customize, it's part of my customize block |
| 16:10 | technomancy | (setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK")) ; <- what I have |
| 16:10 | technomancy | boo customize =P |
| 16:10 | justin_smith | technomancy: looks like the apropriate translation |
| 16:12 | prachetasp | technomancy: so I can just dump the setq statement into my .emacs and reload emacs? |
| 16:12 | technomancy | prachetasp: yeah |
| 16:12 | prachetasp | sweet! |
| 16:12 | justin_smith | prachetasp: you can even reload the file, and not restart emacs at all |
| 16:12 | technomancy | you can use customize of course, but customize is just an elaborate plan to trick you into believing you don't need to write elisp |
| 16:13 | prachetasp | that's right - how do I do that again? |
| 16:13 | technomancy | which is like ... the opposite of good emacs |
| 16:13 | justin_smith | prachetasp: load-file |
| 16:13 | technomancy | or M-x eval-buffer |
| 16:13 | prachetasp | roger that |
| 16:14 | justin_smith | or even M-x eval-defun within that block |
| 16:15 | prachetasp | I have the emacs live pack installed |
| 16:15 | prachetasp | my configuration has devolved into madness |
| 16:15 | justin_smith | haha |
| 16:19 | prachetas | hello |
| 16:20 | prachetas | sweet! justin_smith I'm in erc now |
| 16:20 | prachetas | thanks! |
| 16:20 | justin_smith | np |
| 16:20 | justin_smith | there is #emacs for the most expert emacs / erc knowledge, of course |
| 16:20 | prachetas | yeah I need to get better with my editor |
| 16:21 | prachetas | my lack of knowledge is lame |
| 16:21 | technomancy | justin_smith: eh, that's mostly for ranting about how annoying git and python are |
| 16:21 | justin_smith | I switched to evil mode recently, because I get tired of chord keys |
| 16:21 | justin_smith | haha, that too |
| 16:21 | technomancy | ooh, how's that going? |
| 16:21 | justin_smith | but they do come through with answers |
| 16:21 | technomancy | justin_smith: how long has it taken to get comfortable? |
| 16:21 | justin_smith | technomancy: I like it, I was a vi user before I switched to emacs over a decade ago for the lisp process integration |
| 16:21 | technomancy | oh, right |
| 16:21 | justin_smith | not long, but like I said, vi was my "first language" |
| 16:21 | poushkar | Help! Why does Ring force saving index.html on / and load it well on /index.html in browser with this code: (GET "/" [] (response/resource-response "index.html" {:root "public"})) ? |
| 16:22 | technomancy | I would like to at least try that at some point |
| 16:22 | jasonjckn | cursive is looking great |
| 16:22 | weavejester | poushkar: Force saving? |
| 16:22 | technomancy | evil feels like it could mend the ancient rift of hackerdom |
| 16:22 | poushkar | @weavejester yeah, like opens save file dialog |
| 16:23 | justin_smith | technomancy: my fingers / wrists like the single key bindings a lot |
| 16:23 | weavejester | poushkar: Oh, it might have the wrong content-type |
| 16:23 | justin_smith | poushkar: sounds like a content-type issue |
| 16:23 | justin_smith | yeah |
| 16:23 | prachetas | @poushkar probably a combination of your content-type and browser |
| 16:23 | technomancy | justin_smith: OTOH, I have thumb modifiers, so that doesn't really help as much for me as it would for others |
| 16:23 | justin_smith | oh yeah, you and your fancy layout |
| 16:24 | weavejester | poushkar: Yeah, resource/response doesn't automatically add a content-type field |
| 16:24 | technomancy | still, I really like the idea of composable commands that take arguments |
| 16:24 | weavejester | poushkar: If you're using Compojure 1.2.1, you could write: (GET "/" [] (io/resource "public/index.html")) |
| 16:24 | poushkar | I see you discussing Evil here. Just my 2 cents: I am already 2 weeks on this https://github.com/syl20bnr/spacemacs and it’s exciting! Give it a try |
| 16:24 | technomancy | the fact that forward-sexp, forward-sentence, forward-defun etc are different commands is just plain stupid |
| 16:25 | justin_smith | technomancy: yeah, the mini grammar of movements and actions is great, and to have that without losing my favorite things about emacs is massive |
| 16:25 | poushkar | @weavejester thank you, gonna try now |
| 16:25 | weavejester | poushkar: The latest Compojure is a little smarter about guessing content-types. Ring is dumber by design. |
| 16:25 | technomancy | "batteries included" -> nope-badger.gif |
| 16:25 | technomancy | no offense |
| 16:26 | poushkar | read configuration section |
| 16:26 | poushkar | you can switch “batteries” off |
| 16:26 | poushkar | it introduces concept of “configuration layers" |
| 16:26 | technomancy | poushkar: I maintained the original starter kit for three years. not going to fall into that trap again =) |
| 16:27 | justin_smith | poushkar: I recall you were talking about how messy your config was getting, these kind of things tend to make it worse in my experience |
| 16:28 | technomancy | "configuration layers" to me means "we've invented a separate ecosystem of how functionality is organized so now you have to understand two different ways of doing things that don't interoperate" |
| 16:28 | technomancy | because even if the vanilla way is flawed, you can't get away from it, you can only add to it |
| 16:28 | technomancy | emacs live "packs" =\ |
| 16:29 | prachetas | my god. live packs... |
| 16:29 | prachetas | I don't even understand my setup |
| 16:30 | prachetas | but it looks cool! |
| 16:30 | justin_smith | we should port the clojure version of namespaces to elisp. That would solve everything. |
| 16:30 | justin_smith | and replace package.el with lein |
| 16:30 | justin_smith | (actually let's not) |
| 16:30 | weavejester | Isn't emacs supposedly getting namespaces next version? |
| 16:30 | poushkar | Actually I liked it because it introduces some order I always missed and couldn’t make up myself |
| 16:31 | justin_smith | weavejester: interesting. I wonder what version of namespaces they'll shoot for |
| 16:39 | justin_smith | http://nic.ferrier.me.uk/blog/2013_06/adding-namespaces-to-elisp this is what I find |
| 16:45 | technomancy | there have been a couple attempts to add them as code-walking macros in userland |
| 16:46 | technomancy | it's a decent idea |
| 17:43 | poushkar | @weavejester could you please specify what you meant by “io/response”? what is “io” here? |
| 17:43 | weavejester | poushkar: clojure.java.io |
| 17:45 | poushkar | @weavejester well, you see, the problem is that I get this error “clojure.lang.PersistentArrayMap cannot be cast to java.lang.ClassLoader” |
| 17:46 | weavejester | poushkar: Are you calling the function as I outlined in my earlier message? |
| 17:46 | weavejester | poushkar: i.e. (io/resource "public/index.html") |
| 17:47 | justin_smith | (doc clojure.java.io/resource) |
| 17:47 | clojurebot | "([n] [n loader]); Returns the URL for a named resource. Use the context class loader if no loader is specified." |
| 17:47 | justin_smith | yeah, looks like one too many args |
| 17:48 | poushkar | yeah, sorry, I’ve accidentally left {:root “resources”} param used for Ring *facepalm* |
| 17:48 | poushkar | it works fine now |
| 17:49 | weavejester | poushkar: I figured it was something like that :) |
| 18:27 | kenrestivo | sadly, routing messages through core.async pub/sub doesn't seem to be terribly performant |
| 19:02 | justin_smith | kenrestivo: yeah, my impression of core.async is that it is a good abstraction for organizing things, but not high performance. But if you can chunk things so there is more work per message it still might work out (this entirely depends on your problem domain I would assume) |
| 19:03 | kenrestivo | pub/sub is very slow. just plain channels are not too bad, but in this case i can't beat atoms and add-watch, so that's what it's likely going to end up as |
| 19:11 | Morgawr | I take it load-string doesn't work in clojurescript right? is there a way to make it work, or an alternative or something? |
| 19:12 | Morgawr | because I need to pass some strings as clojure code and have them evaluated at runtime but in clojurescript this doesn't seem to be possible |
| 20:01 | justin_smith | yeah, the compiler just isn't there |
| 22:44 | maya^^ | Does anyone know why clojure's main function has a dash in front of it? Already asked google, but didn't return anything helpful. |
| 22:45 | ffwacom | lein quirk? |
| 22:46 | xeqi | "gen-class |
| 22:46 | xeqi | will generate an implementation that looks for a function named by |
| 22:46 | technomancy | it's a gen-class convention |
| 22:46 | xeqi | (str prefix mymethod) (default prefix: "-")" |
| 22:47 | xeqi | http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/gen-class |
| 22:47 | xeqi | well that didn't paste as well as I was hoping |
| 22:53 | maya^^ | ah, great, thank you, so it's just a convention |
| 23:01 | prachetas | anybody used https://github.com/adamwynne/twitter-api? |
| 23:02 | prachetas | if so, thoughts? |
| 23:10 | dbasch | prachetas: I used it here https://github.com/dbasch/twittercloud |
| 23:10 | dbasch | prachetas: blog post about it http://diegobasch.com/open-source-something-often |
| 23:12 | prachetas | funny story - I actually read this months ago when I was first looking to do sentiment analysis on tweets : ) |
| 23:12 | prachetas | then I got distracted... |
| 23:12 | prachetas | what did you think of the library? any gotcha's? |
| 23:13 | prachetas | dbasch: ^^ |
| 23:13 | dbasch | prachetas: can’t remember any gotchas, it worked as advertised (as much as the twitter api allows) |
| 23:13 | dbasch | the twitter api of course is not super dependable |
| 23:14 | prachetas | do they kill it when they have capacity issues? |
| 23:14 | dbasch | or degrade it, or return various error codes |
| 23:14 | dbasch | or a request hangs for a long time |
| 23:14 | prachetas | hm - not ideal but my requirements aren't real-time I guess |
| 23:15 | prachetas | tweetclouds pretty cool - I'm gonna play around with that |