2014-11-19
| 00:23 | azri | Hi guys i am trying to use this namespace "clojurewerkz.ogre.vertex" but i am getting "#<CompilerException java.io.FileNotFoundException: Could not locate clojurewerkz/ogre/vertex__init.class or clojurewerkz/ogre/vertex.clj" |
| 00:24 | azri | i've added this "[clojurewerkz/ogre "2.5.0.0"]" to project.clj and lein deps |
| 00:24 | azri | any other things i forgot to do |
| 00:30 | TEttinger | azri: did you get the error requiring it? |
| 00:32 | TEttinger | azri: when you run "lein deps" , do you get any errors or warnings shown? |
| 01:02 | FriedBob | I'm trying to use edn-config in a project. I've setup a dev, test and prod profile with appropriate config/<profile>/config.edn files. I have the :require in place as per the docs. When I run (println (:config-version env)) all I get is nil. I have tried "lein run" and "lein with-profile <profile> run" for each of the profiles, but justget nil. My google-fu is faiing me. |
| 01:02 | FriedBob | Is there a doc I am missing, or some debug trick I don't know that can help me sort this out and figure out what I am donig wrong? |
| 01:06 | justin_smith | FriedBob: does env have any content? |
| 01:08 | FriedBob | I did (:require [edn-config.core :refer [env]]) and was trying to follow the examples at https://github.com/yogthos/edn-config |
| 01:09 | FriedBob | Whcih shows "(println (:dev env) (:db env)))" |
| 01:09 | justin_smith | FriedBob: what happens if you do (pr-str env) |
| 01:09 | FriedBob | Let me check |
| 01:11 | FriedBob | I may have done this wrong, but nothing. I added (pr-str env) after my println section, but the output I got was the same. Or does that need to in the println ? |
| 01:12 | justin_smith | FriedBob: no, pr-str just unambiguously prints its argument |
| 01:12 | justin_smith | &(pr-str nil) |
| 01:12 | lazybot | ⇒ "nil" |
| 01:12 | justin_smith | ahh |
| 01:12 | justin_smith | wait |
| 01:12 | justin_smith | &(pr nil) |
| 01:12 | lazybot | ⇒ nilnil |
| 01:12 | justin_smith | you want pr |
| 01:12 | justin_smith | my bad! |
| 01:12 | justin_smith | or prn actually |
| 01:13 | justin_smith | &(prn nil) |
| 01:13 | lazybot | ⇒ nil nil |
| 01:13 | FriedBob | Ok, one sec |
| 01:13 | FriedBob | Though, adding (pr-str env) the println did get me a ton of output |
| 01:14 | justin_smith | OK, so that should let you know what you actually have available to work with from your config |
| 01:15 | FriedBob | Which means my edn-config may not be merging properly |
| 01:15 | FriedBob | But I'llneed a bit to parse this |
| 01:16 | justin_smith | FriedBob: clojure.pprint/pprint will produce a more readable result |
| 01:16 | justin_smith | but the result of pr-str is valid for pasting into the repl |
| 01:16 | justin_smith | and getting the same result back |
| 01:16 | justin_smith | (though you may need to quote it with ') |
| 01:18 | FriedBob | Well, it pulled the config/test into the class path like it was suppsoed to |
| 01:21 | justin_smith | FriedBob: I like using -> / ->> / type / keys / nth to interactively find results in data via the repl? |
| 01:21 | justin_smith | oops, out of place question mark there |
| 01:22 | justin_smith | &(-> {:a [0 1 2 {:b "c"}]} :a (nth 3) :b) |
| 01:22 | lazybot | ⇒ "c" |
| 01:23 | FriedBob | The keys I set in my config.edn aren't in the env list. |
| 01:24 | justin_smith | not even nested anywhere in the result? |
| 01:24 | FriedBob | I dumped the output to a text file and searched it. |
| 01:24 | justin_smith | OK |
| 01:24 | justin_smith | this is the entire source code to that lib https://github.com/yogthos/edn-config/blob/master/src/edn_config/core.clj |
| 01:25 | justin_smith | the one suspicious thing I see is the catch |
| 01:25 | FriedBob | The three keys I used were :config-version, :source-data-dir and :graph-data-dir |
| 01:25 | justin_smith | if there are any errors in your file, it will fail to load anything from it |
| 01:25 | FriedBob | and "-data" was nowhere to be found |
| 01:25 | FriedBob | Give my level of nooishness, that may very well be the case, though AFAIk it's vaild edn |
| 01:26 | justin_smith | FriedBob: what happens when you run (read-string (slurp (clojure.java.io/resource "config.edn"))) |
| 01:26 | justin_smith | that will actually show the error, if any |
| 01:26 | FriedBob | One sec, let me remember how to jack in to my repl rather than doing a lein run all the time |
| 01:26 | justin_smith | "lein repl" |
| 01:27 | justin_smith | FriedBob: the repl is really crucial to clojure development |
| 01:27 | FriedBob | M-x cider-jack-in |
| 01:28 | justin_smith | well you can do that if you really want to |
| 01:28 | justin_smith | but for a new user that just adds complexity imho |
| 01:28 | FriedBob | I'm more comfortable in emacs. Just had to remember the command. |
| 01:30 | FriedBob | Yeah, that got me a stack trace |
| 01:30 | justin_smith | if you don't understand what the error means, feel free to share it via eg. refheap |
| 01:32 | FriedBob | I get what it means - it's essentially a null pointer type error, which tells me my edn is screwed up but not much else |
| 01:33 | justin_smith | no line number? no indication of what it was doing when it got that null pointer? |
| 01:35 | FriedBob | "No implementation of method: :make-reader protocol: #'clojure.java.io/IOFactory found for class: nil" |
| 01:35 | FriedBob | All the line numbers are from source in the stack, not related to my files |
| 01:35 | justin_smith | FriedBob: ok, that means config.edn is not on your class path |
| 01:35 | FriedBob | Oh, probably because this is in the repl, not being ran from lein with-profile |
| 01:36 | FriedBob | SO I need to load the profile, which adds that tothe class path |
| 01:36 | justin_smith | FriedBob: you can use lein with-profile ... repl |
| 01:36 | justin_smith | FriedBob: like I said, cider just makes this more complicated than it should be |
| 01:36 | justin_smith | just use the command line |
| 01:36 | azri | TEttinger: sorry didn't notice someone replied:) |
| 01:37 | azri | TEttinger: No error no warnings |
| 01:39 | FriedBob | That causes a different stacktrace due to "no nREPL dependency detected", so let me fix that and try again |
| 01:41 | justin_smith | FriedBob: wait, what is the exact command line that gets you that error? |
| 01:42 | FriedBob | "lein with-profile test repl" |
| 01:43 | justin_smith | weird, I have never seen that error |
| 01:44 | FriedBob | "lein with-profile test,default repl" seems to have worked though |
| 01:44 | justin_smith | try "lein with-profile +test repl" |
| 01:44 | justin_smith | ahh, yeah, that would do the same thing |
| 01:44 | TEttinger | azri: take a look in your maven cache maybe, are you on windows or what OS? |
| 01:47 | FriedBob | justin_smith: Found the error - forgot to quote a version string 'number' |
| 01:48 | justin_smith | that would do it! |
| 01:53 | azri | TEttinger: im on lubuntu |
| 01:55 | azri | TEttinger: yeah i can the ogre folder in ~/.m2 file |
| 01:55 | FriedBob | I fixed the file on disk, but it's still showing the old version. Is there a way to force it to relaod? |
| 01:55 | TEttinger | azri, hm... |
| 01:55 | TEttinger | so in ogre, what versions does it have? |
| 01:56 | TEttinger | 2.5.0.0 present? |
| 01:56 | azri | yes |
| 01:56 | justin_smith | FriedBob: for lein run? lein do clean, run |
| 01:56 | TEttinger | I might try this out |
| 01:56 | TEttinger | azri, would I need a tinkerpop db to test this? |
| 01:56 | FriedBob | I'm currently in the lein repl, though 'quit' and relaunch didn't help |
| 01:57 | azri | hmm |
| 01:57 | azri | im using titanium |
| 01:57 | azri | titanium db |
| 01:57 | justin_smith | FriedBob: yeah, env is defonce, so you're kinda stuck |
| 01:57 | azri | i mean titan |
| 01:57 | justin_smith | I guess you could unbind edn-config.core/env and then :reload the ns |
| 01:58 | justin_smith | but easier to just restart the repl |
| 01:58 | FriedBob | I guess I could use the refresh-env thing that the libnrary uses in its tests |
| 01:58 | TEttinger | ah, that's why, azri: it was added after 2.5.0.0 https://github.com/clojurewerkz/ogre/commits/master/src/clojure/clojurewerkz/ogre/vertex.clj |
| 01:58 | TEttinger | the 2.5.0.0 tag was sep 27 |
| 01:59 | TEttinger | you can use 3.0.0.0-SNAPSHOT, maybe |
| 02:00 | TEttinger | nope, snapshot seems not updated |
| 02:00 | TEttinger | try to find earlier docs if possible |
| 02:00 | azri | i see |
| 02:02 | TEttinger | it probably had a different name before the current revision |
| 02:02 | FriedBob | justin_smith: And now getting a new error, butit's 0100 here and my scotch glass is empty, so bed time. Thanks for the help, should be able to get this working tomorrow. At least enough for me to move on to the next issue |
| 02:02 | azri | yeah it's likely so |
| 02:02 | azri | i'll find the correct doc |
| 02:02 | azri | thats TEttinger |
| 02:02 | azri | *thanks |
| 02:04 | TEttinger | it used clojurewerkz.archimedes.vertex before, azri |
| 02:04 | TEttinger | a different project that just got merged |
| 02:06 | azri | I see |
| 02:06 | azri | i will check on archimedes |
| 02:07 | TEttinger | good luck, hope it's not too different |
| 02:07 | TEttinger | it seems like the API barely changed, if at all |
| 02:07 | azri | thanks again |
| 02:07 | TEttinger | no prob! |
| 02:07 | azri | just out of curiosity |
| 02:07 | azri | are familiar with titanium? |
| 02:08 | azri | are you using it |
| 02:08 | TEttinger | no, never heard of it |
| 02:08 | azri | ok |
| 02:08 | TEttinger | I had heard of tinkerpop's graph db stuff before |
| 02:08 | TEttinger | but ages ago |
| 02:08 | dysfun | the tinkerpop stuff is alright |
| 02:08 | dysfun | it's the officially recommended orientdb library |
| 02:56 | kenrestivo | um, any ideas how to turn a manifold stream into a plain ol' core.async channel? |
| 03:32 | nonuby | I want a test a string against 4 seperate regexes, so I initially think cond, but I'd also like to use the matches of re-matches output too, without calling it twice, once for truthy test and once for matches, any idiomatic ideas? |
| 03:37 | TEttinger | nonuby: does it have to match all regexes? |
| 03:37 | TEttinger | or just one? |
| 03:39 | nonuby | just one.. I think im going with (let [[match type match-result] (or [:name-match (re-matches re1 s)] [:telephone-match (re-matches re2 s)] [:age-match (re-matches re3 s)])] (case match-type |
| 03:40 | nonuby | unless any better ideas |
| 03:40 | TEttinger | uh, that won't work |
| 03:41 | TEttinger | ,(or [:name-match (re-matches #"A" "world")] [:telephone-match (re-matches #"B" "world")]) |
| 03:41 | clojurebot | [:name-match nil] |
| 03:41 | nonuby | how come it short-circuits? (or [:name (println "1")] [:age (println "2")]) |
| 03:41 | nonuby | ah yeah |
| 03:42 | TEttinger | it will always be true because a vector with anything in it that's truthy is truthy |
| 03:42 | nonuby | it will always shortcircuit |
| 03:42 | TEttinger | actually... |
| 03:42 | nonuby | grrr |
| 03:42 | nonuby | hmmm... back to drawing board |
| 03:43 | TEttinger | (doc if-let) |
| 03:43 | clojurebot | "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else" |
| 03:44 | TEttinger | nonuby, do you have some sample regexes and data? |
| 03:44 | TEttinger | just one line or whatever? |
| 03:46 | nonuby | its a search box on crm that i want to run against specific fields if it matches a pattern (i.e. is it a telephone number or a name) |
| 03:46 | nonuby | simiplified but I think this works |
| 03:46 | nonuby | (or (if-let [re (re-matches #"^[a-z]+$" "0100")] [:name-match re])(if-let [re (re-matches #"^\d+$" "0100")] [:phone-match re])) |
| 03:46 | nonuby | (or (if-let [re (re-matches #"^[a-z]+$" "max")] [:name-match re])(if-let [re (re-matches #"^\d+$" "max")] [:phone-match re])) |
| 03:46 | nonuby | but seems very verbose |
| 03:49 | nonuby | with the name I'd have groupings to extract first mid? last etc.. hence why need to reuse the matching (best rename m vs re) |
| 04:35 | jonathanj | is there a way to deref something in non-blocking fashion? |
| 04:35 | jonathanj | eg. Promise.when() / Deferred.addCallback() |
| 04:38 | clgv | jonathanj: (future (f (deref your-ideref))) ? |
| 04:39 | clgv | jonathanj: maybe there are something like watchers as well. |
| 04:39 | pyrtsa | core.async? |
| 04:39 | clojurebot | core.async is not Go |
| 04:47 | rurumate | in this line, what is &env ? https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L384 |
| 04:50 | the_frey | hi, is there any way of modifying which Exception a pre- condition in a function throws? |
| 04:50 | luxbock | rurumate: it's a map of local bindings |
| 04:50 | the_frey | as in, instead of AssertionError it throws say IllegalArgumentException |
| 04:51 | the_frey | though I'd settle for adding a message to explain _why_ the validation has failed |
| 04:51 | luxbock | the_frey: I don't really know but I recall someone asking about this earlier and I think the answer was that it's impossible |
| 04:51 | the_frey | ah that's a shame |
| 04:52 | rurumate | luxbock: is the &ersand a reader macro? |
| 04:52 | the_frey | thanks luxbock! |
| 04:53 | rurumate | ,&env |
| 04:53 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: &env in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 04:53 | luxbock | rurumate: nope, it's just an unnamed argument that's available inside defmacro |
| 04:53 | luxbock | there's also &form |
| 04:54 | rurumate | is it documented somewhere> |
| 04:54 | rurumate | got it thanks |
| 04:54 | clgv | rurumate: it is an implicit argument that every macro gets |
| 04:55 | rurumate | halp I'm falling down the macro rabbit hole |
| 04:56 | dysfun | rurumate: simplify! |
| 05:00 | clgv | rurumate: why? |
| 05:07 | rurumate | well, with &env it seems in macros you can do more than I thought |
| 05:09 | rurumate | you can see the surrouding local bindings in the macro |
| 05:10 | rurumate | can you also see vars that are defined above? |
| 05:11 | clgv | rurumate: you can query the vars of the current namespace without a macro e.g. via `ns-publics` |
| 05:13 | rurumate | yup, but can I access the caller's namespace in the macro, just as I can inspect the caller's local vars with &env? |
| 05:14 | rurumate | I want to find out if and where the scope of a macro ends. To see what is _not_ possible in a macro |
| 05:16 | clgv | rurumate: yeah, you can access the namespace of the caller via *ns* |
| 05:17 | rurumate | for instance, let's assume I have a (def secret "mysecret101") in my and I call an unknown macro below that line. Let's say I don't have access to the source code of the macro (might be hostile code), and I don't want it to see the value of secret. Is it safe to call it? |
| 05:17 | rurumate | *in my namespace |
| 05:51 | fairuz1 | Hi guys. I have { ... :type String } in my edn file. I use in a method who expect a java.lang.Class. But when I use (:type data), I get this error: ClassCastException clojure.lang.Symbol cannot be cast to java.lang.Class. Any suggestion? Thanks |
| 05:53 | fairuz1 | I tried `(:type data) and (-> data :type quote) but still no success |
| 05:55 | TEttinger | ,(def edn {:content "Hello!" :type String}) |
| 05:55 | clojurebot | #'sandbox/edn |
| 05:55 | TEttinger | ,edn |
| 05:55 | clojurebot | {:content "Hello!", :type java.lang.String} |
| 05:55 | TEttinger | ,(:type edn) |
| 05:55 | clojurebot | java.lang.String |
| 05:56 | TEttinger | how are you using the (:type data), fairuz1? |
| 05:56 | fairuz1 | TEttinger in a let. Something like (let [type (:type data)] ... ) |
| 05:57 | TEttinger | oh, that might be why, since... |
| 05:57 | TEttinger | ,type |
| 05:57 | clojurebot | #<core$type clojure.core$type@1bf7527> |
| 05:57 | TEttinger | is already defined |
| 05:57 | fairuz1 | I thought so, I changed to property-type and same thing |
| 05:57 | TEttinger | ,(let [type (:type edn)] type) |
| 05:57 | clojurebot | java.lang.String |
| 05:57 | TEttinger | how are you reading your edn? |
| 05:57 | fairuz1 | (read-string (slurp "my.edn")) |
| 05:58 | TEttinger | ok, let's try that |
| 05:58 | TEttinger | ,(def edn-str "{:content \"Hello!\" :type String}") |
| 05:58 | clojurebot | #'sandbox/edn-str |
| 05:59 | TEttinger | ,(read-string edn-str) |
| 05:59 | clojurebot | {:content "Hello!", :type String} |
| 05:59 | TEttinger | ,(:type (read-string edn-str)) |
| 05:59 | clojurebot | String |
| 05:59 | TEttinger | ah, it isn't namespaced |
| 05:59 | TEttinger | ,(type (:type (read-string edn-str))) |
| 05:59 | clojurebot | clojure.lang.Symbol |
| 05:59 | TEttinger | ,(type (:type (eval (read-string edn-str)))) |
| 05:59 | clojurebot | java.lang.Class |
| 06:00 | fairuz1 | ohhhhhhhh |
| 06:00 | TEttinger | there you go |
| 06:00 | fairuz1 | :) |
| 06:00 | TEttinger | that's an odd one, hope that helps! |
| 06:00 | fairuz1 | Is it better to just eval this small part that has :type String? or the whole data coming from edn? |
| 06:01 | TEttinger | eval should resolve any namespace stuff if the issue is it can't find it with just "String" but... hm |
| 06:01 | TEttinger | ,(type (:type (read-string "{:content \"Hello!\" :type java.lang.String}"))) |
| 06:01 | clojurebot | clojure.lang.Symbol |
| 06:01 | TEttinger | huh |
| 06:01 | TEttinger | yeah it does need eval |
| 06:02 | TEttinger | if you don't know where types are in the data, just eval the whole thing, be advised that it's a security hole since any code in the data will be executed |
| 06:02 | TEttinger | but! |
| 06:02 | fairuz1 | I know where it is |
| 06:03 | TEttinger | if you know where the types are, you can eval only the field, and only if it's (not evaled) a symbol |
| 06:03 | fairuz1 | oh ok |
| 06:03 | TEttinger | if it's a list, it could be code, but if it's a symbol, it's something you probably want as a class |
| 06:04 | TEttinger | ,(type (:type (eval (read-string "{:content \"Hello!\" :type (println "U H4V3 B33n HaXxX0R3D")}")))) |
| 06:04 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: U in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 06:04 | TEttinger | ,(type (:type (eval (read-string "{:content \"Hello!\" :type (println \"U H4V3 B33n HaXxX0R3D\")}")))) |
| 06:04 | clojurebot | U H4V3 B33n HaXxX0R3D\n |
| 06:05 | fairuz1 | wew |
| 06:05 | TEttinger | the check there is... |
| 06:07 | hey-lu | ,(type (resolve (:type (read-string "{:content \"Hello!\", :type String}")))) |
| 06:07 | clojurebot | java.lang.Class |
| 06:07 | TEttinger | (inc hey-lu) |
| 06:07 | lazybot | ⇒ 1 |
| 06:07 | TEttinger | I knew there was something I was missing |
| 06:07 | fairuz1 | I suppose resolve is better? |
| 06:07 | fairuz1 | :) |
| 06:07 | TEttinger | (doc resolve) |
| 06:07 | clojurebot | "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)" |
| 06:07 | TEttinger | yeah that does it |
| 06:07 | hey-lu | TEttinger: thanks. :) |
| 06:07 | fairuz1 | (inc TEttinger) |
| 06:07 | lazybot | ⇒ 29 |
| 06:08 | fairuz1 | (inc hey-lu) |
| 06:08 | lazybot | ⇒ 2 |
| 06:08 | fairuz1 | Nice it works. Thanks! |
| 06:08 | hey-lu | fairuz1: resolve is a bit safer, with eval someone could put code inside in your edn, which is very likely not what you want |
| 06:09 | hey-lu | ,(read-string "{:oops (+ 3 4)}") |
| 06:09 | clojurebot | {:oops (+ 3 4)} |
| 06:09 | hey-lu | ,(eval (read-string "{:oops (+ 3 4)}")) |
| 06:09 | clojurebot | {:oops 7} |
| 06:12 | clgv | rurumate: nope. global accessible values are never save from access, neither macros nor functions |
| 06:44 | ffwacom | ,(read-string "/quit") |
| 06:44 | clojurebot | #<RuntimeException java.lang.RuntimeException: Invalid token: /quit> |
| 06:45 | clgv | ffwacom: you mean the following? ##(System/exit 0) |
| 06:45 | lazybot | java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0") |
| 06:45 | clgv | ;) |
| 06:45 | ffwacom | heh |
| 06:46 | ffwacom | ,(prn "asdf") |
| 06:46 | clojurebot | "asdf"\n |
| 06:46 | ffwacom | ,1 |
| 06:46 | clojurebot | 1 |
| 06:46 | ffwacom | ,"/quit" |
| 06:46 | clojurebot | "/quit" |
| 06:46 | ffwacom | damn |
| 06:47 | clgv | are you trying to be the badboy disconnecting the bot? |
| 06:47 | ffwacom | ,(pr "asdf") |
| 06:47 | clojurebot | "asdf" |
| 06:47 | ffwacom | yeah |
| 06:47 | clgv | you won't make friends that way ;) |
| 06:47 | clgv | but you are unlikely to succeed anyway |
| 06:48 | ffwacom | only started clojure today so my odds of success are fairly low haha |
| 06:48 | clgv | it's running in a "sandbox" |
| 06:48 | TEttinger | especially since irc actions are only triggered by /quit or the like by something in your IRC client, not part of the message that inherently means quit |
| 06:48 | ffwacom | TIL |
| 06:49 | TEttinger | until recently you could have opened up desktop windows on my lazybot's hosting computer, but that loophole has since been plugged |
| 06:49 | trx | rritoch |
| 06:50 | ffwacom | heh |
| 06:50 | TEttinger | (not on freenode) |
| 06:50 | clgv | TEttinger: hehe, did you need to forbid swing? |
| 06:50 | clgv | ,(doto (JFrame. "bla") (.setVisible true)) |
| 06:50 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: JFrame, compiling:(NO_SOURCE_PATH:0:0)> |
| 06:51 | clgv | ,(doto (javax.swing.JFrame. "bla") (.setVisible true)) |
| 06:51 | clojurebot | #<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0:0)> |
| 06:51 | rritoch | Is there a cleaner way to filter the content of atoms other than passing in partial filters? Which is the cleanest I've come up with so far ##(let [a (atom [1 2 3])] (swap! a (partial filterv (fn [x] (not= x 2))))) |
| 06:51 | lazybot | ⇒ [1 3] |
| 06:52 | clgv | ,(try (doto (javax.swing.JFrame. "bla") (.setVisible true)) (catch Throwable e (println (.. e getCause getMessage)))) |
| 06:52 | clojurebot | clgv: Cool story bro. |
| 06:52 | clgv | :( |
| 06:52 | TEttinger | &(try (doto (javax.swing.JFrame. "bla") (.setVisible true)) (catch Throwable e (println (.. e getCause getMessage)))) |
| 06:52 | lazybot | java.lang.SecurityException: You tripped the alarm! catch is bad! |
| 06:52 | TEttinger | lol |
| 06:52 | clgv | haha |
| 06:52 | TEttinger | &(doto (javax.swing.JFrame. "bla") (.setVisible true)) |
| 06:52 | lazybot | java.awt.HeadlessException: |
| 06:53 | clgv | thought so ;) |
| 06:53 | clgv | headless jre |
| 06:53 | TEttinger | of course lazybot is headless, but mine wasn't |
| 06:53 | clgv | TEttinger: so you could tweak that via permissions? |
| 06:53 | TEttinger | the headlessness? |
| 06:54 | clgv | opening windows. I am not sure if it is possible to forbid that on a desktop jre |
| 06:54 | TEttinger | I changed lazybot's source to do better filtering of the default clojail permissions |
| 06:54 | TEttinger | of course I handed the changes along to Raynes :) |
| 06:58 | clgv | TEttinger: ah there is AWTPermission - did you use that one? |
| 06:59 | TEttinger | I used a number of them |
| 06:59 | TEttinger | there's a whole list on the sun/oracle site |
| 06:59 | clgv | TEttinger: I only saw "grant" is there also blacklisting? |
| 07:00 | clgv | or was it granted accidentally? |
| 07:00 | TEttinger | https://docs.oracle.com/javase/7/docs/technotes/guides/security/permissions.html |
| 07:00 | TEttinger | everything is granted by default with lazybot |
| 07:00 | TEttinger | allpermission |
| 07:01 | TEttinger | then it blacklists specific things |
| 07:01 | clgv | huh? the jvm security disables everything by default |
| 07:01 | TEttinger | yes |
| 07:01 | clgv | but lazybot overrides that? |
| 07:01 | TEttinger | but to run anything in the sandbox, it needs a permission file |
| 07:02 | TEttinger | $google raynes lazybot |
| 07:02 | lazybot | [Raynes/lazybot · GitHub] https://github.com/Raynes/lazybot |
| 07:02 | TEttinger | https://github.com/Raynes/lazybot/blob/master/example.policy |
| 07:02 | clgv | ah and you used the example.policy? :D |
| 07:02 | clgv | :P |
| 07:02 | TEttinger | IMPORTANT: If you load the clojure plugin, you must rename and move "example.policy" to "~/.java.policy" to avoid some troublesome security errors! |
| 07:02 | TEttinger | it's very challenging to get the policy correct otherwise |
| 07:03 | clgv | well, you should upload your example somewhere :) |
| 07:04 | TEttinger | it should already be in lazybot, I think |
| 07:04 | clgv | where? |
| 07:04 | clojurebot | where is amalloy to explain it |
| 07:05 | TEttinger | huh, it isn't here https://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/clojure.clj#L35-L48 |
| 07:05 | TEttinger | pull request! |
| 07:06 | clgv | none open ;) |
| 07:06 | TEttinger | I know justin_smith's fork blocked it, with anybot |
| 07:07 | clgv | where is your fork? |
| 07:11 | H4ns | i have trouble understanding "CompilerException java.lang.IllegalStateException: to-local-date-time already refers to: #'clj-time.local/to-local-date-time in namespace: clojure.contrib.humanize" when :require'ing 'clozure.contrib.humanize. can anyone explain what's going on? |
| 07:14 | TEttinger | H4ns, you probably shouldn't use ":refer :all" there |
| 07:15 | H4ns | TEttinger: but i don't. :require [clojure.contrib.humanize :as humanize] is what i do |
| 07:15 | TEttinger | clgv, I haven't cleaned it up yet |
| 07:15 | TEttinger | huh |
| 07:26 | paparent | Hi there! clojure newbie here.. I'm looking for web development. Found some interesting lib to get started.. using like compujure, hiccup. But i've some question about DB layer! I've hard time to find some good info. |
| 07:27 | paparent | Dunno what's best DB for it.. but I like MongoDB (using it in other project). So I looked for Monger, but I've some question about it, maybe because i'm not used to it. Am I at the right place? |
| 07:28 | TEttinger | there are probably some people who use monger here, though other DB may be more reliable with large amounts of data |
| 07:28 | TEttinger | I used congomongo for a bit, it's ok |
| 07:29 | TEttinger | I imagine monger is better, it's certainly better documented |
| 07:30 | paparent | With latest version of Monger, you have to pass the db as first param (the db connection)... I'm just not used to that. Should at each request to the database, we must create a new connection? I'm not able to find some real world project, or samble to help me figure it out! hehe |
| 07:31 | paparent | TEttinger: what kind of other DB are you thinking? :) |
| 07:33 | TEttinger | eh? you can just get the connection and store it in a def, can't you? |
| 07:33 | daniel___ | paparent: i think there is a way of defining the connection and having all subsequent calls use it automatically |
| 07:33 | daniel___ | can't remember off the top of my head |
| 07:34 | daniel___ | passing the db each time makes testing easier |
| 07:34 | TEttinger | I don't know much about mongodb or its competitors, I know people like datomic as a clojure thing and there is a free version of that |
| 07:34 | TEttinger | postgresql is apparently rather reliable |
| 07:34 | daniel___ | mongodb is pretty easy to use from clojure |
| 07:34 | clgv | I didnt like datomic - just so you know there are different opinions ;) |
| 07:34 | daniel___ | i find relational databases harder to deal with than in other languages, because there isnt really a good migration solution |
| 07:35 | daniel___ | not like south (django) or activerecord (rails) anyway |
| 07:35 | daniel___ | but you can always use standalone activerecord or something in the project to migrate the db |
| 07:35 | paparent | daniel___: Hm, so if I have a def with the db stuff it there.. even if i access it multiple time, then it will be evaluated once, so share the same DB connection (TCP i mean) |
| 07:35 | daniel___ | then actually querying is easy |
| 07:36 | clgv | paparent: you'll regret less if you just pass it as param |
| 07:36 | daniel___ | paparent: i think db is a pooled connection, yeah |
| 07:36 | noidi | daniel___, what about flyway and dbmaintain? |
| 07:36 | daniel___ | not sure tbh |
| 07:37 | daniel___ | noidi: not that familiar with them, but those are from the java world i believe? |
| 07:38 | noidi | yes, but they're trivial to call from Clojure or the command line |
| 07:39 | daniel___ | flyway uses plain sql? |
| 07:39 | noidi | yes |
| 07:39 | paparent | clgv: So, I pass it as 1st param.. doing a (def ...) somewhere to define my connection settings.. ? |
| 07:39 | daniel___ | dunno, im used to very db agnostic DSLs to handle this sort of thing, always feels like a bit of a pita after using activerecord |
| 07:40 | daniel___ | but i admit i havent researched every option thoroughly |
| 07:41 | paparent | daniel___: What are you using on your side? mongo, or maybe other db that play nice with clojure? :) |
| 07:41 | nonuby | anyone familiar with monger, how does one specifiy case sensitive for simple string matches |
| 07:41 | daniel___ | paparent: mongo mostly, but i dont do any serious work in clojure, as much as i'd want to |
| 07:42 | clgv | paparent: in case you need multiple dbs you are always screwed with a single db def |
| 07:42 | paparent | daniel___: using monger? |
| 07:42 | paparent | clgv: yeah got that. |
| 07:42 | clgv | paparent: usually you have some entry point in your program where you can just (let [db (create-db ...)] ...) and then pass it along to the functions that need it |
| 07:43 | daniel___ | yeah, but not enough to remember anything off the top of my head |
| 07:43 | daniel___ | the documentation is pretty good |
| 07:43 | clgv | paparent: or you could use the "component" approach |
| 07:43 | paparent | I guess main question is how to get that db connection settings.. In ring plugin you have that init function.. I saw something on stackoverflow to put the db into an atom. |
| 07:44 | clgv | paparent: you can load it from a local configuration file or specify through environmen variables... |
| 07:44 | clgv | paparent: or even commandline parameters |
| 07:50 | dysfun | is reduce lazy? |
| 07:51 | Ember- | ,(type (reduce + [1 2])) |
| 07:51 | clojurebot | java.lang.Long |
| 07:51 | dysfun | is there a lazy equivalent? |
| 07:51 | Ember- | not built-in |
| 07:51 | Ember- | imho |
| 07:52 | engblom | paparent: If you want more functional programming, use a table for keeping the state and pass it forward with each function. You can easily look up what you want from the state table: ({:one 1 :two 2 :three 3} :two) => 2 |
| 07:52 | Ember- | I may be wrong though |
| 07:52 | Ember- | ah |
| 07:52 | Ember- | ,(reductions + [1 2 3]) |
| 07:52 | clojurebot | (1 3 6) |
| 07:52 | Ember- | ,(type (reductions + [1 2 3])) |
| 07:52 | clojurebot | clojure.lang.LazySeq |
| 07:53 | Ember- | not exactly the same thing but... |
| 07:53 | Ember- | ,(last (reductions + [1 2 3])) |
| 07:53 | clojurebot | 6 |
| 07:53 | Ember- | ,(reduce + [1 2 3]) |
| 07:53 | clojurebot | 6 |
| 07:53 | Ember- | so you can imitate lazy reduce via last + reductions |
| 07:53 | clgv | dysfun: how can an aggregation be lazy? |
| 07:54 | wiruzx | Hi everyone |
| 07:54 | clgv | dysfun: you could be interested inintermediate results then "reductions" works |
| 07:55 | wiruzx | I'm newbie in Clojure, and i don't understand something: what the difference between ` and '? |
| 07:55 | clgv | Ember-: but then it is not lazy anymore since last forces the complete calculation :P |
| 07:55 | Ember- | yeah :) |
| 07:56 | paparent | engblom: ok thanks! that kinda give me an idea.. (sorry, totally new).. since i'm using ring, and composure, I guess I could setup db connection as a ring middleware or something. |
| 07:56 | Ember- | but reduce doesn't return a seq (or well, it can but in usual scenario) |
| 07:56 | clrnd | wiruzx, 'a is just (quote a) |
| 07:56 | Ember- | and seqs can be lazy in clojure |
| 07:56 | clgv | dysfun: Ember-: you could use a `delay` to have it computed on demand |
| 07:56 | Ember- | and of course plain ol' functions |
| 07:56 | Ember- | so the "lazy reduce" should be just a function |
| 07:56 | wiruzx | clrnd: and what is `? |
| 07:56 | Ember- | clgv: yeah, true |
| 07:57 | Ember- | or wrap it inside a function and return that |
| 07:57 | Ember- | both work |
| 07:57 | dysfun | clgv: i've thought of another way to solve it now, but thanks |
| 07:57 | clrnd | wiruzx, in a macro `a expands to (quote full_name/a) |
| 07:58 | clrnd | it's for avoiding conflicting names in a macro |
| 07:58 | wiruzx | oh, now I see |
| 07:58 | wiruzx | Thanks a lot! |
| 07:58 | clrnd | no problem :) |
| 08:03 | clgv | dysfun: `map`? |
| 08:03 | rritoch | dysfun: Wrapping it in repeatedly seems to work well, and its resuable |
| 08:04 | clgv | wiruzx: syntax quote, e.g. ##`map |
| 08:04 | lazybot | ⇒ clojure.core/map |
| 08:04 | dysfun | heh. i'm interested in the intermediate results |
| 08:04 | rritoch | ,(take 1 repeatedly (partial reduce + [1 2 3])) |
| 08:04 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/take> |
| 08:04 | rritoch | ,(take 1 (repeatedly (partial reduce + [1 2 3]))) |
| 08:04 | clojurebot | (6) |
| 08:04 | clgv | :P |
| 08:05 | rritoch | I guess you still end up using first though to unwrap it |
| 08:05 | clgv | rritoch: sorry but that is no solution to anything |
| 08:06 | dysfun | what i actually want is a sliding window over a list |
| 08:06 | rritoch | clgv: It makes the processing lazy, so it doesn't run immediately |
| 08:08 | clgv | rritoch: and therefore it is simple to consider a lazy-seq? `delay` is the much better choice for that |
| 08:10 | rritoch | clgv: That would depend on the usage, if it isn't a calculation that is expected to produce the same result each time, delay would be useless. |
| 08:10 | clojure_beginner | Hello! I have a quick question, can I have a let_fn binding inside let binding scope ? |
| 08:11 | clojure_beginner | Oh, nevermind.. |
| 08:11 | clgv | rritoch: well you have to solve the given problem ;) |
| 08:12 | rritoch | ,(let [x (delay (rand 10))] (into [] [@x @x @x])) |
| 08:12 | clojurebot | [5.510419246941022 5.510419246941022 5.510419246941022] |
| 08:13 | clgv | rritoch: what's the connection to the asked "lazy reduce"? |
| 08:13 | rritoch | clgv: Wrapping the reduction into a repeatedly makes the processing lazy, that's the point. |
| 08:14 | clgv | rritoch: I don't question the existence of `repeatedly`, just that it's totally weird to use in the above problem |
| 08:14 | dysfun | clgv: if you're interested, here's what i actually wanted (first draft) |
| 08:14 | dysfun | ,(butlast (take-while seq (map (partial take 2) (iterate next [1 2 3 4 5 6])))) |
| 08:14 | clojurebot | ((1 2) (2 3) (3 4) (4 5) (5 6)) |
| 08:15 | clgv | dysfun: ##(partition 2 1 (range 1 7)) |
| 08:15 | lazybot | ⇒ ((1 2) (2 3) (3 4) (4 5) (5 6)) |
| 08:15 | rritoch | clgv: repeatedly makes it lazy so if there is control logic where an expensive calculation isn't always needed, you can use repeatedly to perform the calculation only on an as-needed basis. |
| 08:15 | dysfun | clgv: brilliant, thanks |
| 08:16 | dysfun | i think so often these problems are rooted in not knowing the word to use |
| 08:16 | clgv | rritoch: if you calculate a single value with recude its nonsense to wrap it into repeatedly to "make it lazy", that's a use case for `delay` |
| 08:16 | Glenjamin | (doc repeatedly) |
| 08:16 | clojurebot | "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it" |
| 08:16 | clgv | dysfun: better ask your real problem from the start |
| 08:16 | dysfun | clgv: i had to realise what my real problem was first :) |
| 08:17 | Glenjamin | repeatedly + closure could get a similar effect to lazy-reduce? |
| 08:17 | clgv | dysfun: you can describe it in small examples of input and output |
| 08:17 | Glenjamin | i suppose you'd need an atom or something, which makes it a bit weird |
| 08:17 | rritoch | clgv: He only asked to make it lazy, he didn't say why. I'm simply providing real world cases where wrapping it in repeatedly to make it lazy is useful. |
| 08:18 | clgv | rritoch: do what you like. I provided the information that was asked for ;) |
| 08:18 | rritoch | clgv: But yes, you wouldn't wrap a reduce like that with a small number of values, but if you have thousands of records to process it can make a big difference |
| 08:20 | rritoch | clgv: I was simply attempting to help dysfun with his problem. I seriously don't know what your problem is |
| 08:22 | rritoch | I have received a lot of help in this room, and I return it by sharing from my 30+ years programming experience. Dysfun in particular has helped me with some issues. I have no interest in the ego games that go on here because I don't need a name for myself, I already have one. |
| 08:23 | Glenjamin | rritoch: it's not clear to me how you would convert a (reduce) into use of (repeatedly) that gives an equivalent sequence |
| 08:24 | dysfun | uh-oh, it's the "30+ years of programming experience card |
| 08:24 | Bronsa | :| |
| 08:25 | clgv | rritoch: well, it is a relevant information that the pattern (let [v (repeatedly (reduce f anything)))] ... (first v)) is nonsense, just use (let [v (delay (reduce f anything))] ... @v) for on-demand calculation |
| 08:25 | clgv | missing a # |
| 08:25 | Bronsa | clgv: he left |
| 08:25 | clgv | then for dysfun ;) |
| 08:29 | dysfun | oh wow. he just said some rude things to me in /query |
| 08:30 | clgv | dysfun: he probably confused us then, right? |
| 08:30 | dysfun | no, i think he didn't like my dripping sarcasm |
| 08:30 | dysfun | apparently we went on ego trips |
| 08:30 | clgv | ah right. but now I recall him vaguely from that "30+ years .." comment. not the first time |
| 08:31 | Bronsa | dysfun: just /ignore the guy |
| 08:31 | Glenjamin | (let [red (atom [initial coll]), iterator (fn [] (swap! red (fn [[m [v & coll]]] [(f m v) coll]))] (repeatedly f)) |
| 08:31 | dysfun | i imagine it's more fun to keep winding him up in /query actually |
| 08:32 | Glenjamin | sort-of-lazy-reduce-using-repeatedly. i wouldn't have said "just wrap" though |
| 08:32 | rritoch | Glenjamin: Sorry I didn't get a chance to answer you before, but synergy crashed my X server again... |
| 08:32 | Bronsa | there's no point in using repeatedly |
| 08:32 | Bronsa | just use lazy-seq |
| 08:32 | Glenjamin | oh right |
| 08:33 | Glenjamin | is there a way to do it without the atom? |
| 08:33 | Glenjamin | i guess not, because the progress of the iterator has to live out-of-band |
| 08:33 | clgv | Glenjamin: maybe you should first define what "lazy reduce" shall mean. one interpretation is "having intermediate results as lazy-seq and decide until which intermediate results you want to realize" that's `reductions` then |
| 08:34 | Glenjamin | ah right, i was thinking of reduce as a loop, but it isn't really |
| 08:34 | Bronsa | it's nonsense to ask for a lazy reduce |
| 08:34 | clgv | Glenjamin: `map` with some accumulator state would be a different possibility |
| 08:35 | clgv | Bronsa: as term yes - but as a vague description of what is desired in lack of a better explanation, it is a starting point |
| 08:42 | andyf | Bronsa: I believe you mentioned once that tools.reader had some feature where comments could optionally affect the values read somehow. Am I imagining that? |
| 08:42 | Bronsa | andyf: yes :) |
| 08:42 | andyf | well at least my imagination is still pretty active, then :) |
| 08:43 | Glenjamin | andyf: i watched that annex talk you recommended, some really cool ideas in there |
| 08:43 | Glenjamin | cheers for the pointer |
| 08:43 | andyf | you are welcome. The speaker definitely seems somewhat ambitious in his desires. |
| 09:09 | nonuby | taking a look at yesql, how are you meant to test .sql files in say pgadmin which doesnt seem to support ? |
| 09:24 | dysfun | is there a variant of sum that rejects only nils? |
| 09:24 | dysfun | some* rather |
| 09:24 | Glenjamin | (doc keep) |
| 09:25 | clojurebot | "([f] [f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided." |
| 09:25 | dysfun | that would require (first (keep ...)) |
| 09:26 | Glenjamin | oh right, i didn't check some properly |
| 09:26 | clojurebot | excusez-moi |
| 09:26 | dysfun | i could live with it in this case, but i'm curious if there's a builtin |
| 09:28 | Glenjamin | (def coalese (comp first (partial apply keep)) ; or something i guess |
| 09:29 | Glenjamin | oh, keep needs a predicate |
| 09:29 | Glenjamin | there's some dicussion here: http://stackoverflow.com/questions/4086889/clojure-coalesce-function |
| 09:41 | dysfun | Glenjamin: brilliant, thanks |
| 09:42 | sdegutis | Is it bad practice to use a bare name when creating a top-level namespace, like 'foo? |
| 09:44 | clgv | sdegutis: collisisions are likelier if you do that a lot, hence the library name is often used as prefix |
| 09:44 | sdegutis | Maybe I can avoid that with a shorter name, like 'f |
| 09:44 | clrnd | why not just use a real descriptive name? |
| 09:45 | clgv | sdegutis: is there a reason that you do not want to use a common prefix for that project? |
| 09:45 | sdegutis | Is it possible to rebind *ns* inside a (load-reader) call from outside the call? |
| 09:45 | sdegutis | clrnd, clgv: It's not a project. |
| 09:45 | clgv | sdegutis: a script? |
| 09:46 | clgv | in that case just use the flat namespace, if any at all |
| 09:55 | sdegutis | clgv: It's for .clj view files. |
| 09:57 | sdegutis | clgv: You would have "src/views/something.clj" that just contains [:div "whatever"] and you would (render-view "something") which would return "<div>whatever</div>" or something. |
| 09:57 | sdegutis | clgv: And inside something.clj, I want to set the namespace to 'v from outside the call to (render-view ...) |
| 09:57 | sdegutis | I could just put (ns 'v) at the very top of every src/vies/*.clj file, but I'm hoping to find another way. |
| 09:58 | Glenjamin | sdegutis: can you just have render-view resolve it? |
| 09:59 | clgv | sdegutis: sounds pretty complicated - are you sure you dont want to use vanialla clojure namespaces? |
| 10:00 | sdegutis | clgv: I want to be able to have access to some convenience functions and variables that are defined in other places. |
| 10:02 | clgv | sdegutis: just make sure you really have net benefit from that construction |
| 10:03 | schmir | is it possible to deliver a throwable instance to a promise such that deref on the promise throws the exception? |
| 10:06 | clgv | schmir: you coud wrap the actual promise with (reify IDeref ) that derefs the actual promise and throws if needed |
| 10:28 | sdegutis | I found the source of my problem. I was using with-redefs instead of binding to temporarily redefine *ns*. |
| 10:52 | CookedGryphon | Ugh, thought I'd fixed this. Is anyone else trying to use clojure on android in Lollipop? |
| 10:53 | CookedGryphon | it's really insistent that the bytecode generated by clojure's with-locking macro is invalid |
| 10:54 | ustunozgur | hi all, in cider, when I switch namespaces (C-c M-n), the required/referred things are not visible. any idea how to solve this? |
| 10:54 | ustunozgur | I have something like [datomic.api :as d] in my namespace, but typing d in repl causes "Unable to resolve symbol: d in this context" |
| 10:54 | ustunozgur | I can still do C-M-x in my source file though |
| 10:55 | ustunozgur | only the repl doesn't work when I type manually |
| 10:55 | sdegutis | ustunozgur: d is not a symbol |
| 10:55 | sdegutis | ustunozgur: it's just a namespace; Clojure doesn't have first-class namespaces |
| 10:55 | sdegutis | ustunozgur: using "d" is only valid in the form "d/foo" |
| 10:56 | sdegutis | ustunozgur: well technically Clojure does have first-class namespaces, but they're cumbersome to use directly |
| 10:56 | ustunozgur | sdegutis: Oh, right. |
| 10:56 | ustunozgur | but if I referred symbols, I would be using them, right? |
| 10:57 | clgv | ustunozgur: you can get the namespace via (the-ns 'my.ns) |
| 10:57 | sdegutis | Right. |
| 10:57 | ustunozgur | OK, thanks. |
| 11:02 | sdegutis | Why is that a very simple hello world Clojure app takes 1.02 seconds to run? |
| 11:06 | clgv | sdegutis: Clojure startup is not the fastest - there is research on accelerating it |
| 11:07 | FriedBob | Because it has to start up a jvm |
| 11:07 | micrypt | sdegutis: Perhaps this might help, http://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html |
| 11:07 | clgv | FriedBob: JVM is relatively unproblematic in comparison to clojure itseld |
| 11:07 | clgv | micrypt: good link! |
| 11:07 | clgv | (inc micrypt) |
| 11:07 | lazybot | ⇒ 1 |
| 11:10 | engblom | ,seen hiredman |
| 11:10 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seen in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 11:12 | sdegutis | $seen weavejester |
| 11:12 | lazybot | weavejester was last seen quittingQuit: weavejester 17 hours and 34 minutes ago. |
| 11:12 | sdegutis | ah, good old quittingQuit |
| 11:12 | EvanR | whats so slow about clojure program startup? |
| 11:13 | sdegutis | Is there a way to determine the namespace of the calling function? |
| 11:14 | clgv | EvanR: http://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html (linked by micrypt before) |
| 11:15 | engblom | Hopefully we one day have the same fast startup as clisp or sbcl... |
| 11:17 | sdegutis | ,((fn f [a] [a (f (inc a))]) 1) |
| 11:17 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 11:17 | Bronsa | sdegutis: what would you have expected that to do? |
| 11:18 | sdegutis | Overflow. |
| 11:18 | sdegutis | (The stack.) |
| 11:18 | Bronsa | then what was the point? |
| 11:18 | sdegutis | To create a named "anonymous" function! |
| 11:18 | sdegutis | :D |
| 11:18 | sdegutis | I should use them more oft. |
| 11:28 | engblom | Is there a ready made short circuit for (map)? Given a sequence of numbers [0 0 3 2 0 4] I want the first non-zero to be decreased. The result would thus be [ 0 0 2 2 0 4]. It would be trivial to decrease all non-zero values with map. |
| 11:29 | engblom | This could be done with loop...recur, but I am wondering if there is a better solution. |
| 11:31 | sdegutis | engblom: You might be able to do it with some kind of filter+map+juxt combination. |
| 11:31 | clojure_beginner | Anyone using fireplace plugin in VIM ? |
| 11:31 | engblom | clojure_beginner: I am. |
| 11:31 | clojure_beginner | I get this strange behaviour when I try to eval some lazy seqs |
| 11:32 | sdegutis | engblom: Or, split the seq based on the first (even?), map the first element, and re-join them. |
| 11:32 | clojure_beginner | I have this fibonaci function (defn fibo [] 153 (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1]))) |
| 11:32 | EvanR | clgv: seems absurd |
| 11:32 | clgv | EvanR: what exactly? |
| 11:32 | clojure_beginner | without the 153 part..sorry don't know how i managed to paste thath |
| 11:33 | EvanR | clgv: the startup time and the reasons behind it |
| 11:33 | clojure_beginner | then I do (def lots-of-fibs (take 1000000 (fibo)) and then (nth 1000 (fibo)) It halts.. |
| 11:33 | clgv | EvanR: not ideal for scripting but anything else usually takes some time to load |
| 11:33 | sdegutis | engblom: like ##(split-with (comp not zero?) [0 0 3 2 0 4]) |
| 11:33 | lazybot | ⇒ [() (0 0 3 2 0 4)] |
| 11:34 | sdegutis | engblom: or maybe ##(split-with (comp zero? not) [0 0 3 2 0 4]) |
| 11:34 | lazybot | java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number |
| 11:34 | EvanR | reminds me of php frameworks doing a huge batch of "class loading" on each request, which actually is way faster than this |
| 11:34 | clojure_beginner | but only in vim, if i do it in repl directly all is fine |
| 11:34 | clgv | EvanR: one second is not that long for programs you use at least 5 minutes ;) |
| 11:34 | EvanR | clgv: right, "think photoshop or maya" |
| 11:34 | EvanR | you get a nice splash and a progress bar |
| 11:35 | clgv | EvanR: afair there is research in progress how to improve clojure startup times |
| 11:35 | clojure_beginner | Damn Im gonna have to learn emacs |
| 11:35 | sdegutis | clojure_beginner: don't do it! |
| 11:35 | sdegutis | it's a trap! |
| 11:36 | clgv | clojure_beginner: emacs is not the only option you have apart from vim ;) |
| 11:36 | EvanR | clojure_beginner: im using vim right now and its ok |
| 11:36 | clojure_beginner | Yea I knwo, it's evil |
| 11:36 | mindbender1 | What's the real difference between an interface and a protocol? |
| 11:36 | EvanR | clojure_beginner: its easier for me to have all these functions already defined in a text file that i can run from vim rather than typing out new definitions in an interactive way |
| 11:37 | clojure_beginner | clgv: Yea I know about ight table..but... |
| 11:37 | mindbender1 | That's from a general programming point of view. |
| 11:38 | clojure_beginner | EvanR: But I am running vim with fireplace plugin, so I can connect to repl, move cursor on the function definition and hit ctrl + e to eval and see the result |
| 11:38 | EvanR | clojure_beginner: me too |
| 11:38 | engblom | The only thing I am using Emacs for is as an IRC-client. I need a spell checker and there is no other console irc client including a spell check if I want to use openbsd. |
| 11:38 | EvanR | only i use cpp |
| 11:38 | dopamean_ | i like cpp as well |
| 11:39 | clojure_beginner | but lazy sequence realizations take long time or halt my vim.. |
| 11:39 | EvanR | clojure_beginner: er, im not having this problem |
| 11:39 | engblom | I am also quite often use :Require! followed by cqc and testing all I want. |
| 11:39 | engblom | (for vim) |
| 11:40 | EvanR | i rebound local leader r for re-require |
| 11:40 | EvanR | still a lot of key presses to retry something after changing code, but not nearly as bad as moving the mouse over to the reload repl button(s) in intellij |
| 11:41 | clojure_beginner | EvanR: The problem was In my code |
| 11:41 | clojure_beginner | sorry :D |
| 11:41 | clojure_beginner | Now works fine :) |
| 11:41 | wink | engblom: yeah. first thing I associate with emacs: irc client with spell checker on openbsd :) |
| 11:42 | EvanR | also you can look at backtraces in lop, and the last chunk of output is available in the quickfix window |
| 11:42 | EvanR | lop, the locations window |
| 11:43 | clojure_beginner | EvanR: Locations window, on emacs ? |
| 11:43 | EvanR | no i was talking about vim/fireplace |
| 11:45 | clojure_beginner | Just found out there is this https://github.com/ctford/vim-fireplace-easy/ |
| 11:45 | clojure_beginner | it automatically connects to repl if you are inside clojure project |
| 11:46 | EvanR | yes fireplace does that |
| 11:46 | EvanR | well, if you have ~/.nrepl-port |
| 11:48 | engblom | clojure_beginner: Do you know pathogen? With pathogen you very easily install these packages: vim-fireplace, vim-clojure-static, supertab, rainbow_parentheses.vim |
| 11:48 | engblom | clojure_beginner: vim-fireplace will automatically connect to a running repl. Just do 'lein repl' before starting vim. |
| 11:49 | clojure_beginner | englob, yes I know pathogen, i already have clojure-static, fireplace and rainbow parenthesis installed |
| 11:49 | clgv | clojure_beginner: there is also cursive and counterclockwise ;) |
| 11:49 | clojure_beginner | clgv, Ill check those too. |
| 11:50 | EvanR | clojure-static comes with vim now |
| 11:50 | EvanR | and the latest version of vim has a bugfix for lispwords, also built in |
| 11:50 | EvanR | though ubuntus vim is not the latest ;( |
| 11:56 | justin_smith | TEttinger2: I kind of caught the context in scrollback, but what's the deal with the sandboxing and awt? |
| 11:57 | clgv | EvanR: ppa then ;) |
| 11:58 | EvanR | ppa? |
| 11:58 | justin_smith | EvanR: unofficial sources, often more up to date |
| 11:58 | justin_smith | $google ubuntu ppa |
| 11:58 | lazybot | [Personal Package Archives : Ubuntu - Launchpad] https://launchpad.net/ubuntu/+ppas |
| 11:58 | justin_smith | $google ubuntu ppa vim |
| 11:58 | lazybot | [Personal Package Archives : Ubuntu - Launchpad] https://launchpad.net/ubuntu/+ppas?name_filter=vim |
| 11:59 | EvanR | nice ill check that out |
| 11:59 | justin_smith | top package on that second list may just be what you want |
| 11:59 | justin_smith | wait, no, not uploaded since 2009.. |
| 12:00 | justin_smith | https://launchpad.net/~sylvain-pineau/+archive/ubuntu/vim this looks decently up to date |
| 12:36 | engblom | I have reached the level where I get most of the functions I want done, but I still think I would need to develop a bit of skill in making clean looking functions. I quite often end up with chains of let ... if ... let ... if. How would you clean up the function new-heaps in this paste: http://pastebin.com/7UywPRGY |
| 12:38 | sdegutis | Is (->> coll (drop-while pred) (first)) the best way to get the first item of coll that matches pred? |
| 12:39 | technomancy | drop-while or remove |
| 12:40 | sdegutis | I suspect drop-while will be a little more efficient if it's a long (or lazy) list. |
| 12:40 | Bronsa | sdegutis: that'll get you the first item of coll that _doesn't_ match pred |
| 12:40 | sdegutis | yeah I meant (comp not ...) |
| 12:40 | gfredericks | If you've ever gotten nondeterministic failures from an nrepl plugin, you might want this: https://github.com/gfredericks/nrepl-53-monkeypatch |
| 12:41 | sdegutis | I can't just use take-while though because it might not ever get to the first result. |
| 12:41 | technomancy | sdegutis: hm; there could be a difference for chunked seqs |
| 12:41 | Bronsa | sdegutis: do you want the first element that matches then? |
| 12:41 | sdegutis | Yes. |
| 12:41 | Bronsa | sdegutis: if so use (comp first filter) |
| 12:41 | sdegutis | I want Ruby's coll.find{} |
| 12:41 | sdegutis | Bronsa: That could be inefficient if it's a {big,lazy} coll. |
| 12:42 | Bronsa | no |
| 12:42 | Bronsa | filter is lazy |
| 12:42 | sdegutis | Oh nice! |
| 12:42 | sdegutis | Thanks :) |
| 12:42 | sdegutis | In fact, now that you mention it, I do filter/first elsewhere. |
| 12:42 | sdegutis | Dunno how I forgot ;) |
| 12:42 | sdegutis | *:) |
| 13:06 | sdegutis | What are some libs that enhance the Lein Test Experience? |
| 13:06 | danielcompton | sdegutis: humane test output |
| 13:07 | danielcompton | sdegutis: https://github.com/technomancy/leiningen/wiki/Plugins#testing |
| 13:18 | sdegutis | I was hoping to garner some opining based on personal experience. |
| 13:19 | technomancy | humane-test-output is great |
| 13:24 | sdegutis | pjstadig: nice work |
| 13:28 | sdegutis | I'm surprised it doesn't colorize the output or have an option to. |
| 13:29 | arrdem | pulll requests accepted I'm sure :D |
| 13:30 | sdegutis | Maybe there could be another plugin that just colorizes the output of this? |
| 13:30 | sdegutis | I dunno if that's possible in a clean way though. |
| 13:31 | clgv | sdegutis: midje has color output |
| 13:31 | sdegutis | I remember hearing that midje's author was deprecating it? |
| 13:31 | clgv | huh? where? |
| 13:31 | sdegutis | Or that somehow he wasn't satisfied with it but didn't have time to fix the things he didn't like about it? |
| 13:31 | sdegutis | I don't remember. |
| 13:32 | technomancy | difftest has colorized output and works with clojure.test |
| 13:37 | TimMc | clgv: They said "Technikern" is fine. Do you suppose it's a dialect or regional difference? |
| 13:40 | octane-- | ach. |
| 13:43 | clgv | TimMc: no in general "Ingenieur" would be more fitting but usually the keep the job title in English here as well "Software Engineer" is common |
| 13:45 | TimMc | *shrug* I don't know German so I won't try to push it. :-P |
| 13:47 | clgv | TimMc: I just mentioned it since it sounded very funny ;) |
| 13:48 | TimMc | Whoever they're using for translation doesn't think so, which is interesting. That's why I was wondering about regionalisms. |
| 13:52 | mi6x3m | hey Clojure, when using pprint generating a multiline output from '(ns blabla [] ... []) |
| 13:52 | mi6x3m | is there a way to make ns and blabla stay on the same line? |
| 13:55 | technomancy | mi6x3m: check out how slamhound does it |
| 13:56 | clgv | TimMc: he probably choose just one of the translations listed and does not want to change anything now ;) |
| 13:57 | clgv | or she |
| 13:57 | mi6x3m | technomancy: I found some example which uses code-dispatch as the dispatcher |
| 13:57 | mi6x3m | this does it :) |
| 13:58 | arrdem | fipp has a better pretty printer for code than core's |
| 13:58 | arrdem | fwiw |
| 13:58 | mi6x3m | ah, well I have a simple usecase :) |
| 14:07 | TimMc | clgv: Prolly. :-) |
| 14:09 | pandeiro | are there examples anywhere of jetty log configuration when using lein ring uberwar to run clojure apps as servlets? how does one get request logs, or log to stdout, for example? |
| 14:13 | clgv | pandeiro: if you set the logging level to "debug" jetty is pretty chatty :/ |
| 14:16 | pandeiro | clgv: yeah i am searching for some kind of reasonable default i guess - what i have now is too little |
| 14:17 | clgv | pandeiro: you could just add a ring middle ware that logs every request on "info" level for example |
| 14:18 | larhat1 | Hi folks! This snippet: `(doseq [r [(range)]] (doseq [i r]))` is eating all my memory over time. Shouldn't it just burn my cpu, like `(doseq [r (range)] )` does? |
| 14:19 | gfredericks | larhat1: presumably it's holding the head for some reason |
| 14:19 | gfredericks | I don't know enough about the compiler internals to say why, but it doesn't surprise me too much |
| 14:19 | gfredericks | ,(macroexpand-1 '(doseq [i r])) |
| 14:19 | clojurebot | (clojure.core/loop [seq_27 (clojure.core/seq r) chunk_28 nil count_29 ...] (if (clojure.core/< i_30 count_29) (clojure.core/let [i (.nth chunk_28 i_30)] (do) (recur seq_27 chunk_28 count_29 (clojure.core/unchecked-inc i_30))) (clojure.core/when-let [seq_27 (clojure.core/seq seq_27)] (if (clojure.core/chunked-seq? seq_27) (clojure.core/let [c__4649__auto__ (clojure.core/chunk-first seq_27)] (recur ... |
| 14:19 | larhat1 | gfredericks: http://clojuredocs.org/clojure.core/doseq says `Does not retain the head of the sequence` |
| 14:20 | gfredericks | doseq itself might not but that doesn't mean some other aspect of the code isn't |
| 14:21 | justin_smith | larhat1: it doesn't promise not to hold the head of any element of it's input - the inner doseq handles range properly, the outer may not |
| 14:21 | gfredericks | I don't see anything suspicious though |
| 14:21 | pandeiro | clgv: sure that works |
| 14:21 | pandeiro | but it feels like something that should just be handled via jetty configuration, but i don't get how to configure it - if i have to write java code, a 'properties' file, etc |
| 14:22 | pandeiro | this is where one feels the pain of using clojure w/o much java know-how |
| 14:22 | technomancy | https://twitter.com/ieure/status/535113259242627072 |
| 14:24 | justin_smith | pandeiro: you can use a properties file (they aren't super complex), and/or one of the clojure wrappers like clj-logging-config https://github.com/malcolmsparks/clj-logging-config |
| 14:24 | pandeiro | technomancy: doesn't bode well for me ey |
| 14:24 | larhat1 | justin_smith: gfredericks so, is there any way to avoid this mem leak? |
| 14:24 | technomancy | IME jetty should just dtrt without config |
| 14:25 | technomancy | oh, if you're embedding it anyway |
| 14:25 | technomancy | containers are going to be a whole new can of worms |
| 14:25 | pandeiro | technomancy: containers meaning uberwars? |
| 14:26 | justin_smith | pandeiro: a container is a thing that hosts an uberwar |
| 14:26 | justin_smith | but configuring the container will be editing some xml - it stinks, but it still isn't like you need to write java |
| 14:26 | gfredericks | larhat1: depends on what your actual code looks like; (doseq [i (apply concat [(range)])]) would be equivalent, right? |
| 14:26 | pandeiro | justin_smith: so if i have a couple different projects that produce uberwars and run in one jetty instance - i would stick that clj-logging code in one of the projects? |
| 14:26 | justin_smith | or if you're lucky, a properties file instead of xml |
| 14:27 | justin_smith | pandeiro: not sure that works, I think it's the container that will configure the logging |
| 14:27 | prepor | gfredericks justin_smith ok, how about this snippet https://www.refheap.com/307eee40179e65666ae5f91ae ? |
| 14:27 | pandeiro | justin_smith: container = the single jetty instance running multiple wars, right? |
| 14:27 | justin_smith | right |
| 14:27 | pandeiro | so yeah, if so, that is what i want to configure |
| 14:29 | pandeiro | http://www.eclipse.org/jetty/documentation/current/configuring-logging.html |
| 14:29 | prepor | gfredericks: there are no doseq's, just plain loops. and it leaks |
| 14:29 | pandeiro | and i start to resemble technomancy's tweet |
| 14:29 | sdegutis | Given ##'foo.bar/quux how do you return the function it refers to (even if foo.bar hasn't been required yet)? |
| 14:29 | lazybot | ⇒ foo.bar/quux |
| 14:30 | justin_smith | sdegutis: ##(deref #'+) |
| 14:30 | lazybot | ⇒ #<core$_PLUS_ clojure.core$_PLUS_@5b4ef688> |
| 14:30 | arrdem | you can't do that if foo.bar hasn't been loaded yet |
| 14:31 | sdegutis | Sorry no, I only have a symbol. |
| 14:31 | justin_smith | arrdem: yeah, of course you can't access code that hasn't been loaded |
| 14:31 | sdegutis | 'foo.bar/quux |
| 14:31 | justin_smith | sdegutis: or ##(resolve 'clojure.core/+) |
| 14:31 | lazybot | java.lang.SecurityException: You tripped the alarm! resolve is bad! |
| 14:31 | justin_smith | sdegutis: the above will work in your code |
| 14:31 | sdegutis | Thanks. |
| 14:31 | sdegutis | So I need to do require first then resolve? |
| 14:31 | justin_smith | it will fail if somehow that thing did not get resolved |
| 14:32 | justin_smith | well, the thing needs to be defined *somehow* before the resolve gets called |
| 14:32 | justin_smith | but the compiler doesn't care when |
| 14:32 | gfredericks | prepor: well that one leaks because of what (repeat (range)) does; you probably want (repeatedly range) |
| 14:32 | justin_smith | sdegutis: it's the go-to ugly hack for circular dependencies, and the real fix is to have a better namespace structure |
| 14:33 | prepor | gfredericks: my real code is https://www.refheap.com/9bc27b5809133db3a1e8b2503. and it leaks |
| 14:33 | justin_smith | *namespace dependency structure |
| 14:33 | gfredericks | prepor: btw have you tried using two clauses in a single doseq instead of two doseqs? |
| 14:34 | justin_smith | gfredericks: prepor: yeah, I was about to suggest doing that too |
| 14:34 | gfredericks | prepor: and if this is your real code you might just use count and for instead of doseq |
| 14:34 | gfredericks | (i.e., you wouldn't need the atom either) |
| 14:35 | justin_smith | oh yeah, that's the right way to do it |
| 14:35 | prepor | gfredericks ok that isn't my ALL real code ) but why it leak. even without doseq's https://www.refheap.com/252852b208e240cebf8045f89 |
| 14:35 | justin_smith | (inc gfredericks) |
| 14:35 | lazybot | ⇒ 107 |
| 14:36 | justin_smith | prepor: there is no point in using with-open there |
| 14:37 | justin_smith | or is there, actually, never mind |
| 14:37 | gfredericks | prepor: did you try a doseq with 2 clauses yet? |
| 14:38 | sdegutis | I see that ##(name 'foo.bar/quux) will give "quux" kind of like a "basename" function. Is there an equivalent to "dirname" that would give "foo.bar"? |
| 14:38 | lazybot | ⇒ "quux" |
| 14:39 | aperiodic | sdegutis: namespace |
| 14:39 | justin_smith | &(namespace 'clojure.core/+) |
| 14:39 | lazybot | ⇒ "clojure.core" |
| 14:39 | prepor | gfredericks justin_smith yourkit tells me that something inside `first` (!) hold link to the first element of collection. so it leaks because that. is this ok? ) |
| 14:39 | justin_smith | prepor, you ask for the first item, and then you make a local binding for it, so it will be held onto until the scope is gone |
| 14:40 | justin_smith | using a two clause doseq, you would avoid this problem |
| 14:40 | prepor | gfredericks: ok (doseq [r [(range)] i r]) also leaks |
| 14:40 | prepor | justin_smith no |
| 14:40 | sdegutis | aperiodic: You win, thanks. |
| 14:40 | gfredericks | ,(doseq [r [(range)] i r]) |
| 14:41 | clojurebot | #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space> |
| 14:41 | prepor | gfredericks ooops :) |
| 14:41 | gfredericks | ,(doseq [i (apply concat [(range)])]) |
| 14:41 | clojurebot | eval service is offline |
| 14:42 | gfredericks | &(doseq [i (apply concat [(range)])]) |
| 14:42 | prepor | gfredericks it will be ok |
| 14:42 | justin_smith | gfredericks: oh yeah, your apply concat suggestion from before |
| 14:42 | lazybot | Execution Timed Out! |
| 14:43 | gfredericks | welp I don't get it |
| 14:44 | amalloy | gfredericks: i don't get it, what are you trying to show? (apply concat [x]) is just x (provided that x is sequential), so this is just (doseq [i (range)] ...) |
| 14:44 | prepor | gfredericks its just infinite loop, but not leaks |
| 14:44 | gfredericks | amalloy: why does (doseq [r [(range)] i r]) hold the head? |
| 14:44 | prepor | gfredericks: see macroexpand |
| 14:45 | gfredericks | amalloy will get to the bottom of this |
| 14:45 | prepor | gfredericks https://www.refheap.com/75866d7cd10339e9a458fdeee |
| 14:45 | amalloy | gfredericks: my guess is the chunked seq on the vector [(range)] keeps a pointer to the original vector |
| 14:45 | gfredericks | ~amalloy |
| 14:45 | clojurebot | That's *the* amalloy to you |
| 14:46 | gfredericks | ,(doseq [r (list (range)) i r]) |
| 14:46 | prepor | gfredericks (recur (next seq_3788) nil 0 0) |
| 14:46 | clojurebot | #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space> |
| 14:46 | gfredericks | amalloy: ^ no chunking there |
| 14:47 | prepor | gfredericks i understand wgy doseq isn't working (but i think this is problem of lang), but i don't understand why by examples with plain loops leaks |
| 14:48 | prepor | justin_smith: "it will be held onto until the scope is gone" as i know this is not how GC works |
| 14:49 | visof | hi guys |
| 14:49 | havenwood | hi |
| 14:50 | justin_smith | prepor: it can't be gc'd if there is something that can access it. The scope determines this. Though clojure also does some fancy manual locals clearing. |
| 14:50 | zarkone | hello all! Situation: i write a program with repl and cider and consider to use core.match. I include it into project.clj deps. How can i load it to repl on fly? (use '[clojure.core.match :only (match)]) errors "Couldn locate class" |
| 14:50 | zarkone | |
| 14:51 | visof | what is the best way to convert this [{"hello" "world"} {"good" "year"} {"hello" "foo"} {"good" "nothing"} {"else" "there"}] to {"hello" ["world" "foo"] "good" ["year" "nothing"] "else" ["there"]} ? |
| 14:51 | prepor | justin_smith not scope determines this, but references, isn't it? ) |
| 14:51 | zarkone | i'm qute new to clojure and jvm.. |
| 14:51 | visof | i can do this with atom and change it using swap! |
| 14:51 | amalloy | gfredericks: https://www.refheap.com/e87e3120df06173bce7734fd9 is a trimmed down version of the macroexpansion. i've removed most of it, since it doesn't look like it's actually relevant and it's really distracting |
| 14:52 | visof | is there a good functional solution ? |
| 14:52 | justin_smith | prepor: the scope determines where those references can be. |
| 14:52 | prepor | justin_smith: its not ARC, it's GC. GC know nothing about lexical scopes. |
| 14:52 | amalloy | it looks like next isn't called on [(range)] until it's time to recur, so the outer loop is holding onto (seq [(range)]) while the inner loop runs |
| 14:53 | prepor | amalloy yes! |
| 14:54 | prepor | amalloy in case of doseq. but i also have leak withou doseq, with plain loops. https://www.refheap.com/307eee40179e65666ae5f91ae |
| 14:54 | justin_smith | prepor: same thing, you have a loop binding to the collection while iterating on its first item, the binding prevents gc |
| 14:55 | justin_smith | the first item is accessible, via the outer loop, thus cannot be collected |
| 14:55 | amalloy | justin_smith: i don't think it's that simple. prepor is only saving a binding to (rest coll), not to coll |
| 14:55 | amalloy | prepor: i think you might fix this just by replacing rest with next |
| 14:55 | justin_smith | (let [category (first categories) ..]) |
| 14:56 | justin_smith | that holds onto the head of category |
| 14:56 | amalloy | justin_smith: doesn't matter |
| 14:56 | justin_smith | OK |
| 14:56 | amalloy | category isn't actually *used* in the outer loop after initializing the inner loop |
| 14:56 | prepor | amalloy, no i can't fix it by this way |
| 14:56 | amalloy | so the compiler un-references it, making it available for gc |
| 14:56 | justin_smith | amalloy: OK, the locals-clearing thing, got it |
| 14:58 | aperiodic | visof: (group-by (comp first keys) ...) gets you most of the way there |
| 14:59 | gfredericks | justin_smith: the first item in a seq isn't the same as the head... |
| 14:59 | amalloy | visof: (apply merge-with into (for [m ms, [k v] m] {k [v]})) |
| 14:59 | gfredericks | oh nm I think I Misread |
| 15:00 | sdegutis | Thank you justin_smith for all your help. |
| 15:00 | justin_smith | gfredericks: the first item of the outer loop is the head of the inner loop |
| 15:00 | justin_smith | sdegutis: np |
| 15:00 | bbloom | d'oh. am i on a 10 minute delay somehow again? |
| 15:01 | bbloom | ,(do (defmacro m1 [] 1) (m1)) |
| 15:01 | clojurebot | 1 |
| 15:01 | bbloom | &(do (defmacro m1 [] 1) (m1)) |
| 15:01 | lazybot | java.lang.SecurityException: You tripped the alarm! def is bad! |
| 15:01 | amalloy | specifically, ##(let [ms '[{"hello" "world"} {"good" "year"} {"hello" "foo"} {"good" "nothing"} {"else" "there"}]] (apply merge-with into (for [m ms, [k v] m] {k [v]}))) |
| 15:01 | lazybot | ⇒ {"else" ["there"], "good" ["year" "nothing"], "hello" ["world" "foo"]} |
| 15:01 | justin_smith | gfredericks: but as amalloy points out, it isn't held onto thanks to locals clearing |
| 15:01 | bbloom | &(let [_ (defmacro m2 [] 2)] (m2)) |
| 15:01 | lazybot | java.lang.SecurityException: You tripped the alarm! def is bad! |
| 15:01 | bbloom | ,(let [_ (defmacro m2 [] 2)] (m2)) |
| 15:01 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval52/m2--53> |
| 15:02 | bbloom | i guess the do expression compiles the forms separately, evaluating them in sequence, |
| 15:02 | amalloy | bbloom: yes |
| 15:02 | bbloom | but the let seems to compile them all at once |
| 15:02 | justin_smith | ,(let [_ (defmacro m2 [] 2)] (m2 nil nil)) ;; bbloom |
| 15:02 | clojurebot | #<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval52/m2--53, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:02 | justin_smith | err |
| 15:03 | amalloy | justin_smith: that's calling bbloom's version |
| 15:03 | bbloom | use m3 |
| 15:03 | amalloy | because the let is all compiled as one form |
| 15:03 | justin_smith | ,(let [_ (defmacro m4 [] 2)] (m4 nil nil)) |
| 15:03 | clojurebot | 2 |
| 15:03 | amalloy | that's a funny little quirk, justin_smith |
| 15:04 | justin_smith | indeed |
| 15:04 | amalloy | the defmacro creates a var at macroexpansion time (by expanding to def), but doesn't set the metadata on it or define it |
| 15:04 | prepor | amalloy do you have any ideas why this snippet with tho loops leaks? And do you think that its ok that (doseq [r [(range)] i r]) leaks? :) |
| 15:04 | bbloom | i've been wondering about dynamic definitions of macros, macrolet, etc |
| 15:04 | bbloom | racket jumps through lots of hoops to make macro defining macros and the like |
| 15:05 | amalloy | prepor: i wasn't able to reproduce your memory leak easily. as for doseq, i think it has to choose between two bad behaviors, and the one it picked seems as good as anything else |
| 15:05 | bbloom | but to some extent it has to b/c the compilation unit is a whole module, where as in clojure each top level is it's own compilation unit |
| 15:05 | bbloom | so a macro can be valid in the next compilation unit only |
| 15:05 | bbloom | seems much simpler :-P |
| 15:06 | prepor | amalloy: this snippet doesn't leak for you https://www.refheap.com/307eee40179e65666ae5f91ae ? |
| 15:06 | amalloy | prepor: it might leak eventually, but it was taking a long time and i need my repl |
| 15:08 | prepor | amalloy: it leaks very fast for me https://www.dropbox.com/s/uc0ih6ywcmmyrs0/Screenshot%202014-11-20%2004.06.48.png?dl=0 |
| 15:27 | sdegutis | Is there a way to pass additional arguments only if the function you're calling happens to handle them, and otherwise omit them, so that it doesn't throw a "too many args" exception? |
| 15:27 | sdegutis | The only way I can conceive of is by defining it as (defn my-function [{:keys [foo bar quux]}] ...) and calling it as (my-function {:foo 1 :bar 2 :quux 3 :zizzle 4}) |
| 15:27 | danielcompton | sdegutis: you can make a variable number of args with &, or write a function with several different signatures |
| 15:28 | sdegutis | The goal is to make it just as convenient to write a function that takes all the args as to write one that only takes some. |
| 15:29 | sdegutis | Obviously it would be more ideal to write (defn my-function [foo] ...) because it's shorter, and then just call (my-function 1 2 3 4) |
| 15:29 | sdegutis | But that would throw exceptions. |
| 15:29 | justin_smith | sdegutis: (defn f [& [a b]] ...) takes any number of args, but only tries to use the first two |
| 15:29 | sdegutis | justin_smith: That might just do the trick! |
| 15:30 | justin_smith | you're giving up on some basic error checking there of course |
| 15:30 | justin_smith | but it is super flexible |
| 15:33 | sdegutis | justin_smith: Thanx :) |
| 15:34 | sdegutis | After further consideration, I think requiring the user to memorize ordinal positions is probably not the best. |
| 15:34 | justin_smith | taking a map is nice for that |
| 15:36 | danielcompton | sdegutis: :or destructuring is quite nice if you want to allow default values from the user http://blog.jayfields.com/2010/07/clojure-destructuring.html |
| 15:36 | sdegutis | Thanks. |
| 15:36 | danielcompton | sdegutis: I mean allow the user to call the function without specifying default values |
| 15:38 | sdegutis | For some context, I'm writing an abhorrent and horrendous library that all Clojurians will unite to denounce and despite. |
| 15:38 | danielcompton | sdegutis: what's it do? |
| 15:38 | danielcompton | sdegutis: rewrite your code into scala? |
| 15:39 | sdegutis | It's a web framework. |
| 15:49 | sobel | library or framework? |
| 15:50 | FriedBob | A library for frameworks. |
| 15:51 | sdegutis | Framework. |
| 15:51 | sdegutis | /cc sobel |
| 15:53 | wink | clojure on curbs |
| 15:54 | sobel | heh |
| 15:55 | gfredericks | Clojure off a Cliff |
| 15:55 | sobel | my first (reflexive) interpretation of 'on rails' way back in the day was: like, up on blocks? |
| 15:55 | sobel | like that broken-down old camaro |
| 15:55 | sobel | Clojure in the Cloister |
| 15:55 | gfredericks | Clojure with a Claw |
| 15:57 | gfredericks | Clojure on a Clothesline |
| 15:57 | gfredericks | Clojure in the Clover |
| 15:58 | danielcompton | Clojure like Clockwork |
| 15:59 | amalloy | hah, on the topic of fixing bugs in open-source projects: "but you'd need to find someone to code it who cares as strongly as you do. 10 times out of 10 that is you and also like 1 time out of 1000 that is someone else" |
| 16:00 | wink | bullshit |
| 16:00 | brainproxy | Clojure Full Exposure |
| 16:00 | wink | with reasonably popular projects and maintainers that are open and active, those numbers are way off |
| 16:01 | dbasch | Clojure on Clouds |
| 16:02 | brainproxy | Programmers Inside Parentheses |
| 16:07 | danielcompton | I'm wanting to partition a byte array n ways, i.e. 0,3,6,9.. elements go into one byte array, 1,4,7,10th go into another and so on. What would be the most efficient way of doing this? It seems like amap is my best option here, but I'm not quite sure. Maybe an array of byte-arrays would be better? |
| 16:09 | danielcompton | I mean, making an array of byte arrays would be better than having several single arrays |
| 16:10 | justin_smith | danielcompton: is just passing the byte array and relevant indexes an option? because that will perform better |
| 16:10 | justin_smith | oh wait, never mind that |
| 16:10 | danielcompton | justin_smith: I guess so, I need to process each partition separately, there's no real reason to copy them out except my existing code works on contiguous arrays |
| 16:11 | pyr | amalloy: hi! around ? |
| 16:11 | justin_smith | danielcompton: I didn't quite register the interleaving at first |
| 16:11 | amalloy | pyr: sure, ¿que pasa? |
| 16:12 | pyr | amalloy: small worries with lein protobuf |
| 16:12 | mi6x3m | any way to print out 2 defns with pprint/write without calling it 2 times? |
| 16:12 | justin_smith | danielcompton: what about using areduce to partition? or writing a shuffle algorithm so that you get the mapping [0 3 6 9 .. 1 4 7 10 ...] |
| 16:13 | justin_smith | danielcompton: because the shuffle should be able to just work in a simple loop |
| 16:13 | amalloy | pyr: i don't think i ever did much with lein protobuf. i don't even have a single commit in it. i did do some work on clojure-protobuf, but the lein plugin isn't mine |
| 16:13 | pyr | amalloy: oh, nm then, sorry |
| 16:13 | danielcompton | justin_smith: I think this is what they call a teachable moment, I'll have a go at a few options and time which one comes out fastest |
| 16:13 | pyr | amalloy: i thought you handled both |
| 16:13 | amalloy | pyr: ninjudd and raynes did the plugin |
| 16:14 | justin_smith | danielcompton: I think the shuffle would be it - no allocation! |
| 16:14 | justin_smith | all other options require allocation |
| 16:14 | dbasch | &(group-by #(mod % 3) (range 20)) |
| 16:14 | lazybot | ⇒ {0 [0 3 6 9 12 15 18], 1 [1 4 7 10 13 16 19], 2 [2 5 8 11 14 17]} |
| 16:14 | danielcompton | justin_smith: can you explain the shuffle a bit further? |
| 16:14 | dbasch | danielcompton something along those lines? |
| 16:15 | dbasch | you’d need a map-indexed or something before, etc. |
| 16:15 | justin_smith | danielcompton: for any two orderings of the elements of an array, there is an algorithm that will rearrange the contents without needing more than a few state bindings and a container for two items being swapped |
| 16:16 | danielcompton | dbasch: and then in the array processing, just aget each element? |
| 16:16 | justin_smith | danielcompton: that may be more optimized than you need though (given the extra complexity of getting that algorithm right) |
| 16:17 | dbasch | danielcompton: yeah, for example |
| 16:17 | danielcompton | justin_smith: it's a pretty tight loop so it might be worth it |
| 16:17 | dbasch | or you could iterate over the array with a counter and populate the n outputs by mod |
| 16:19 | dbasch | that would be more time-efficient if you use arrays and preallocate them to the calculated size |
| 16:19 | dbasch | reordering in place is more space-efficient but probably slower |
| 16:19 | justin_smith | danielcompton: dbasch: you could likely use a single preallocated array, and fill it in the way dbasch describes |
| 16:20 | justin_smith | dbasch: good point, yeah |
| 16:20 | danielcompton | using an array of byte arrays would be quite elegant because I can just use mod and quot of the index to address the array |
| 16:20 | amalloy | danielcompton: if you're talking about a tight loop, allocating more byte arrays and copying stuff among them doesn't sound great |
| 16:23 | justin_smith | dbasch: I wonder, depending on the size, the extra CPU cycles of a shuffle in place may be cheaper than the cache pressure of using two arrays. I would expect a cyclical comparison where for certain sizes one approach is faster, and then past some barrier the other wins |
| 16:24 | dbasch | yes, it’s the kind of thing worth trying for fun (but probably doesn’t matter much if you’re doing this in clojure) |
| 16:24 | justin_smith | heh, fair enough, yeah |
| 16:26 | justin_smith | dbasch: I assume you've seen this https://gist.github.com/jboner/2841832 |
| 16:28 | dbasch | justin_smith: yeah, I think it was posted on HN at least once |
| 16:29 | justin_smith | I wonder if there is a version that also has like "integer add" and "floating point add" and "floating point multiply" |
| 16:30 | justin_smith | AHA http://norvig.com/21-days.html#answers the original source |
| 16:30 | dbasch | justin_smith: http://www.eecs.berkeley.edu/~rcs/research/interactive_latency.html |
| 16:30 | dbasch | with extrapolation until 2020 |
| 16:31 | danielcompton | I think this is my favourite, because it translates it into human understandable time scales https://twitter.com/rzezeski/status/398306728263315456 |
| 16:31 | dbasch | a google recruiter once asked me to put a subset of those in order over the phone |
| 16:32 | danielcompton | dbasch: and then reverse it |
| 16:32 | justin_smith | danielcompton: yeah, that one is nice |
| 16:32 | danielcompton | dbasch: what happens if we drill a hole through the centre of the earth, how does that change it? what if the speed of light was 10x faster? |
| 16:34 | dbasch | what if interviewers asked questions based on scientific evaluations of what works and what doesn’t? |
| 16:39 | dbasch | danielcompton: how would you build a computer that executes programs using nickels as 0s and dimes as 1s? |
| 16:39 | danielcompton | justin_smith: does your shuffle algorithm have a special name? Shuffle algorithm doesn't seem to be what I'm after |
| 16:39 | gfredericks | well interview questions are this self-referential thing |
| 16:40 | justin_smith | danielcompton: sorry, I forget proper nouns sometimes... |
| 16:40 | gfredericks | once you settle on something people try to specialize in it |
| 16:40 | dbasch | gfredericks: how would you improve this interview question? |
| 16:40 | gfredericks | I don't know anything about interviewing |
| 16:41 | gfredericks | it seems really hard |
| 16:41 | danielcompton | During his own Google interview, Jeff Dean was asked the implications if P=NP were true. He said, "P = 0 or N = 1." Then, before the interviewer had even finished laughing, Jeff examined Google’s public certificate and wrote the private key on the whiteboard |
| 16:41 | dbasch | answer: “I would improve that question by removing the self-reference and making it about something other than itself” |
| 16:41 | mi6x3m | when working with pprint (code-dispatch). is there a way to keep the namespace aliases? |
| 16:41 | mi6x3m | they get expanded to the full ns name |
| 16:42 | justin_smith | danielcompton: in-place deinterleave |
| 16:42 | justin_smith | danielcompton: basically a matric transform |
| 16:42 | justin_smith | *matrix |
| 16:43 | danielcompton | justin_smith: yeah I was thinking this sounds a bit like a matrix transform |
| 16:45 | justin_smith | danielcompton: synonym of deinterleave is deinterlace |
| 16:51 | sdegutis | "clomb" is a real word. |
| 16:52 | danielcompton | (inc justin_smith) (inc dbasch) |
| 16:52 | sdegutis | quick someone name a Clojure library "clojmb" |
| 16:52 | danielcompton | $karma amallaoy |
| 16:52 | lazybot | amallaoy has karma 0. |
| 16:52 | danielcompton | $karma amalloy |
| 16:52 | lazybot | amalloy has karma 196. |
| 16:52 | sdegutis | $karma sdegutis |
| 16:52 | lazybot | sdegutis has karma 6. |
| 16:52 | sdegutis | I'm 3% as helpful as amalloy. |
| 16:53 | edw | The Karma thing, that is a joke, right? |
| 16:54 | tbaldridge | edw: Karma is never a joke. Talk to your kids about Karma today. |
| 16:54 | amalloy | edw: it's an informal way of estimating how helpful someone is in here |
| 16:54 | tbaldridge | $karma tbaldridge |
| 16:54 | lazybot | tbaldridge has karma 12. |
| 16:54 | danielcompton | $karma richhickey |
| 16:54 | lazybot | richhickey has karma 0. |
| 16:54 | TimMc | amalloy: Or how many stupid jokes they make. |
| 16:54 | tbaldridge | yep, 'about right |
| 16:55 | amalloy | $karma rhickey |
| 16:55 | lazybot | rhickey has karma 9003. |
| 16:55 | amalloy | tbaldridge: |
| 16:55 | edw | amalloy: That's insane. Anyone ever noticed that karma made Hacker News insufferable, that it attracts and breeds a mentality? |
| 16:55 | TimMc | (inc edw_ |
| 16:55 | TimMc | (inc edw) |
| 16:55 | lazybot | ⇒ 2 |
| 16:55 | edw | Thanks, TimMc. |
| 16:55 | mi6x3m | technomancy: any idea how to supress clojure.core/ outputs in Fipp? |
| 16:55 | TimMc | technomancy: Spammer: kikati |
| 16:56 | edw | s/TmMc/TimMc/ |
| 16:56 | tbaldridge | mi6x3m: you might ask bbloom that |
| 16:56 | mi6x3m | bbloom: I ask you that |
| 16:56 | TimMc | edw: I don't know if I agree with you, it was just performance art. |
| 16:57 | mi6x3m | how can I disable clojure.core/ in symbol output? |
| 16:57 | TimMc | edw: It helps that lazybot has occasionally lost its karma database. |
| 16:57 | tbaldridge | edw: no, karma has nothing to do with anything on this irc. It's just a way of counting how many times someone has said +1 to someone |
| 16:57 | edw | TimMc: it's all fun and games until someone starts saying something in to inc their karma. |
| 16:58 | sdegutis | edw: Yep, it's a fact, HN is a dump |
| 16:58 | bbloom | mi6x3m: i'm not sure what you're asking |
| 16:58 | amalloy | TimMc: i remember something being lost once, but i don't think it was the whole thing |
| 16:58 | sdegutis | You know, our (inc foo) system is broken. |
| 16:58 | mi6x3m | bbloom: when I pprint with fipp symbols are prepended clojure.core |
| 16:59 | dbasch | this is a good blog post on karma, in fact the whole book is pretty good http://buildingreputation.com/writings/2010/02/on_karma.html |
| 16:59 | sdegutis | It doesn't take into account the fact that (inc ...) returns a value but *doesn't actually mutate anything*. |
| 16:59 | bbloom | mi6x3m: fipp does not do symbol resolution. it just prints what you give it. if it's printing qualified symbols, that's what you gave it |
| 16:59 | sdegutis | The new value is literally garbage collected immediately. |
| 16:59 | mi6x3m | bbloom: probably because of https://github.com/brandonbloom/fipp/blob/master/src/fipp/clojure.clj#L176 |
| 17:00 | bbloom | mi6x3m: nope, that's not resolving symbols that's matching against symbols |
| 17:00 | edw | sdegutis: My karma was abysmal on HN, so I spent a week making anodyne b.s. comments. Result: 500+ karma. |
| 17:00 | amalloy | sdegutis: incredibly, you are not the first person to say that |
| 17:00 | bbloom | mi6x3m: fipp's clojure printer does not do any analysis of environments |
| 17:00 | sdegutis | edw: I did the same and got about 1400 karma. |
| 17:00 | sdegutis | edw: It's a complete joke. |
| 17:00 | bbloom | mi6x3m: it's checking against some well known symbol names, both qualified and unqualified forms |
| 17:00 | sdegutis | amalloy: why is that incredible, sir/gentleman/scholar? |
| 17:00 | bbloom | mi6x3m: it's not adding qualifiers at all |
| 17:00 | mi6x3m | bbloom: *duh* it's my bad, I was using syntax quote instead of quote, sorry |
| 17:01 | mi6x3m | btw, fipp is really amazingly fast |
| 17:01 | amalloy | it's not. also, please stop saying sir/gentleman/scholar at me |
| 17:01 | sdegutis | If anything it should be (inc #'sdegutis), assuming we redefined inc to have side-effects and to mutate a var. |
| 17:01 | edw | sdegutis: I have StackCareers recruiters call me once in a while and I try to explain how I would prefer to use their list of highly-ranked of people as a recruiting blacklist. |
| 17:01 | bbloom | mi6x3m: and achieves that speed while being functionally pure! w00t algorithms & data structures |
| 17:01 | sdegutis | Or we could just do (alter sdegutis inc) |
| 17:01 | sdegutis | And assume that we're each refs. |
| 17:02 | sdegutis | edw: ouch |
| 17:02 | sdegutis | edw: but yeah HN is a terrible place |
| 17:02 | amalloy | edw: i can't help but feel that, if your goal is to make sure #clojure stays a welcoming and helpful community, you would make better progress saying welcoming and helpful things than by complaining about other online communities |
| 17:02 | sdegutis | Also "cloture" is a real word and it derives directly from the word "closure". |
| 17:03 | sdegutis | So someone should get on making a lib called Cloture. |
| 17:03 | mi6x3m | bbloom: absolutely :) I am very happy with the speed |
| 17:03 | mi6x3m | pprint was really giving me a headache |
| 17:03 | sdegutis | edw: ignore amalloy he's just always overly strict about staying on topic |
| 17:03 | amalloy | you can't ignore me! i have 196 karma! i reign supreme! |
| 17:03 | sdegutis | edw: that said he's usually pretty helpful too, so take it for what grains of salt it's worth |
| 17:04 | sdegutis | or something |
| 17:04 | sdegutis | (inc amalloy) |
| 17:04 | lazybot | ⇒ 197 |
| 17:04 | edw | amalloy: There are many ways to make a place better. |
| 17:04 | sdegutis | amalloy: i gave you that one just to prove that $karma is a scam thus invalidating all the other 196 |
| 17:04 | amalloy | *chuckle* |
| 17:04 | sdegutis | amalloy: the reasoning is, if one is proven illegit, none can be trusted |
| 17:04 | edw | (dec edw) |
| 17:04 | lazybot | You can't adjust your own karma. |
| 17:05 | edw | Damn. |
| 17:05 | {blake} | The system works. |
| 17:05 | bbloom | mi6x3m: i'm glad it's working for you! |
| 17:05 | amalloy | {blake}: the karma system? i don't think it's really relevant; people would continue to be helpful without it |
| 17:06 | mi6x3m | bbloom: yeah, I am generating small leiningen projects dynamically from some GUI examples. I'll show you soon |
| 17:06 | sdegutis | oh! |
| 17:06 | sdegutis | I forgot all about this! |
| 17:06 | sdegutis | I came up with a riddle! Who wants to hear it? |
| 17:06 | edw | I think IRC worked before karma. |
| 17:06 | edw | I mean, there's was this non-gamified thing called karma. |
| 17:06 | mi6x3m | bbloom: I would appreciate perhaps if, when printing maps, key and value are on the same line |
| 17:06 | {blake} | amalloy: I was channeling Homer Simpson. I thought it was funny edw was thwarted in his attempt to dec himself. |
| 17:06 | amalloy | ah |
| 17:07 | dbasch | amalloy conveniently omits the rich hickey cardboard cutout rewards |
| 17:07 | danneu | or the rich hickey wig |
| 17:07 | sdegutis | What did the inquisitive alphabet declare aloud after inspecting the ambiguous insect? |
| 17:07 | edw | I'm holding out for food pellets. Will be polite for food. |
| 17:07 | sdegutis | Nobody can guess it. Nobody. |
| 17:08 | sdegutis | It's too good of a riddle! |
| 17:08 | bbloom | mi6x3m: as far as i know, they should be |
| 17:08 | sdegutis | Or maybe it's a joke. I don't know the difference. |
| 17:08 | {blake} | sdegutis: Because seven eight nine? |
| 17:08 | sdegutis | close |
| 17:09 | mi6x3m | bbloom: wait let me show you |
| 17:09 | dbasch | a may bee |
| 17:10 | wink | I find these really hard as a non-native speaker |
| 17:10 | sdegutis | dbasch: what? |
| 17:10 | wink | not necessarily get them, but come to think of them in the first place. |
| 17:11 | amalloy | wink: such riddles are not really made to be guessable. you're supposed to say "jeez i give up, what is it", and then the riddle presenter smugly tells you it was obvious |
| 17:11 | dbasch | sdegutis: a may bee is an ambiguous insect |
| 17:11 | sdegutis | dbasch: Ah clever. Nope. |
| 17:11 | wink | amalloy: I know, but sometimes you can guess them, if you're into puns. |
| 17:11 | sdegutis | amalloy: Well it's half riddle, half joke. |
| 17:11 | dbasch | a jiddle |
| 17:11 | sdegutis | wink: Yeah we tell some pretty punny riddles around our house. |
| 17:12 | amalloy | sdegutis: I C U R A B? those are letters that sound like words |
| 17:12 | sdegutis | O, I C.. U R A B! |
| 17:12 | sdegutis | Yep :) You win! |
| 17:12 | wink | oh my |
| 17:12 | dbasch | OU812 |
| 17:12 | sdegutis | (inc amalloy) |
| 17:12 | lazybot | ⇒ 198 |
| 17:13 | wink | but reminds me of this : |
| 17:13 | {blake} | At 200, amalloy turns into a being of pure functionality. |
| 17:13 | wink | [18:18:36] (Ose) Æ e i a æ å |
| 17:13 | wink | [18:19:11] (Ose) ^is a correctly pronounced sentence in a certain norwegian dialect |
| 17:13 | sdegutis | That's probably the only good one I ever came up with. I have another one that involves a shaggy dog riding a car, and the answer is "car-pet", but it's meh. |
| 17:13 | metellus | obviously you'd tell that one as a feghoot |
| 17:14 | metellus | the more tortured the setup for the pun, the better |
| 17:14 | amalloy | as a what now? |
| 17:14 | sdegutis | My son read one in a book: What's brown and sticky? |
| 17:14 | sdegutis | amalloy: my thoughts precisely |
| 17:14 | metellus | amalloy: http://en.wikipedia.org/wiki/Feghoot specific type of shaggy dog story |
| 17:14 | dbasch | sdegutis: a stick |
| 17:14 | sdegutis | (inc dbasch) |
| 17:14 | lazybot | ⇒ 18 |
| 17:14 | TimMc | amalloy: FEGHOOT |
| 17:14 | amalloy | dbasch: also acceptable: a stick insect |
| 17:15 | sdegutis | I think he got that from a book of riddles. |
| 17:15 | dbasch | I feel so helpful |
| 17:15 | FriedBob | A TCP packet walks into a bar and says to the baretender, "I'd like a beer." The bartender says, "You'd like a beer?". The TCP Packet says "Yes, I'd like a beer." Then the bartender gives him a beer. |
| 17:15 | sdegutis | LOL |
| 17:15 | sdegutis | (inc FriedBob) |
| 17:15 | lazybot | ⇒ 1 |
| 17:15 | sdegutis | But that's not so much a riddle, as just a joke. |
| 17:15 | FriedBob | True. |
| 17:15 | sdegutis | Still good tho. |
| 17:15 | wink | A horse comes into a bar. The bartender asks: Hey, why such a long face? |
| 17:15 | dbasch | that’s like the UDP joke I just told |
| 17:15 | amalloy | dbasch: i didn't get it |
| 17:15 | sdegutis | (inc wink) |
| 17:15 | lazybot | ⇒ 2 |
| 17:16 | sdegutis | Oh my, it rhymes! |
| 17:16 | dbasch | only amalloy got it |
| 17:16 | FriedBob | Two men walk into a bar. The third one ducked. |
| 17:16 | sdegutis | dbasch: HA! |
| 17:17 | sdegutis | (inc dbasch) |
| 17:17 | lazybot | ⇒ 19 |
| 17:17 | wink | FriedBob: took me a few seconds. :) |
| 17:17 | amalloy | dbasch: by the way, when someone tells you a horrible TCP joke, here is a response i have formulated. you stare at them for a while, and then announce "ACK 0" |
| 17:17 | FriedBob | wink: That's pretty much my favorite bar joke. |
| 17:17 | danneu | An IPv6 packet walks into a bar. Nobody talks to him |
| 17:17 | sdegutis | (inc danneu) |
| 17:17 | lazybot | ⇒ 2 |
| 17:17 | sdegutis | Hilarious! |
| 17:18 | sdegutis | Okay but these aren't riddles. |
| 17:18 | amalloy | sdegutis: another point in their favor |
| 17:18 | sdegutis | (dec amalloy) |
| 17:18 | lazybot | ⇒ 197 |
| 17:18 | clojurebot | Huh? |
| 17:18 | sdegutis | !! Did clojurebot just become sentient!? |
| 17:18 | sdegutis | Is it finally happening?? |
| 17:18 | lazybot | sdegutis: Definitely not. |
| 17:19 | danielcompton | karma |is| welcome to #clojure, where everything's made up and the karma doesn't matter |
| 17:19 | danielcompton | ,karma |is| welcome to #clojure, where everything's made up and the karma doesn't matter |
| 17:19 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: karma in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 17:19 | sdegutis | ~karma |
| 17:19 | clojurebot | karma is just another source of imaginary internet points |
| 17:19 | sdegutis | Sounds like technomancy wrote that one. |
| 17:19 | wink | karma, oooooh. didn't mean to make you cry. |
| 17:20 | mi6x3m | bbloom: try this http://pastebin.com/gmLX4Br3 |
| 17:20 | mi6x3m | the map keys/values are on separate lines here |
| 17:21 | FriedBob | Is 3 fingers of scotch to ~50 lines of code a reasonable ratio for a noob? |
| 17:22 | dbasch | FriedBob: depends on the scotch |
| 17:22 | wink | FriedBob: well the 2nd 50 lines will surely be different |
| 17:22 | FriedBob | 12 year old MacCallan |
| 17:23 | dbasch | FriedBob: Macallan 12 goes well with perl perhaps |
| 17:23 | FriedBob | wink: That was total comsumption and output |
| 17:23 | FriedBob | dbasch: It was hat or 120 proof moonshine |
| 17:23 | justin_smith | FriedBob: reminds me of a joke. 26 mathematicians go to a bar. The first one orders half a drink. The second one orders 1/4 of a drink. The third one order 1/8 of a drink. Fed up, the bartender declares "come on guys, you should know your limits" and pours a beer. |
| 17:24 | FriedBob | I like that. |
| 17:25 | amalloy | justin_smith: the number 26 there makes the joke really weird |
| 17:25 | justin_smith | amalloy: yeah, should have said "x mathematicians" |
| 17:25 | amalloy | you kinda have to make it infinite, or one guy who wanst a half a drink, then a quarter, then an eighth... |
| 17:26 | edw | A lazy infinite sequence of mathematicians... |
| 17:26 | wink | justin_smith: there's a better version: "an infinite number of mathematicians walk into a bar. first one says: 1 shot, second one says: 1/2 a shot, etc. the bartender pours 2 shots and says: you're all idiots" |
| 17:26 | sdegutis | rsi pinky emacs |
| 17:26 | justin_smith | amalloy: 2^(1/26) is smaller than the reliable epsilon of bartender pour |
| 17:27 | justin_smith | wink: but that doesn't get to the "limit" pun |
| 17:27 | mi6x3m | bbloom: could you reproduce it? |
| 17:27 | FriedBob | QA Engineer walks into a bar. Orders a beer. Orders 0 beers. Orders 999999999 beers. Orders a lizard. Orders -1 beers. Orders a sfdeljknesv. |
| 17:27 | wink | justin_smith: yeah well, different punchline, but I like it better :) |
| 17:27 | sdegutis | FriedBob: LLOL |
| 17:27 | sdegutis | (inc FriedBob) |
| 17:27 | lazybot | ⇒ 2 |
| 17:28 | amalloy | hah, that's the first new one i've heard today |
| 17:28 | edw | Yeah this karma thing is a brilliant idea. |
| 17:28 | justin_smith | amalloy: it was going around on twitter not long ago |
| 17:28 | sdegutis | (dec edw) |
| 17:28 | lazybot | ⇒ 1 |
| 17:28 | edw | sdegutis: Thank you. |
| 17:28 | sdegutis | edw: you were being sarcastic right? |
| 17:28 | edw | Yes. |
| 17:28 | edw | Wait, to which? |
| 17:28 | amalloy | justin_smith: not exciting enough to make me want back on twitter |
| 17:28 | FriedBob | Twitter is where I got it from. https://twitter.com/sempf/status/514473420277694465 |
| 17:29 | sdegutis | edw: s/brilliant/ |
| 17:29 | TimMc | FriedBob: "Orders ८० beers..." |
| 17:29 | edw | Saracatic with the "good idea," genuine with the thanks. |
| 17:29 | kenrestivo | in schema is there a way to have an or? i.e. {:foo (or s/Keyword [s/Str])} ? |
| 17:29 | justin_smith | kenrestivo: my intuition would be to try {:foo #{s/Keyword s/Str}} |
| 17:30 | sdegutis | edw: +1 |
| 17:30 | edw | sdegutis: More like it. Ephemeral. |
| 17:30 | kenrestivo | oh cool, a set. nice. |
| 17:30 | sdegutis | brb modifying the mac os x registry |
| 17:30 | justin_smith | kenrestivo: modulo my leaving out [] of course |
| 17:30 | sdegutis | edw: what? no i was just trying to say +1 |
| 17:30 | edw | Right. |
| 17:30 | noonian | i think theres an s/either in schema |
| 17:30 | TimMc | &(.getPort (java.net.URL. "http://www.example.com:८५/")) |
| 17:30 | lazybot | ⇒ 85 |
| 17:30 | TimMc | &(.getPort (java.net.URL. "http://www.example.com:८५/")) |
| 17:30 | lazybot | ⇒ 85 |
| 17:31 | TimMc | err... ah |
| 17:31 | TimMc | ,(.getPort (java.net.URL. "http://www.example.com:८५/")) |
| 17:31 | clojurebot | #<MalformedURLException java.net.MalformedURLException: denied> |
| 17:31 | hellofunk | why do i need to run (clojure.core/refer 'clojure.core) for some clojure.core functions to be referred (like "refer" itself) while others also in clojure.core are already referred into a new namespace |
| 17:31 | justin_smith | TimMc: wert |
| 17:31 | edw | sdegutis: Just sayin' I prefer the genuine but not instrumentally useful over the calculated. |
| 17:31 | kenrestivo | aha, yes, it's s/Either. i was searching for or... obviously not an easy grep to S/N |
| 17:31 | noonian | kenrestivo: yeah, theres an either fn in schema that takes n schemas |
| 17:31 | sdegutis | inc edw |
| 17:31 | TimMc | justin_smith: Because why not specify ports in Devanagari numerals? |
| 17:32 | justin_smith | why not indeed |
| 17:32 | TimMc | ...thought the original Java developers |
| 17:32 | noonian | Either is the record, the fn to use is either |
| 17:33 | dbasch | btw, nobody should use ever use java.net.URL unless they have a good reason for it (and I’d like to hear it) |
| 17:33 | wink | hm, wasn't there some stuff that needs it? |
| 17:33 | wink | too lazy to grep my 10 years of java code now... |
| 17:33 | tbaldrid_ | dbasch: what would you suggest instead? |
| 17:34 | dbasch | tbaldrid_: URI |
| 17:34 | tbaldrid_ | ah yeah, okay |
| 17:34 | wink | cos that is a pretty broad statement :P |
| 17:34 | tbaldrid_ | I'd agree with that |
| 17:34 | sdegutis | NSURL improved on that |
| 17:34 | justin_smith | wink: comparisons on URL do dns lookup |
| 17:34 | sdegutis | except in naming. |
| 17:35 | wink | justin_smith: maybe I am mixing them up. |
| 17:35 | TimMc | ,(.getHost (java.net.URI. "http://localhost:८४४३")) |
| 17:35 | clojurebot | nil |
| 17:35 | TimMc | ,(.getAuthority (java.net.URI. "http://localhost:८४४३")) |
| 17:35 | clojurebot | "localhost:८४४३" |
| 17:35 | wink | maybe it was something with file:// and jars? |
| 17:36 | TimMc | I'm not clear on whether URI behaves ideally in that situation either. |
| 17:36 | wink | this must be years aho, my memory fails me |
| 17:36 | justin_smith | &(= (java.net.URI. "http://www.example.com") (java.net.URI. "http://www.example.org")) |
| 17:36 | lazybot | ⇒ false |
| 17:37 | justin_smith | &(= (java.net.URL. "http://www.example.com") (java.net.URL. "http://www.example.org")) |
| 17:37 | lazybot | ⇒ false |
| 17:37 | justin_smith | er... (true locally..) |
| 17:37 | sdegutis | Oh! |
| 17:38 | wink | oops |
| 17:38 | sdegutis | I can just do (-> f meta :arglists first) to get the list of vars it takes as symbols! |
| 17:38 | wink | I did use it |
| 17:38 | wink | (:import (java.net URL URLConnection HttpURLConnection UnknownHostException) |
| 17:38 | amalloy | hellofunk: because if *nothing* is referred in a brand-new namespace, you won't be able to get your repl out of it, or refer anything else |
| 17:38 | sdegutis | Then I can use select-keys to map them to the actual args I should pass! |
| 17:38 | octane-- | justin_smith: .com / .org intended? |
| 17:39 | hellofunk | amalloy so only some parts of clojure.core are referred automatically, but not all in that namespace? |
| 17:39 | justin_smith | octane--: yeah, that is the point - it resolves, and sees they are the same host |
| 17:39 | sdegutis | Thus given (fn [foo bar] ...) you can call it with {:foo 1, :bar 2} and it'll just work! |
| 17:39 | TimMc | justin_smith: lazybot forbids network lookups, I think |
| 17:39 | justin_smith | octane--: which is why (when you have net access) it returns true |
| 17:39 | justin_smith | TimMc: right, as it should :) |
| 17:39 | amalloy | hellofunk: right, a very small number of things are usable if you just write (in-ns 'some.new.ns) |
| 17:39 | octane-- | justin_smith: ah, right. |
| 17:39 | octane-- | carry on :) |
| 17:39 | amalloy | in-ns, probably require, i dunno |
| 17:39 | sdegutis | What is this weavejester/canon? |
| 17:40 | wink | dbasch: I think my reason for https://github.com/winks/battlenet/blob/master/src/battlenet/network.clj#L8-L18 was: It reads from there and afaik there is no "java.net.httpuriconnection" |
| 17:40 | justin_smith | amalloy: you can still use fully qualified names |
| 17:40 | wink | dbasch: but I'd love to hear why it's bad there and how to improve :) |
| 17:40 | justin_smith | amalloy: https://www.refheap.com/93657 |
| 17:41 | dbasch | wink: why do you use 0 and 1 for return values? |
| 17:42 | wink | dbasch: come to think of it, probably because it was my first clojure project ever? :) |
| 17:42 | wink | 1 is truthy enough! |
| 17:42 | hellofunk | amalloy if i have added a dependency for core.log in project.clj then opened a lein repl on that, shouldn't I be able to refer or use 'clojure.core.logic at that point with no problems? |
| 17:42 | amalloy | it's a C library, just made to look like clojure via clever cpp macros |
| 17:42 | dbasch | wink: you don’t need an if there |
| 17:44 | justin_smith | dbasch: what if you connected, but it returned with a 500? |
| 17:44 | {blake} | wink: 0 is truthy, too, tho'. |
| 17:44 | justin_smith | ,(if 0 :yes :no) |
| 17:44 | clojurebot | :yes |
| 17:45 | dbasch | justin_smith: I mean, that statement is the same as (= 200 …) |
| 17:45 | kai3x5 | did anyone here learn clojure as a first language ? |
| 17:45 | justin_smith | dbasch: if 0 were false it would be |
| 17:45 | dbasch | justin_smith: that’s my point, he didn’t need to make it 0 or 1 |
| 17:45 | wink | dbasch: {blake}: I do check (= 1 in the test |
| 17:45 | wink | but please ignore my 2y old bad code. |
| 17:45 | dbasch | especially because the test checks 1 only |
| 17:46 | wink | and focus on HTTPURLConnection :) |
| 17:46 | justin_smith | dbasch: ahh, I misunderstood you |
| 17:46 | dmitrygusev | wink: btw, you have two same (defn read-remote-perks methods declared there |
| 17:47 | wink | dmitrygusev: hehe thanks. |
| 17:48 | hellofunk | amalloy ah nevermind -- sometimes a repl restart seems necessary to get dependencies working on a new project (even if the repl was started after those dependencies were listed and saved in project.clj) |
| 17:48 | amalloy | hellofunk: not sometimes, always |
| 17:48 | technomancy | no, if the repl was started after they were added to project.clj you don't have to restart |
| 17:49 | technomancy | modulo AOT/defrecord nonsense |
| 17:49 | hellofunk | amalloy - no i mean, you list some dependencies in a new project's project.clj file, *then* you start cider, and sometimes those dependencies are still not working. |
| 17:49 | sdegutis | What's an amazing way to get [1 2] given {:a 1, :b 2} and [:a :b] ? |
| 17:49 | amalloy | oh, i see, i misread |
| 17:49 | amalloy | sdegutis: map |
| 17:49 | amalloy | ,(map {:a 1 :b 2} [:a :b]) |
| 17:49 | clojurebot | (1 2) |
| 17:49 | justin_smith | ,((juxt :a :b) {:a 0 :b 1}) |
| 17:49 | clojurebot | [0 1] |
| 17:50 | sdegutis | Oh! |
| 17:50 | sdegutis | amalloy: I have to consider how/why this even works. |
| 17:50 | justin_smith | ,((apply juxt [:a :b]) {:a 0 :b 1}) ; if it has to be a vector |
| 17:50 | clojurebot | [0 1] |
| 17:50 | technomancy | hellofunk: I've never seen that happen; please open a bug report if you can confirm it |
| 17:50 | justin_smith | sdegutis: but if it has to be a vector, map is actually better |
| 17:51 | sdegutis | amalloy: Ah, clever, you're using the hash-map as a function on each key! |
| 17:51 | sdegutis | That's... clever. |
| 17:51 | amalloy_ | well, it's hardly an original invention of mine |
| 17:52 | TimMc | technomancy: Thanks. |
| 17:53 | justin_smith | &(let [a [1 2 1 2 3] b [4 3 4 2 4 1 0]] [(map a b) (map b a)]) |
| 17:53 | lazybot | ⇒ [(3 2 3 1 3 2 1) (3 4 3 4 2)] |
| 17:53 | sdegutis | https://gist.github.com/sdegutis/b376cf100e337941d826 |
| 17:53 | sdegutis | Go ahead, swap testfn's params... I are you. |
| 17:53 | sdegutis | *dare |
| 17:54 | sdegutis | It's hideously unforgiving to typos though. |
| 17:54 | sdegutis | And it only allows one arity, although in this use-case that's fine. |
| 17:55 | justin_smith | sdegutis: that is certainly clever |
| 17:55 | sdegutis | justin_smith: Oh right, now that I think about it, this could be a solution to the question I was asking earlier! |
| 17:56 | justin_smith | sdegutis: for extra credit, you could search for the arglist with matching arg count |
| 17:56 | sdegutis | I'm very sleepy, sorry, it's easy to completely forget all context. |
| 17:56 | sdegutis | justin_smith: Ahh, clever! |
| 17:56 | hellofunk | sdegutis check out 4clojure.com if you want to learn lots of other "clever" tricks (which you also have amalloy to thank for that site) |
| 17:56 | dbasch | wink: btw, you check if a url is readable by reading it? :) |
| 17:57 | sdegutis | hellofunk: thx |
| 17:57 | sdegutis | hellofunk: that site sounds familiar, I wonder... |
| 17:57 | wink | dbasch: well the comment is useless, I agree |
| 17:59 | wink | naming is off, but to be fair, together with read-url it still makes sense |
| 17:59 | wink | haven't run or even touched the code for 2 years it seems. |
| 18:01 | sdegutis | So I looked up "rapid" in the thesaurus in hopes of coming up with a name for my web framework (which encourages rapid development) and one synonym is "pretty damn quick" |
| 18:01 | justin_smith | wink: welcome to #clojure, where you *will* get your incomplete, short attention span code review, whether you like it or not |
| 18:01 | sdegutis | It rolls off the tongue, but I can't think of where to put a "j" in it to make it into a library name. |
| 18:01 | justin_smith | sdegutis: pdq |
| 18:01 | sdegutis | justin_smith: pdjq |
| 18:01 | wink | justin_smith: I wouldn't mind if my quesion would've been answered ;) |
| 18:01 | sdegutis | too hard to type |
| 18:02 | {blake} | sdegutis: jdq - just damn quick |
| 18:02 | sdegutis | cljdq |
| 18:02 | technomancy | pdq4j |
| 18:02 | dbasch | wink: in that particular case there’s nothing wrong with using a url, although you don’t need that function really |
| 18:03 | sdegutis | technomancy: nooooooooooooooo.com |
| 18:04 | dbasch | forjay4j |
| 18:06 | sdegutis | (inc dbasch) |
| 18:06 | lazybot | ⇒ 20 |
| 18:08 | sdegutis | web-frajmework ? |
| 18:09 | sdegutis | am i doing this rite |
| 18:09 | justin_smith | the-endless-font-of-enterprise-ready-webapps |
| 18:13 | noonian | is the no button supposed to do anything? |
| 18:13 | sdegutis | https://github.com/sdegutis/clover |
| 18:13 | sdegutis | noonian: turn your volume up a little |
| 18:14 | noonian | sdegutis: ah, thanks |
| 18:18 | tpope | so I am seeing vast differences in memory usage between os x and linux and wondering what the hell to do about that |
| 18:18 | tpope | like even a bare, projectless lein repl is taking 100mb on os x and 400mb+ on linux |
| 18:18 | danielcompton | tpope: same JVM? |
| 18:19 | justin_smith | tpope: what are you using to show mem usage? some linux tools are not fully accurate to what you would expect |
| 18:19 | noonian | tpope: yeah, are you using openjdk on linux and oracle on macos? |
| 18:19 | technomancy | 64-bit vs 32-bit could do it too |
| 18:20 | technomancy | 32-bit defaults to a really low Xmx |
| 18:20 | tpope | RES from top |
| 18:20 | technomancy | yeah also http://www.linuxatemyram.com/ |
| 18:20 | tpope | technomancy: I started down this path when my newly deployed app maxed out a heroku dyno. then maxed out a 2x dyno |
| 18:21 | technomancy | tpope: did you have an -Xmx value? |
| 18:21 | tpope | it's openjdk indeed |
| 18:21 | tpope | technomancy: no, should I? |
| 18:21 | technomancy | tpope: you should get it out of the box, but if you change your procfile you could lose it |
| 18:22 | tpope | no procfile currently |
| 18:22 | technomancy | hm; then it should get it from $JVM_OPTS |
| 18:22 | technomancy | is that set? |
| 18:22 | tpope | technomancy: yeah -Xmx400m -Dfile.encoding=UTF-8 |
| 18:23 | technomancy | tpope: does heroku ps show that config value being referenced? |
| 18:24 | tpope | technomancy: no |
| 18:25 | tpope | === web (2X): `lein with-profile production trampoline run` web.1: up 2014/11/19 15:30:58 (~ 2h ago) |
| 18:25 | technomancy | oh, lein should pick it up though |
| 18:25 | tpope | yeah I would assume |
| 18:25 | technomancy | can you log out your max memory on boot? |
| 18:26 | tpope | how do get that information |
| 18:29 | tpope | fwiw that JVM_OPTS shows up in heroku run bash but it's not in my config proper |
| 18:31 | sdegutis | This is part of my idea: https://github.com/sdegutis/clover |
| 18:34 | tpope | (.maxMemory (Runtime/getRuntime)) seems to do the trick. I'll deploy and check |
| 18:37 | sdegutis | justin_smith: this is the monstrosity you unwittingly helped me to begin building |
| 18:40 | wink | ok, code review comments applied. thanks all :P |
| 18:41 | TEttinger | sdegutis, nice, Copyright © 2014 FIXME |
| 18:41 | sdegutis | :) |
| 18:41 | wink | TEttinger: copyright of champions |
| 18:41 | sdegutis | TEttinger: afaik only slip up :D |
| 18:43 | tpope | technomancy: 401997824, which seems right? |
| 18:43 | sdegutis | TEttinger: Fixed. |
| 18:43 | technomancy | tpope: yeah. that only affects the heap though. |
| 18:44 | technomancy | you can still have memory consumed by buffers and native code |
| 18:44 | wink | it's "abusing #clojure for it's native speakers' density" time again - do you always say "to give a talk/lecture" in English? "hold a talk/lecture" sounds wrong, but Google has a lot of hits |
| 18:44 | dbasch | if I start a company called FIXME I can claim ownership of most Clojure projects from now on |
| 18:44 | technomancy | https://devcenter.heroku.com/articles/java-memory-issues |
| 18:45 | wink | dbasch: I'm not sure even American copyright law works that way :P |
| 18:45 | nullptr | dbasch: i'm from TODO Inc, your takedown notice is in the mail! |
| 18:45 | dbasch | nullptr: sorry, XXX TODO called first |
| 18:45 | nullptr | bah, foiled again |
| 18:46 | wink | my publicly traded company "DOMAIN INC" will sue you. |
| 18:46 | tpope | technomancy: ehhhh that's a lot of buffers and native code |
| 18:47 | sdegutis | wink: I say give |
| 18:47 | sdegutis | So, anyone want to offer feedbacks on my web framework idea? |
| 18:48 | sdegutis | Oh nice, ##:404 is legit. |
| 18:48 | justin_smith | wink: "give a talk" is more common, but "hold a talk" is valid, and is for when you are referring to the ones hosting, not the speaker being hosted |
| 18:48 | sdegutis | ,:404 |
| 18:48 | clojurebot | :404 |
| 18:48 | wink | justin_smith: sdegutis: thanks |
| 18:49 | sdegutis | ,(= :404 (keyword "404")) |
| 18:49 | clojurebot | true |
| 18:49 | justin_smith | ,(= :404 (keyword 404)) |
| 18:49 | clojurebot | false |
| 18:50 | wink | (= :404 (keyword "404")) |
| 18:50 | wink | RuntimeException EOF while reading |
| 18:50 | wink | I should go to bed I think. |
| 18:50 | justin_smith | wink: smartquotes? |
| 18:50 | wink | lein repl. |
| 18:50 | noonian | ,(= :404 (keyword "404")) |
| 18:50 | clojurebot | true |
| 18:51 | wink | (= (keyword "404") :404) |
| 18:51 | wink | true |
| 18:51 | wink | ok, THAT Is weird now :) |
| 18:52 | amalloy_ | a keyword whose contituent characters are all numbers is rarely a great thing to have |
| 18:53 | justin_smith | amalloy: but it means you don't have to use "get", which is of course worth it |
| 18:54 | wink | ,(keyword ",") |
| 18:54 | clojurebot | :, |
| 18:54 | wink | you think? |
| 18:54 | justin_smith | wink: ##(keyword "In the course of human events...") |
| 18:54 | lazybot | ⇒ :In the course of human events... |
| 18:54 | sdegutis | I wrote down some goals: https://github.com/sdegutis/clover#goals |
| 18:55 | wink | justin_smith: yeah, reminds me of http://search.cpan.org/dist/Lingua-Shakespeare/lib/Lingua/Shakespeare.pod |
| 18:55 | wink | anyway, gnight |
| 18:55 | justin_smith | nigth |
| 18:58 | {blake} | Input validation on web forms. I'm using Bootstrap, so it looks like I'm going to have to shoehorn some stuff into JQuery's $(document).ready(). Advice? Should I just shove it in there with Hiccup? |
| 19:14 | sdegutis | Noted. |
| 19:14 | sdegutis | Thanks for the feedback. |
| 19:24 | technomancy | conj attendees: your mission is to beat rubyconf https://twitter.com/rubyconf/status/535219643431268352 |
| 19:25 | godd2 | Maybe that's just how much they made and they didn't notice cause they thought the garbage would just collect the excess |
| 19:27 | justin_smith | technomancy: if I ran the brainfuck twitter, I would just do a s/coffe/glue and post the same tweet |
| 19:27 | justin_smith | *coffee |
| 19:28 | justin_smith | well, maybe s/drank/huffed, but I would leave the "and tea" |
| 19:29 | godd2 | huffing tea doesn't sound like a good idea |
| 19:29 | justin_smith | not at all, no |
| 19:29 | justin_smith | huffing * dousn't sound like a good idea |
| 19:37 | TimMc | justin_smith: swearjureconf |
| 19:37 | TimMc | 4 buckets of lead paint chips consumed |
| 19:38 | godd2 | goto conf wins best name though. the propoganda is right in the name! |
| 19:38 | justin_smith | (inc TimMc) |
| 19:38 | lazybot | ⇒ 83 |
| 19:44 | TEttinger | godd2: a conference on spaghetti code? count me in |
| 19:45 | justin_smith | I wonder if anyone has ever prepared "refactored spaghetti" |
| 19:45 | TEttinger | Lua 5.2 and LuaJIT added goto and labels to the language features so that they make more valid compiler/translator targets, which is relevant because luajit performs so well |
| 19:45 | justin_smith | it would be spaghetti, but you straighten each noodle into a line, in parallel, before serving |
| 19:46 | TEttinger | justin_smith, I am sure an avant garde restaurant has tried it |
| 19:46 | justin_smith | TEttinger: if java had proper goto, we would have tail recursion, and maybe even first class continuations too |
| 19:46 | TEttinger | java does have labels |
| 19:46 | TEttinger | but that's for named break |
| 19:47 | justin_smith | TEttinger: and the bytecode has goto, but it is only allowed method scope |
| 19:47 | Bronsa | I didn't know about named breaks |
| 19:48 | Bronsa | TIL |
| 19:49 | TimMc | Where would you like to break to today? |
| 19:51 | TEttinger | http://stackoverflow.com/a/886979 |
| 19:51 | TEttinger | I'm not even sure what the right name for this is |
| 19:51 | TEttinger | labeled break? |
| 19:53 | bja_ | random project for a rainy day: lisp that outputs java source compiling everything to labeled while/breaks |
| 19:55 | TEttinger | bja_: all in one method, keep in mind the method length limit |
| 19:56 | bja_ | tbh, didn't know that java had a method length limit |
| 19:56 | TEttinger | I've hit it with auto-generated stuff before, at least the statement length limit |
| 19:56 | bja_ | 64k |
| 19:56 | bja_ | hmm |
| 19:57 | bja_ | hmm, SO suggests that the JIT won't touch methods over 8k in side |
| 19:57 | TEttinger | this is too large https://dl.dropboxusercontent.com/u/11914692/weapons-map-too-large.clj |
| 19:58 | TEttinger | that tries to get loaded as one statement by clojure, I think, since it's all one literal |
| 19:59 | bja_ | meh, 64k code should be enough for anyone! |
| 19:59 | bja_ | (at least anyone writing toy preprocessors) |
| 20:05 | bja_ | hmm, I guess the bug for the 64k method size limit isn't available anymore? http://bugs.sun.com/view_bug.do?bug_id=4262078 |
| 20:21 | sdegutis | Okay I've commented some of my hypothetical API: https://github.com/sdegutis/clover |
| 20:35 | TimMc | bja_: A victim of the oraclopalypse, perhaps. |
| 20:36 | TimMc | the sound of a thousand thousand links breaking |
| 20:41 | wsmoak | bja_: here, the wayback machine has it http://web.archive.org/web/20110817141114/http://bugs.sun.com/view_bug.do?bug_id=4262078 |
| 20:42 | TimMc | It's gone now; a search for the sample phrase "generating scientific code, not JSPs" turns up nothing. |
| 20:42 | TimMc | Sometimes Oracle is such an unprofessional outfit. |
| 20:45 | akkad | is openjdk not advised over the Oracle jre? |
| 20:46 | sdegutis | What's a good license to make a new open source Clojure library? |
| 20:47 | TimMc | akkad: I think it's basically the same thing as of 7. |
| 20:48 | TimMc | sdegutis: EPL, same as Clojure. |
| 20:48 | TimMc | sdegutis: Although given your proclivities, might I suggest the WTFPL? |
| 20:49 | sdegutis | TimMc: I still don't understand what you mean. |
| 20:50 | TimMc | It seems like a thing you might roll towards. |
| 20:50 | TimMc | Apparently. I'd never looked up the etymology before. |
| 20:51 | TimMc | sdegutis: http://wtfpl.org/ |
| 20:53 | TimMc | technomancy: In case you haven't seen it already: http://imgur.com/gallery/HfqUF1v |
| 20:59 | sdegutis | uhh |
| 21:16 | tuft | is there a negated version of "when"? i.e. "unless"? |
| 21:17 | justin_smith | when-not |
| 21:17 | justin_smith | though I would prefer unless |
| 21:17 | tuft | nice thanks |
| 21:19 | sdegutis | justin_smith: (defmacro unless [& body] `(if-not ~@body)) |
| 21:21 | sdegutis | (intern 'clojure.core #'unless) |
| 21:22 | justin_smith | that's not how intern works |
| 21:23 | sdegutis | Something like that |
| 21:23 | sdegutis | Anyway, https://github.com/sdegutis/slim-cljm |
| 21:23 | justin_smith | sdegutis: (intern 'clojure.core 'unless @#'unless) |
| 21:23 | sdegutis | Right! |
| 21:23 | sdegutis | justin_smith: Excellent. |
| 21:24 | justin_smith | I can figure out how to do it, but that doesn't make it a good idea |
| 21:29 | arrdem | ah it's just another var in core what's the worst that could happen |
| 21:31 | amalloy | justin_smith: that shouldn't actually work, for a macro |
| 21:50 | justin_smith | amalloy: I'm happy to hear that |
| 22:30 | sdegutis | I'm going to port http://slim-lang.com/ to Clojure. |
| 22:30 | sdegutis | Is that unreasonable? |
| 22:40 | TimMc | "Automatic HTML escaping by default" -- yay! |
| 22:45 | sdegutis | TimMc: Can't tell if serious. |
| 23:08 | gfrederi` | I'll bet he's serious |
| 23:38 | TimMc | Serious. |
| 23:38 | TimMc | gfrederi`: Hey, I like your haircut. |
| 23:39 | TimMc | Very butch. |