2013-02-02
| 00:10 | yedi | is it me or has clojure been hitting the frontpage of hn a lot lately |
| 00:11 | ChongLi | confirmation bias :) |
| 00:12 | arrdem | lol |
| 00:12 | arrdem | best bias to have :) |
| 00:12 | ChongLi | sure, as long as it doesn't lead to blue laws and/or violence |
| 00:18 | arrdem | I'm sure if you cared enough you could crawl HN's API and show that the current spurt of CLJ related headlines is statistically significant.. |
| 00:21 | ChongLi | http://www.google.ca/trends/explore#q=clojure |
| 00:21 | ChongLi | seems like a pretty sharp increase since 2008 or so |
| 00:21 | ChongLi | late 2007 |
| 00:22 | arrdem | haha "clojure for" |
| 00:22 | arrdem | good lord traffic from northern CA |
| 00:24 | frozenlock | Let's compare... http://www.google.ca/trends/explore#q=clojure%2C%20java&cmpt=q |
| 00:25 | arrdem | frozenlock with the circlejerk killer... |
| 00:25 | ChongLi | should only be a few more years until we catch up! |
| 00:25 | frozenlock | Almost there :P |
| 00:25 | arrdem | C++ and Python are almost flat... |
| 00:25 | arrdem | interesting. |
| 00:26 | ChongLi | from 100% down to 30% |
| 00:26 | ChongLi | java's really dropping like a stone |
| 00:26 | frozenlock | So is Emacs :( |
| 00:26 | arrdem | what's interesting to me is that Python is too.. |
| 00:26 | ChongLi | that's ok |
| 00:26 | ChongLi | light table will fill the void! |
| 00:26 | arrdem | so what language is picking up the slack? |
| 00:27 | ChongLi | http://www.google.ca/trends/explore#q=lighttable%2C%20emacs&cmpt=q |
| 00:27 | ChongLi | lighttable is catching up even faster! |
| 00:27 | frozenlock | ChongLi: Must be 100% FOSS for that. Will LightTable be? |
| 00:27 | ChongLi | yeah |
| 00:27 | arrdem | eventually (tm) |
| 00:27 | ChongLi | lighttable will give you the editor as a value! |
| 00:44 | arrdem | is there some way to profile my ring/noir server and see why it's spinning? |
| 00:53 | Raynes | It's trying to tell you to switch to Compojure + lib-noir. |
| 00:54 | arrdem | haha |
| 00:55 | arrdem | yeah that's on the todo list but getting my /resume page up to date comes first |
| 01:50 | headshot | hahaa "everything emacs can do, vi can do in an alternate universe way" |
| 01:51 | Raynes | headshot: I don't think so, actually. |
| 01:52 | Raynes | I emulate vim in Emacs every day. I'd love to see someone emulate Emacs in vim. |
| 01:52 | headshot | i'm quoting stuart halloway |
| 01:52 | Raynes | I knew that guy was dumb. |
| 01:52 | Raynes | I'll tell him he is dumb at the next conj. |
| 01:53 | Raynes | But then again, at the last conj I saw him coming back all sweaty from a work out. I have a feeling he could kick my ass. |
| 02:00 | AtKaaZ | can this be done? namespace X uses namespace Y and namespace Y wants to make a function from namespace Z public to X without redefining it in Y ? (refer ?) |
| 02:01 | AtKaaZ | namespace X doesn't use namespace Z, obviously |
| 02:01 | Raynes | AtKaaZ: https://github.com/flatland/useful/blob/develop/src/flatland/useful/ns.clj#L19 |
| 02:03 | AtKaaZ | so it can't be done with refer that's for sure, right? thanks |
| 02:04 | Raynes | You can't do it without aliasing. |
| 02:12 | AtKaaZ | Raynes, can I not name it the same name ? https://gist.github.com/4696402 do I have to somehow exclude deftest from :use ? |
| 02:15 | AtKaaZ | I'm failing to find docs for ns |
| 02:16 | AtKaaZ | ok found something here: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns |
| 02:18 | AtKaaZ | ok got it to work: https://gist.github.com/4696402 |
| 02:26 | AtKaaZ | is there something that would auto indent clojure code ie. https://www.refheap.com/paste/9175 |
| 02:40 | mattmoss | AtKaaZ: clojure.pprint/pprint |
| 02:41 | AtKaaZ | mattmoss: excellent! Thank you! |
| 02:42 | h0bbit | I vaguely recall reading that clojure 1.5 will have a function that will allow me to break out of a reduce |
| 02:42 | h0bbit | does anyone remember the name of that function? |
| 02:50 | AtKaaZ | can refheap do something like: there's an updated version of this paste (like pastebin can) ? |
| 02:54 | Raynes | AtKaaZ: You have to be logged in, but you can edit pastes if you are. |
| 02:54 | AtKaaZ | cool |
| 03:04 | AtKaaZ | new and is are so picky |
| 03:05 | AtKaaZ | got forbit I pass them a symbol or var or anything that's a non-class |
| 03:06 | AtKaaZ | s/forbit/forbid |
| 03:09 | AtKaaZ | by 'is' I mean, (is (thrown? clshere ...)) and by 'new' i mean (new clshere ...) |
| 03:15 | alex_baranosky | after using a lot of keyword args in prod code, and while trying to get real work done, I find that something I do often enough that it is annoying is to accidentally pass a typo in a keyword arg. So, I'm write a macro defn-kw that would behave like this: https://www.refheap.com/paste/9177 |
| 03:15 | alex_baranosky | now I can remove a class of things that waste my time :) |
| 03:38 | amalloy | h0bbit: reduced |
| 03:38 | h0bbit | amalloy, ty. reading up on it now. |
| 03:41 | h0bbit | amalloy, how is this supposed to work? |
| 03:41 | h0bbit | the doc string says : "Wraps x in a way such that a reduce will terminate with the value x" |
| 03:42 | h0bbit | but there isn't an example of how to use it. |
| 03:52 | Sgeo | ,reduced |
| 03:52 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reduced in this context, compiling:(NO_SOURCE_PATH:0)> |
| 03:52 | Sgeo | Do any of the bots have access to it? |
| 03:53 | AtKaaZ | ,*clojure-version* |
| 03:53 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 05:50 | borkdude | xeqi nice video about friend |
| 06:34 | AtKaaZ | is it possible to make fixtures apply only to a certain test? I need something like before and after but only for a specific deftest |
| 06:42 | AtKaaZ | (without moving it into a new namespace to live alone) |
| 06:45 | babilen | AtKaaZ: Something along the lines of https://github.com/marick/Midje/wiki/Setup%2C-Teardown%2C-and-State but for clojure.test you mean? |
| 06:47 | AtKaaZ | babilen, exactly, except must not use midje :) |
| 06:48 | babilen | AtKaaZ: I don't think that's possible. Why can't you use midje? It would allow you to keep your "old" tests while being able to write "new" midje ones |
| 06:48 | AtKaaZ | babilen: it's mainly because it just executes/compiles all .clj files it can find when doing lein midje |
| 06:49 | babilen | AtKaaZ: My understanding of clojure.test (and one of the reasons why I started to use midje ages ago) was that fixtures are strictly per-namespace with something that runs once or before/after every test. |
| 06:49 | AtKaaZ | that's how I understand them also |
| 06:49 | babilen | Well, unless somebody knows better we at least understand it in the same way :) |
| 06:50 | AtKaaZ | alrighties then, I'm now allowing myself to find a way, since I assume there's none (in clojure not midje) already |
| 07:41 | thalassios_xelon | hello :) i want to make a jar from eclipse,i have counterclockwise installed,how can i do it? any tutorial to read or help? |
| 07:42 | thalassios_xelon | i've never made a jar before |
| 07:46 | abp | thalassios_xelon, never tried that, probably just use leiningen from the command line? |
| 07:46 | thalassios_xelon | how to do it from lein? |
| 07:46 | thalassios_xelon | any tutorial? |
| 07:46 | thalassios_xelon | i found one ,online |
| 07:47 | thalassios_xelon | i will try it... |
| 07:47 | abp | thalassios_xelon, http://code.google.com/p/counterclockwise/wiki/Documentation#Distribute_as_a_jar |
| 07:47 | thalassios_xelon | abp i tried that i i couldnt do it |
| 07:48 | thalassios_xelon | thx i will try again |
| 07:50 | abp | thalassios_xelon, ok, never tried from eclipse. lein uberjar is easy enough https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#what-to-do-with-it |
| 07:53 | thalassios_xelon | thx i am reading it .... |
| 08:07 | borkdude | not clojure related per se, but I need to represent some tabular data which can be drilled down into detail. any libraries that support this? |
| 08:12 | borkdude | it could just be smth client side with static data |
| 08:12 | borkdude | which can be provided with a map for example |
| 08:43 | pepijndevos | Is there a regex that will produce ["foo" "bar" "," "baz" "?"] for the following string? (s/split "foo bar, baz?" #".......") |
| 08:44 | OscarZ_ | trying to get started with Clojure dev in Eclipse, created a new project with lein new, then added a lein-eclipse dev dependency and ran "lein deps". I am still getting "eclipse is not a task" when I run "lein eclipse" |
| 08:45 | pepijndevos | #"\b" produces ["" "foo" " " "bar" ", " "baz" "?"], which is close, but not quite right |
| 08:49 | pepijndevos | OscarZ_, lein 1 or 2? I can;t help you much, beyond observing that it might be a version incompatability. |
| 08:49 | pepijndevos | lein 2 has a new plugin system |
| 08:50 | OscarZ_ | yeah thanks, I just found out about the lein 2 having different plugin system ... I was reading some example for lein 1 |
| 08:50 | OscarZ_ | i have to write ~/.lein/profiles.clj apparently |
| 08:52 | hyPiRion | ,(mapcat (partial re-seq #"[^,?]+|[,?]") (re-seq #"[^\ ]+" "foo bar, baz?")) |
| 08:52 | clojurebot | ("foo" "bar" "," "baz" "?") |
| 09:00 | borkdude | pepijndevos hehe http://txt2re.com/index-java.php3?s=foo%20bar,%20baz?&-23&24&2&4&3 |
| 09:00 | pepijndevos | weee |
| 09:02 | pepijndevos | I also found this one: http://stackoverflow.com/a/5214338/183662 |
| 09:41 | thalassios_xelon | hello, i want to put a argument in main, '(and a b) and call a function with that argument,how to do it? |
| 09:42 | thalassios_xelon | (defn -main [&args] (table args)) wont work |
| 09:45 | jeremyheiler | Do you want to pass in the args vector as a parameter, or each element in args as parameters? |
| 09:45 | jeremyheiler | to the table function. |
| 09:45 | thalassios_xelon | args is the parameter |
| 09:46 | thalassios_xelon | '(and a b) is a possible args |
| 09:46 | jeremyheiler | solussd, the quoted list is what you want to pass into table, right? |
| 09:46 | jeremyheiler | so* |
| 09:46 | thalassios_xelon | (-main '(and a b) sould call (table '(and a b)) |
| 09:46 | solussd | :D |
| 09:47 | jeremyheiler | sorry solussd, must of autocompleted lol |
| 09:47 | solussd | ha |
| 09:48 | jeremyheiler | The code you provided is effectively calling this (-main ('(and a b))) |
| 09:49 | jeremyheiler | args is presented to you as a list, so you need to unwrap it. |
| 09:49 | jeremyheiler | try (apply table args) |
| 09:50 | jeremyheiler | or (table (first args)) |
| 09:51 | thalassios_xelon | (table (first args)) calls (table '(and ) |
| 09:51 | thalassios_xelon | i think |
| 09:51 | thalassios_xelon | ...... |
| 09:51 | thalassios_xelon | the args is array seq not a list......... |
| 09:52 | thalassios_xelon | thx jeremyheiler i didnt solve the problem but i will try again |
| 10:02 | pepijndevos | whoa, I just realised one coul write a program in core.logic to generate all possible questions to which the answer is 42. |
| 10:02 | jeremyheiler | thalassios_xelon, that shouldn't matter. https://www.refheap.com/paste/9179 |
| 11:04 | cemerick | Adding [lein-swank "1.4.5"] to my project.clj's :plugins seems to force my project to use clojure 1.2.1. Global :exclusions of [org.clojure/clojure] seem to not apply. Thoughts? |
| 11:09 | cemerick | OK, I think I'm having issues because I'm trying to not use an org.clojure/clojure dep |
| 11:12 | xeqi | cemerick: https://www.refheap.com/paste/9180 look ok to me |
| 11:12 | xeqi | ah |
| 11:14 | cemerick | In any case, I think :exclusions isn't being applied *globally*-globally :-P |
| 11:18 | xeqi | with https://www.refheap.com/paste/9181 `lein swank` uses 1.5.0 |
| 11:18 | xeqi | but I could believe the global exclusions bug |
| 11:21 | cemerick | hrm |
| 11:24 | nbeloglazov | Hi. How do I implement syncrhonous mutable queue in clojure? Can I do it using atom/refs or need to use low-level locking? My main concern about "get" method that should modify queue and return first item from it. I don't want to use built-in java classes because I need to perform custom stuff in put and get. |
| 11:26 | craigbro | agent shoudl do it |
| 11:26 | hyPiRion | nbeloglazov: use clojure.lang.PersistentQueue/EMPTY |
| 11:27 | xeqi | (inc hyPiRion) |
| 11:27 | lazybot | ⇒ 12 |
| 11:27 | nbeloglazov | craigbro: How I can do it with agent? How do I implement get method? |
| 11:27 | nbeloglazov | hyPiRion: but it's immutable. How do add mutability to it? |
| 11:28 | hyPiRion | nbeloglazov: (ref (clojure.lang.PersistentQueue/EMPTY)) |
| 11:28 | nbeloglazov | what about get method? |
| 11:28 | xeqi | (let [q (atom clojure.lang.PersistentQueue/EMPTY)] (swap! q conj 1) (swap! q pop)) |
| 11:28 | cemerick | nbeloglazov: Just use a queue from java.util.concurrent |
| 11:28 | cemerick | oh, sorry, didn't finish reading your msg :-P |
| 11:28 | nbeloglazov | (swap! q pop) make no sense to me |
| 11:29 | nbeloglazov | Because I can't get removed element |
| 11:29 | cemerick | In any case, you can provide "put" and "get" fns that do whatever custom bits you want, but which are backed by a j.u.c queue that will just work. |
| 11:33 | hyPiRion | (let [q (ref clojure.lang.PersistentQueue/EMPTY)] (dosync (alter q conj 1)) (dosync (let [v (peek (ensure q))] (alter q pop) v))) should work fine. |
| 11:34 | hyPiRion | First dosync is insertion, second is popping elements. |
| 11:35 | hyPiRion | Consider replacing alter with commute if actions are commutative. |
| 11:35 | nbeloglazov | Actually I need some kind of priority synchronized queue that ensure uniqueness of the elements. It shouldn't be really fast or smart so I was going to do it using usuall set for uniqueness and find "least" element on every "get" and remove it. I wondered if I can do it using atom/ref/agents. |
| 11:35 | nbeloglazov | hyPiRion: I'll check it now |
| 11:39 | abp | Hi cemerick, the "write end dead"-exception in nrepl seems to become worse for some windows users. I think it's with the most recent nrepl-version but can't tell you for sure. Co-workers experience it through nrepl.el and I've seen it with eclipse ccw twice today. |
| 11:46 | cemerick | abp: "write end dead"? |
| 11:48 | abp | cemerick, I think as in https://groups.google.com/forum/?fromgroups=#!topic/clojuredev-users/eh1pjfI_iHQ |
| 11:49 | cemerick | abp: oh, this is related to *in*? |
| 11:49 | abp | cemerick, haven't copied my stacktrace, this time it's on windows 7 machines, at least three different, only thing in common between these is latest nrepl-version |
| 11:49 | abp | cemerick, probably |
| 11:51 | cemerick | ok |
| 11:52 | cemerick | The *in* support is included in the automated tests, but I don't use it |
| 11:53 | cemerick | abp: the best bet would be to have someone who uses it regularly (hint!) to dig in and see what might be the underlying problem. |
| 11:53 | abp | cemerick, I really have no idea what triggers it. Seems not reproducible, but sometimes it can get nasty and occurs every few seconds after repl restart. |
| 11:53 | cemerick | abp: but is it only when you're using *in*? |
| 11:54 | abp | cemerick, how do I know that? |
| 11:54 | cemerick | if you're using read-line or something similar |
| 11:54 | cemerick | That's what the ML thread is about, anyway |
| 11:55 | abp | cemerick, oh, he yes, I think so. We were doing a console-app competition. |
| 11:55 | cemerick | right |
| 11:55 | cemerick | Both nrepl.el and ccw have horrible UIs for such things |
| 11:56 | abp | cemerick, phew that's not as severe as I thought then. :) |
| 12:09 | borkdude | I like it that nrepl also works from outside a project |
| 12:11 | borkdude | btw is it possible to have every repl on my system (set! *print-length* 200) without manually doing so? |
| 12:12 | hyPiRion | borkdude: use :repl-options inside a :user profile in your $LEIN/profiles.clj |
| 12:13 | borkdude | hyPiRion what's the syntax for that |
| 12:13 | borkdude | :repl-options {*print-length* 200} ? |
| 12:18 | borkdude | hyPiRion I got this, but it doesn't seem to catch on https://www.refheap.com/paste/9182 |
| 12:20 | craigbro | borkdude: do you realize that that example with *print-length* is going to save hours of my life? |
| 12:21 | borkdude | craigbro no, but I'm glad |
| 12:21 | craigbro | haha, I am dealing with some gigantic data structures, and if I accidently eval something that returns them, it nearly kills my emacs |
| 12:21 | craigbro | never even thought of setting that, derp |
| 12:21 | borkdude | craigbro there's also print-level I think |
| 12:21 | borkdude | ,(binding [*print-length* 10] (range)) |
| 12:21 | clojurebot | (0 1 2 3 4 ...) |
| 12:22 | borkdude | haha, binding doesn't work there? |
| 12:22 | borkdude | hmm, what happens if you nest bindings |
| 12:23 | borkdude | ,(binding [*print-length* 10] *print-length*) |
| 12:23 | clojurebot | 10 |
| 12:24 | borkdude | ,*print-level* |
| 12:24 | clojurebot | 10 |
| 12:24 | borkdude | ,*print-length* |
| 12:24 | clojurebot | 5 |
| 12:37 | mindbender1 | how does ring-jetty serve static files. Is there a way of knowing where jetty looks for static file or changing where it does? |
| 12:38 | weavejester | mindbender1: It doesn't. :) |
| 12:38 | weavejester | mindbender1: You need to explicitly add middleware (or in Compojure, a route) to serve static files. |
| 12:39 | weavejester | You can serve static files from a directory using ring.middleware.file/wrap-file or compojure.route/files |
| 12:39 | weavejester | But the recommended route (no pun intended) is to serve static files from Java resources, using ring.middleware.resource/wrap-resource or compojure.route/resources |
| 12:40 | weavejester | That way your resources aren't tied to the filesystem - they could be packaged up in a jar (for instance) |
| 12:41 | mindbender1 | weavejester: thanks for clarifying this. I have been avoiding asking this questiom trying to figure out myself but I guess you've set my mind straight |
| 12:41 | xeqi | is there a middleware for adding cache headers when serving from a jar? |
| 12:41 | xeqi | and also checking them |
| 12:41 | weavejester | xeqi: Not currently, but probably for Ring 1.2 |
| 12:42 | weavejester | Actually… let me check that. |
| 12:42 | xeqi | I've seen a couple of pastes in places for something similar, but hadn't found one packaged up yet |
| 12:45 | weavejester | xeqi: Yes, Ring 1.2 does it with resource-response. |
| 12:45 | weavejester | I actually should release a beta of that. |
| 12:47 | weavejester | There are three things in Ring 1.2 left to add, and they're all 90% done. I just need to make that last effort :) |
| 12:48 | weavejester | I wish github would improve their search |
| 12:49 | weavejester | The results it gives back are still rubbish. |
| 12:49 | xeqi | is there a middleware for checking If-Modified-Since and returning 304s? |
| 12:50 | weavejester | xeqi: In Ring 1.2 there is wrap-not-modified |
| 12:50 | weavejester | Let me release a beta version today |
| 12:50 | xeqi | haha, I completely missed that scanning the filenames |
| 12:50 | xeqi | thanks |
| 13:43 | OscarZ_ | I've setup a project using compojure template in Eclipse.. how do I get this thing running so I can get hello world to browser? :) I tried right clicking handler.clj and running it as Clojure application but its not listening to 8080 |
| 13:43 | OscarZ_ | REPL is up |
| 13:44 | weavejester | Try port 3000? I'm not familiar with the compojure template for Eclipse, unless it hooks into the one for Leiningen. |
| 13:45 | OscarZ_ | its not on 3000 either.. |
| 13:45 | OscarZ_ | sorry, I created the project with lein new compojure compojure-test |
| 13:46 | weavejester | OscarZ_: In which case, try running "lein ring server" |
| 13:47 | OscarZ_ | yes that works |
| 13:47 | OscarZ_ | thanks... is there a way to launch it directly from Eclipse by a run configuration? |
| 13:48 | OscarZ_ | hmm it seems to pick up the changes I make to classes on the fly, so I guess I dont need that |
| 13:51 | craigbro | has anyone else transition a noir app to compojure + libnoir? |
| 13:51 | craigbro | I have a rather large one |
| 13:51 | weavejester | Hum, tools.namespace now has a lot of the functionality I need for ns-tracker, but lacks a few critical areas. |
| 13:51 | craigbro | I would hate to have to reconfigure all my defpages |
| 13:54 | weavejester | Bleh, updating ns-tracker is going to be a pain. tools.namespace does *almost* what I want, but is one step behind ns-tracker in certain areas. |
| 14:06 | amalloy | weavejester: perhaps bultitude has what you want? |
| 14:06 | abedra | gfredericks: what were your concerns with using Util.hasheq for CLJ-1106? |
| 14:06 | abedra | versus copying the logic from APersistentMap ? |
| 14:07 | weavejester | amalloy: No, it's mostly around the dependencies. |
| 14:07 | weavejester | tools.namespace assumes order doesn't matter a lot of the time. |
| 14:07 | weavejester | Which lead to problems that I fixed in ns-tracker. |
| 14:08 | abedra | stuarthalloway_: do you see any downsides with the Util.hasheq approach? |
| 14:09 | weavejester | amalloy: But thanks for the reference anyway |
| 14:09 | stuarthalloway_ | context for abedra's question: http://dev.clojure.org/jira/browse/CLJ-1106? |
| 14:09 | abedra | yes sorry |
| 14:09 | stuarthalloway_ | Util.hasheq seems correct, but if that is true, it should be used as an optimization for maps as well as for sets |
| 14:10 | abedra | +1 |
| 14:10 | abedra | that was my next question |
| 14:11 | stuarthalloway_ | a good generative test covering equality semantics would help add confidence |
| 14:11 | jimduey | brainproxy: Just put up my post on comonads. http://www.clojure.net/2013/02/02/Comonads/ |
| 14:11 | jimduey | and the library. https://github.com/jduey/comonads |
| 14:12 | ravster | hello all |
| 14:12 | weavejester | Ack, I'm really beginning to regret having merged these changes. The PR looked okay, but I missed a whole bunch of things I now have to fix. *sigh* |
| 14:13 | rboyd | weavejester: on compojure or where? |
| 14:14 | weavejester | rboyd: ns-tracker |
| 14:14 | weavejester | To be fair the PR is mostly okay |
| 14:14 | weavejester | But because tools.namespace does so much now, there's a lot of opportunity for code reuse |
| 14:14 | weavejester | And the PR didn't include a test but added a new feature. |
| 14:14 | stuarthalloway_ | abedra: presumably set equality with Integers is broken in 1.3 and 1.4? |
| 14:15 | abedra | good question |
| 14:15 | abedra | for 1.4 yes |
| 14:15 | abedra | that's what we are using |
| 14:15 | abedra | I can look at 1.3 |
| 14:17 | abedra | yep |
| 14:17 | abedra | 1.3 is also affected |
| 14:18 | stuarthalloway_ | abedra: I think both of those patches are broken, and would break .equals |
| 14:19 | abedra | stuarthalloway_: interesting |
| 14:19 | abedra | i'm up for putting together a generative test |
| 14:19 | abedra | are they wired up directly from test.generative? |
| 14:19 | abedra | or added to the project itself now? |
| 14:19 | stuarthalloway_ | APersistentSet equiv calls equals |
| 14:20 | abedra | ah |
| 14:20 | stuarthalloway_ | at first glance, that can't be right |
| 14:20 | abedra | yes |
| 14:20 | abedra | it does |
| 14:22 | gfredericks | abedra: oh hi |
| 14:23 | gfredericks | abedra: I hadn't looked into the issue in detail; Bo had; my impression was that the obvious thing to do is make sets act like the other data structures, and whether there's a better way to handle all of them is a separate question |
| 14:23 | stuarthalloway_ | gfredericks: agreed, except the fix just moves the problem somewhere else |
| 14:24 | abedra | yeah |
| 14:24 | abedra | that's what I am starting to see |
| 14:24 | stuarthalloway_ | i.e. fixing = breaks .equals |
| 14:24 | gfredericks | stuarthalloway_: the problem being incorrectness or performance? |
| 14:24 | gfredericks | oh |
| 14:24 | stuarthalloway_ | incorrectness |
| 14:24 | gfredericks | okay, I don't fully understand the issue then :) |
| 14:24 | stuarthalloway_ | the fact that Set equiv calls equals seems to me to be the real problem |
| 14:24 | abedra | stuarthalloway_: gfredericks found the issue at work the other day |
| 14:25 | abedra | yes |
| 14:25 | stuarthalloway_ | if you look at map, it has equiv and equals as two separate parallel worlds |
| 14:25 | abedra | APersistentMap calls mapEquals |
| 14:26 | stuarthalloway_ | Set would need to have two parallel equality methods, like .mapEquals and .equiv in Map |
| 14:26 | abedra | yes |
| 14:27 | stuarthalloway_ | abedra: can you add another comment on the ticket summarizing this thinking |
| 14:28 | abedra | yes |
| 14:28 | abedra | I'll start working on another patch |
| 14:32 | gfredericks | the purpose of .equals is to be like .equiv but without comparing across numeric types? |
| 14:33 | brainproxy | jimduey: thanks for the heads up! |
| 14:34 | stuarthalloway_ | gfredericks: yes, more generally, to comply with Java' s rules for such comparisons |
| 14:36 | gfredericks | oh that sounds like a good google |
| 14:36 | gfredericks | are the java rules more than consistency with .hash? |
| 14:50 | ravster | do cemerick/friend user roles have to be in the form of '::foo' ? |
| 14:51 | gfredericks | ravster: that would surprise me; I've never used friend though. |
| 14:51 | ravster | okay. |
| 14:56 | ravster | and should friend wrap over ring/wrap-session? |
| 14:58 | qz | how do i split one namespace into several source files? if i go with one main file doing (load ..) on others i have problems with lein-ring reloading when i change stuff |
| 14:58 | gfredericks | qz: it's not recommended |
| 14:59 | qz | gfredericks: not recommended splitting namespaces at all? |
| 14:59 | gfredericks | qz: correct |
| 15:00 | qz | gfredericks: i'm total clojure newb and writing web application, and i want my views to sit it one namespace, but having them all in one file would be overkill.. what's preferred way to work around it? |
| 15:00 | gfredericks | why do you want them in one namespace? |
| 15:01 | qz | gfredericks: because they all share common require/use, because i'd like to group them anyways (having one namespace per page, would create too many namespaces) |
| 15:03 | gfredericks | the first point might suggest some refactorings; I'm not one to defend in detail the file<->namespace correspondence though. I just know that if you try to go against that you'll have an uphill battle and unidiomatic project structure. |
| 15:05 | qz | gfredericks: i see, i just found http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files and thought its pretty much idiomatic way, as answer comes from one of "joy of clojure" authors |
| 15:06 | gfredericks | I did not know clojure.core did that |
| 15:09 | weavejester | clojure.core isn't always idiomatic, because of concerns of performance and bootstrapping |
| 15:09 | gfredericks | weavejester: hard to imagine either of those justifying this case though; only downsides I know of inlining the files is an even bigger core.clj |
| 15:09 | tmciver | qz: it's still not recommended. Concerning web app views, I would do something like views/html/widget1.clj, views/html/widget2.clj etc. |
| 15:10 | qz | tmciver: and then require them all in a controller ? |
| 15:10 | weavejester | gfredericks: Well, clojure.core by its nature has to contain all the base functions. |
| 15:11 | gfredericks | weavejester: sure but that could be accomplished by putting everything in the same file |
| 15:11 | tmciver | qz: sure. Personally I keep all my views in one views/html.clj file, but then I only have small toy web apps. |
| 15:11 | ravster | cemerick: do the roles of users for use by 'friend' have to be '::foo'? I ask because I want to save stuff in datomic, and it will be easier to do it as a string. |
| 15:11 | qz | weavejester: wow, hiccup/compojure author here :) how do you organize views in your web apps? |
| 15:12 | cbp` | hello i have a question, using korma, does anyone know why the following select doesn't do a join with the Location table? https://www.refheap.com/paste/1c6f596ebd765dcdc16c05276 |
| 15:12 | weavejester | gfredericks: Yes, but normally if your file is getting too big, you can separate it out into different namespaces. With clojure.core, that obviously isn't possible. |
| 15:12 | qz | tmciver: i see, will try to merge pages into one file also |
| 15:12 | gfredericks | cbp`: is "Ubicacion" in line 6 a typo? |
| 15:12 | weavejester | Regarding the use of in-ns/load to split a namespace across several files, it does make life more difficult for tools |
| 15:13 | weavejester | But I wouldn't say it was necessarily wrong. |
| 15:13 | cbp` | yes it's supposed to be Location sorry |
| 15:13 | gfredericks | cbp`: is that your issue? |
| 15:13 | cbp` | no |
| 15:13 | weavejester | The next version of ns-tracker (which lein-ring uses behind the scenes) will support dependencies through in-ns |
| 15:14 | cbp` | I just translated the names from spanish to english for no reason but that's beside the problem |
| 15:14 | weavejester | qz: But… in general, I'd say that if your views are getting very large, there may be some refactoring you can do to reduce their size. |
| 15:15 | cbp` | I just editted it |
| 15:15 | weavejester | cbp`: Isn't it |
| 15:15 | weavejester | oops |
| 15:15 | qz | weavejester: every individual view is not large, but there will be many pages (many views) and combined - that's lots of code |
| 15:15 | qz | weavejester: i'm doing a port of rails app |
| 15:16 | weavejester | cbp`: Isn't it "join" rather than "with" to do a join? |
| 15:16 | weavejester | qz: Ah, I see. Rails doesn't necessarily do a good job at DRY when you get to the view layer. |
| 15:16 | gfredericks | qz: weavejester: I coulda sworn with worked like that; I'm puzzled |
| 15:17 | cbp` | weavejester: I believe join would do a manual join which isn't what i wanted to do. If the relation changes to has-one then (with Location) does the left join but that's the wrong relation |
| 15:17 | weavejester | gfredericks: I though "with" created a lazy seq of selects. |
| 15:17 | weavejester | For has-many at least. |
| 15:17 | cbp` | I suppose with has-may one has to do a manual join |
| 15:18 | gfredericks | weavejester: oh right! |
| 15:18 | gfredericks | I knew it did that |
| 15:18 | gfredericks | but I forgot that it then wouldn't show up in the sql |
| 15:18 | gfredericks | qz: so it's probably working fine, it just doesn't do joins, it does subsequent queries |
| 15:18 | weavejester | qz: There may be parts of the view code you can refactor to be smaller. Other than that, you may have to go down the splitting the namespace up into files. |
| 15:19 | gfredericks | qz: whoops not you |
| 15:19 | abp | cbp`, or you need to add (pk :type) on location? |
| 15:19 | gfredericks | cbp`: ^ |
| 15:20 | cbp` | but the pk is id, i don't wanna use varchars for pk's :( |
| 15:22 | abp | cbp`, don't worry, I just guessed {:fk :type} needs to reference a pk |
| 15:22 | geoffs | Does anybody know how to eval code in an external file in the context of the current namespace? Do you just have to bind *ns*? |
| 15:23 | cbp` | oh |
| 15:23 | cbp` | i just realized im really dumb |
| 15:25 | cbp` | wait sorry this is really confusing i'll come back later |
| 15:25 | hugod | geoffs: yes, you may want to look at leiningen.core.project/read for an example |
| 15:26 | cbp` | I should probably just stick to doing sql manually |
| 15:28 | geoffs | hugod: thanks! That looks exactly like what I want |
| 15:34 | abedra | stuarthalloway_: I have a working patch |
| 15:34 | abedra | Just making sure it applies cleanly and I will push it to Jira |
| 15:36 | Frozenlock | Do users nowadays expect permalinks, or do you have to explicitly tell them "yes, you can copy the URL"? |
| 15:37 | abedra | stuarthalloway_: gfredericks ok it's up there |
| 15:37 | gfredericks | Frozenlock: probably it all feels like witchcraft |
| 15:38 | gfredericks | abedra: thanks for looking at it |
| 15:38 | Frozenlock | gfredericks: As in what's the odd bar in my browser with letters in it? :P |
| 15:38 | gfredericks | Frozenlock: http://gfredericks.com/gfrlog/posts/42 |
| 15:39 | Frozenlock | gfredericks: Just before I start reading that, I want to mention that my grandparents are incredibly good with computers, perhaps more than my parents. |
| 15:40 | gfredericks | Frozenlock: I wrote this 3 years ago when there was an entirely different generation of grandparents |
| 15:40 | gfredericks | times were different then |
| 15:42 | gfredericks | Frozenlock: that's an interesting observation though |
| 15:42 | cbp` | oh so the problem was that it does the join but lazily, which is actually annoying |
| 15:44 | cbp` | Because sql-only doesn't give me the entire sql command |
| 15:44 | gfredericks | cbp`: correct |
| 15:44 | Frozenlock | gfredericks: Very true. Valid for a bunch of thing in computing in fact; everything built on top of traditions. If you didn't follow along, you might get lost. |
| 15:45 | Frozenlock | Also, I like the ASCII style. |
| 15:45 | gfredericks | Frozenlock: haha, thanks |
| 15:47 | Frozenlock | Anyhow, I just worked very hard to make sure a JS enabled page would update its URL at each user's (notable) action, insuring that they can copy/paste the url in an email. I was wondering if I had to tell them they could do so. |
| 15:48 | gfredericks | if you want them to be conscious of it, probably |
| 15:48 | sritchie | hey, are any of you guys using leiningen with clojure.test.generative? |
| 15:51 | jeremyheiler | Is there a way stop the args vector from moving in-line with the docstring when using M-q? |
| 15:54 | ljos | Anyone have any experience testing ring web-apps with clj-webdriver? I was just wondering how you would do it with starting the server. I don't always have the test server up and running, but I want the server to start when I run the tests. I am also using midje if that matters. |
| 15:54 | arohner | jeremyheiler: I insert a newline, then M-q, then remove the newline |
| 15:54 | amalloy | ljos: don't start the server, just call your handler function with request maps by hand |
| 15:55 | arohner | amalloy: that doesn't work for browser tests |
| 15:55 | ljos | amalloy: like arohner says, I would like to do browser tests. |
| 15:56 | arohner | ljos: I just lein run my main init namespace, and leave the server running |
| 15:56 | arohner | then swank/nrepl in, and run the tests from the repl |
| 15:56 | jeremyheiler | arohner, heh thanks. |
| 15:56 | gfredericks | does anybody know any examples of &env being used in a macro? |
| 15:56 | ljos | arohner: that is accetable, but it would be nice to be able to just `lein midje` and everything justs goes automagically. |
| 15:57 | arohner | ljos: I have a namespace that sets everything up for testing, and that starts the server |
| 15:57 | arohner | then the test nses all require the test-init ns |
| 16:00 | ljos | arohner: That sounds like something I could do. Thanks! |
| 16:01 | cbp` | hmm so there's no way in korma to get all the queries that are going to be sent to the db before they are sent? |
| 16:02 | cbp` | dry-run only gets the first query right and the rest are incorrect |
| 16:02 | cbp` | and sql-only only gets the first query |
| 16:04 | ljos | arohner: wait. I am using ring.adapter.jetty to start the server, but how do I turn it off again after the tests have finished? |
| 16:04 | gfredericks | cbp`: in what sense are the dry-run queries incorrect? |
| 16:05 | cbp` | gfredericks: for example if i join according to an id, the first query gets the id right and the second query will just default the id to 1 |
| 16:05 | arohner | ljos: I don't normally stop my server, but if you hold on to the variable returned by r.a.jetty/run-jetty, you can stop it with noir.server/stop |
| 16:05 | gfredericks | cbp`: dry-run uses some dummy data since some of its values depend on things it doesn't actually have -- does that explain it? |
| 16:07 | ljos | arohner: Thanks. When I think about it it might actually be more of a hindrance then help to have it like this, but we'll see. |
| 16:07 | cbp` | gfredericks: Yes, however I was looking for a way to get both queries as they are going to be sent to the db |
| 16:10 | cbp` | I'm assuming there isn't something already built in so I guess I'll make it myself sometime later |
| 16:10 | weavejester | ljos: You can set the :join? option to false in the adapter |
| 16:10 | cbp` | When i have more time to look at the source |
| 16:10 | alex_baranosky | anyone know if there's a way to get Cheshire to decode numbers as Longs instead of decoding them as Integers? |
| 16:12 | amalloy | &(class (int 1)) |
| 16:12 | lazybot | ⇒ java.lang.Integer |
| 16:13 | amalloy | alex_baranosky: maybe go back to clojure 1.3? it had a bug that made that sort of thing happen a lot more often :) |
| 16:13 | alex_baranosky | ha! |
| 16:15 | gfredericks | alex_baranosky: I'm curious why you need that |
| 16:15 | sritchie | alex_baranosky: dude! I'm back on irc :) |
| 16:15 | sritchie | alex_baranosky: qq for you |
| 16:15 | sritchie | did you guys ever get generative testing into midje |
| 16:15 | sritchie | ? |
| 16:15 | alex_baranosky | just want consistency in our serializing/deserializing to HBase… don't really NEED it per se |
| 16:15 | amalloy | alex_baranosky: just looking at cheshire.parse and jackson's parser, i'd say that's not possible |
| 16:16 | amalloy | you'd have to do a post-processing step yourself |
| 16:16 | sritchie | alex_baranosky: if you're on scala, you should check out github.com/twitter/bijection for that |
| 16:16 | alex_baranosky | sritchie: there's a namespace called formulas.clj inMidje, but I can't find it, since Marick's been doing a lot of changes with the namespaces |
| 16:17 | sritchie | gotcha |
| 16:17 | sritchie | I'm playing with clojure.test.generative now, finally time to get back into this |
| 16:17 | sritchie | and have been using scalacheck quite a bit |
| 16:17 | sritchie | I'd be happy to help with the generative stuff if you want to wake it back up |
| 16:17 | alex_baranosky | amalloy: thanks, I think it's not important i=enough to add post-processing |
| 16:18 | alex_baranosky | sritchie: give it a try, let me find a link to the namespace for you |
| 16:18 | alex_baranosky | ah, I see, it is now being interned into midje.sweet https://github.com/marick/Midje/blob/master/src/midje/sweet.clj#L50 |
| 16:19 | sritchie | nice |
| 16:19 | TimMc | Wait, why is CLJ-1153 marked as "minor"? |
| 16:19 | sritchie | looks like there are no default ones? |
| 16:19 | sritchie | which is fine |
| 16:19 | TimMc | It should be "Critical", or at least "Major". |
| 16:19 | ljos | weavejester: that is a good idea :D |
| 16:19 | gfredericks | TimMc: do those things have agreed-upon definitions? |
| 16:20 | TimMc | I'm going to change it. |
| 16:21 | gfredericks | haha |
| 16:21 | hyPiRion | TimMc: +1 |
| 16:22 | gfredericks | I love how this thing is simultaneously an intentional feature and a critical defect |
| 16:22 | TimMc | "Minor" is just the default value. |
| 16:29 | alex_baranosky | amalloy: there's always alter-var-rooting the function having this line https://github.com/dakrone/cheshire/blob/master/src/cheshire/parse.clj#L45 so that it calls .getLongValue http://jackson.codehaus.org/1.2.1/javadoc/org/codehaus/jackson/JsonParser.html#getLongValue() |
| 16:30 | gfredericks | clojurebot: cheshire is <reply> there's always alter-var-rooting |
| 16:30 | clojurebot | You don't have to tell me twice. |
| 16:30 | amalloy | clojurebot: clojurebot is a time-capsule for snark |
| 16:30 | clojurebot | Ack. Ack. |
| 16:31 | jondot | aphyr: here? |
| 16:31 | cbp` | mmm what's the relation for an entity that has multiple references to location, for instance Address has multiple references to Location |
| 16:32 | cemerick | ravster: they can be other types, but then you can't use hierarchies to represent those relationships |
| 16:33 | cemerick | ravster: datomic certainly allows you to store keywords, though |
| 16:33 | hyPiRion | Arg, I wish every? could support multiple colls. |
| 16:35 | sritchie | alex_baranosky: hey dude, do you know if you can put multiple expectations within a given formula? |
| 16:35 | hyPiRion | I find myself doing (every? (fn [[e1 e2 .. en]] ..) (map vector x1 x2 .. xn)) too often |
| 16:36 | ljos | Sometimes I don't really understand how clojure/lein finds libraries. I add the release version of a library as a dependency, but clojure/lein can not find it when I use it in the test `ns`. Then I add the beta version and it suddenly works. No other changes in code. I suspect is because something goes wrong during the |
| 16:36 | ljos | linking. |
| 16:36 | ljos | Is there a way to get lein to do the linking again? |
| 16:36 | alex_baranosky | sritchie, yes! |
| 16:37 | sritchie | funky, I'm seeing |
| 16:37 | sritchie | There are too many expections in your formula form: |
| 16:37 | sritchie | alex_baranosky: this is bad ass, by the way |
| 16:37 | raek | ljos: are you sure that the library namespace did not change between the versions? |
| 16:37 | alex_baranosky | thanks :) |
| 16:37 | alex_baranosky | I have been so busy with all my other projects I never really added scrinking to it |
| 16:37 | sritchie | yeah, no worries |
| 16:37 | alex_baranosky | shrinking* |
| 16:38 | alex_baranosky | sritchie… oh so maybe you cannot. I wrote it forever ago, my mistake |
| 16:39 | raek | ljos: you can run "lein classpath" to see what dependencies will be available when you start clojure. you can peek inside the jar files listed by that command to find out what namespaces will be available |
| 16:39 | alex_baranosky | it might have simplified the implementation to only have one arrow per…. YOu know, I bet the reason was since I wanted to add shrinking. How can you shrink a failure if there are more than one failure per formula? I think you could not sanely do it |
| 16:39 | ljos | raek: God damn it. You are right. It is the documentation that is wrong -.- |
| 16:39 | alex_baranosky | I bet it could be changed to accept more than one arrow, if I officially admit I'll never add shrinking |
| 16:40 | raek | ljos: I don't think you usually call something "linking" on the JVM. things don't work like in C |
| 16:41 | raek | "class loading" is perhaps the term |
| 16:41 | stuarthalloway_ | I am pleased to announce the release of Simulant, a framework for simulation-based testing built using Datomic and Clojure: https://github.com/Datomic/simulant |
| 16:42 | stuarthalloway_ | feedback on docs solicited |
| 16:42 | ravster | cemerick: oh, okay. Cool. Thanks. |
| 16:44 | alex_baranosky | sritchie: I'm curious if you remove this cond case, if the formulas just work fine w/ multiple arrows/checks: https://github.com/marick/Midje/blob/master/src/midje/parsing/0_to_fact_form/formulas.clj#L112 |
| 16:45 | sritchie | hmm, maybe |
| 16:47 | Bronsa | stuarthalloway_: would you mind doing the "boring work" for blind (to be tools.reader) too? |
| 16:48 | stuarthalloway_ | @Bronsa: link for context? |
| 16:48 | stuarthalloway_ | nevermind, found it, boring away |
| 16:48 | Bronsa | ok, I was trying to find the thread, thanks |
| 16:53 | Bronsa | stuarthalloway_: in blind there's a commit by chris granger, is that a problem? |
| 16:53 | stuarthalloway_ | has he signed a CA? |
| 16:53 | Bronsa | yes |
| 16:54 | Raynes | Did he give a blood sample though? |
| 16:54 | stuarthalloway_ | then you just need him to send an email acking the transfer to contrib |
| 16:54 | Raynes | ibdknox: ^ |
| 16:55 | stuarthalloway_ | Bronsa: are you Nicola Mometto? |
| 16:55 | Bronsa | I am indeed |
| 16:57 | stuarthalloway_ | tools.reader boring work complete |
| 16:58 | Bronsa | thanks, now I only need to get ibdknox to declare he is ok to transfering to contrib and I should be good to go? |
| 17:00 | ljos | raek: That is true, but it was not the loading I was concerned with. It was more that the class path might be incorrect and the first word that popped into my mind was linking (and I don't even really do C :P). |
| 17:00 | ljos | That is what you get for not being born with english. :{ |
| 17:01 | stuarthalloway_ | @Bronsa: as far as I know, yes |
| 17:05 | Bronsa | stuarthalloway_: actually, I'd need commit rights too :P |
| 17:05 | stuarthalloway_ | @Bronsa, stand by |
| 17:05 | Bronsa | or will they be given me once ibdknox write the mail? |
| 17:05 | Bronsa | ok |
| 17:06 | stuarthalloway_ | contrib permissions are group, I just didn't know you weren't in the group |
| 17:07 | stuarthalloway_ | @Bronsa: done |
| 17:07 | Bronsa | thanks |
| 17:14 | benmoss | can anyone recommend a recent "intro to web development with clojure" guide? |
| 17:15 | gfredericks | So if that cemerick patch (for read-eval) gets merged in, what would that mean for data-readers? i.e., if print-dup isn't used for embedding objects in code, what is? |
| 17:20 | michaelr` | what is all the talk about read-eval? |
| 17:20 | michaelr` | any links? |
| 17:20 | ragge | does anyone have any experience with parsley, by cgrand? |
| 17:21 | maio | any idea how to bind some key only in nREPL REPL buffer? (and also not in Clojure buffer) |
| 17:22 | gfredericks | michaelr`: you've seen the jira issue? |
| 17:22 | ragge | maio: nrepl-mode-map? |
| 17:23 | cbp` | does korma not support multiple foreign keys? |
| 17:24 | maio | ragge: that seems to be also active in any Clojure buffer |
| 17:30 | geoffs | Does anyone have suggestions for good reading on testing with clojure? I've gone through a couple tutorials on midje and speclj but I still feel like I'm not "getting" it... |
| 17:31 | jondot | geoffs: is it something clojure related or testing related that you're not feeling comfortable with? |
| 17:32 | geoffs | specifically testing in clojure. I feel fairly confident doing testing in java, c etc. |
| 17:33 | stuarthalloway_ | geoffs: I would be interested in your reaction to https://github.com/Datomic/simulant |
| 17:33 | geoffs | I mean, I use the repl for little tests, but then capturing those into any of the testing frameworks I've seen isn't clicking |
| 17:34 | geoffs | stuarthalloway: I'll take a look at it, thanks! |
| 17:36 | jballanc | stuarthalloway_: maybe this is a stupid question, but is simulant intended to be a load-testing solution? or just behavior simulation? |
| 17:36 | stuarthalloway_ | an interesting question actually |
| 17:36 | stuarthalloway_ | you can use simulant for or in parallel to simulation testing |
| 17:37 | jballanc | I'll definitely be looking at it more... |
| 17:37 | stuarthalloway_ | e.g. we have created simulant models for loads, but we have also created loads outside of simulant, and run them against a system that was simultaneously being simulated |
| 17:38 | jballanc | very cool |
| 17:38 | Bronsa | stuarthalloway_: sorry to bother you again, but I think I need an account on hudson too |
| 17:39 | stuarthalloway_ | Bronsa: not sure I know how to do that, looking |
| 17:40 | Bronsa | ok, I'll ping the ml if it's a problem for you to do that |
| 17:40 | jondot | stuarthalloway_: more like a functional test infrastructure is it? something in the concept of FitNesse/StoryTeller? |
| 17:41 | stuarthalloway_ | I don't think non-technical users could use Simulant as they might use Fitnesse |
| 17:41 | stuarthalloway_ | although one might build a fitnesse-like layer on top of simulant |
| 17:41 | jondot | right, that's interesting. |
| 17:43 | jballanc | any thoughts on joining Simulant with CLJS to do browser-action modeling? |
| 17:43 | jballanc | ...along the lines of Selenium? |
| 17:44 | stuarthalloway_ | Simulant might use e.g. Selenium to implement actions |
| 17:45 | jballanc | have you tried using it for any "scientific" sorts of applications? or just system testing? |
| 17:45 | jballanc | i.e. it might be fun to use this in an itterated prisoner's dilema simulation |
| 17:50 | stuarthalloway_ | jballanc: in the future I will have copious free time and do scientific simulation stuff |
| 17:50 | stuarthalloway_ | but today, no |
| 17:50 | jballanc | :) |
| 17:51 | jballanc | my thesis research was evolutionary modeling, so these sorts of simulations are very interesting to me... |
| 17:51 | jballanc | been meaning to go back and rewrite some of that code, and this looks like it could be the perfect solution |
| 17:58 | geoffs | stuarthalloway_: It looks like simulant could actually replace the entire application I'm now building... Or at least provide a helpful framework to write it in. |
| 17:59 | stuarthalloway_ | nice! |
| 17:59 | geoffs | though it looks to have a not inconsiderable learning curve |
| 17:59 | stuarthalloway_ | agreed, not sure yet if that is intrinsic or I suck at explaining |
| 18:00 | geoffs | I think it's not helped by the fact that I've never worked with datomic, but I'd be willing to give feedback on the explanations as I run through them |
| 18:56 | gfredericks | ,((fn f [n] (apply + 1 (repeatedly (rand-int n) #(f n)))) 2) |
| 18:56 | clojurebot | 6 |
| 18:56 | gfredericks | ,((fn f [n] (apply + 1 (repeatedly (rand-int n) #(f n)))) 3) |
| 18:56 | clojurebot | 24 |
| 18:56 | gfredericks | ,((fn f [n] (apply + 1 (repeatedly (rand-int n) #(f n)))) 3) |
| 18:56 | clojurebot | 195 |
| 18:56 | callenbot | I want to provide a global context map in a Ring application, I'm thinking a dynamically bound var or a ref. Is the better approach to merge maps into the global ref or to assoc a dynamically bound var? |
| 18:57 | callenbot | Am I implicitly relying on the thread-per-request semantics of Ring+Jetty if I use a dynamically bound var for context? Will it break the moment I use Aleph? |
| 18:57 | gfredericks | callenbot: what behavior do you want when two threads are handling a request at the same time? |
| 18:58 | callenbot | gfredericks: two threads handling two different requests? |
| 18:58 | gfredericks | callenbot: yeah |
| 18:58 | callenbot | because when I talk about a ref, I mean a dynamically bound ref vs. dynamically bound map |
| 18:58 | weavejester | callenbot: A dynamically scoped binding would give you a variable that lasts for the duration of the request. |
| 18:58 | callenbot | gfredericks: I want per-request state isolation. |
| 18:58 | gfredericks | callenbot: so that would be a dynamically bound ref of a map? |
| 18:58 | callenbot | gfredericks: yeah, or a bare map |
| 18:58 | callenbot | weavejester: that's precisely what I want, but is that going to work in netty/aleph? |
| 18:59 | gfredericks | callenbot: I don't know what a thread-local ref is useful for |
| 18:59 | weavejester | callenbot: It depends on whether you pass the asynchronous channel to another thread. |
| 18:59 | weavejester | You'd have to do that explicitly |
| 18:59 | weavejester | For instance, by adding the channel to an atom |
| 18:59 | callenbot | fuck. I'll punt in netty/aleph for now until I understand the semantics better. |
| 19:00 | weavejester | And at the same time you could pass along the global context. |
| 19:00 | callenbot | dynamic var bound to map, merge provided context from render function on top of the current global context -> template context. |
| 19:00 | callenbot | the point of this is to not be kicking the arguments around all over the place |
| 19:00 | callenbot | particularly since keyword args in Clojure are pain incarnate. |
| 19:01 | callenbot | it sounds like a dynamically bound map that gets bound to an initial state is what I want. Maybe init'd with ring middleware. |
| 19:01 | weavejester | callenbot: Why are they painful? |
| 19:01 | callenbot | weavejester: it's awkward to use them. Python did it better, sadly. |
| 19:01 | callenbot | whenever I realize I need kwargs for something in clj I cringe really hard. |
| 19:02 | weavejester | callenbot: Are you referring to the problems with applying a map to a function? |
| 19:02 | gfredericks | (defmacro kw-fn [args & body] (list* 'fn {:keys args} body)) |
| 19:02 | gfredericks | (defmacro kw-fn [args & body] (list* 'fn ['& {:keys args}] body)) ;; whoops |
| 19:03 | weavejester | I wouldn't even bother with a macro, myself. |
| 19:03 | weavejester | (defn foo [{:keys [bar baz]}] …) |
| 19:04 | gfredericks | that's presumably what he thinks is awkward and cringeful |
| 19:04 | callenbot | yes |
| 19:04 | callenbot | weavejester: Pretty lightweight -> def fn(required_arg, kw_arg=default_value, kwarg_two=2) |
| 19:04 | weavejester | My problem with keyword args is that you can't apply a map. |
| 19:04 | gfredericks | ~mapply |
| 19:04 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 19:04 | weavejester | (apply foo {:bar 1 :baz 2}) => (apply foo [:bar 1] [:baz 2]) |
| 19:04 | callenbot | weavejester: also in Python: fn(400, **{"kw_arg":2}) |
| 19:05 | weavejester | So usually I just keep options as a map. |
| 19:05 | callenbot | * + args and ** + kwargs is a nice pattern. |
| 19:05 | weavejester | Well, it's true that Python's behaviour could be mimiced with a macro :) |
| 19:06 | callenbot | weavejester: I don't necessarily want to proliferate non-idiomatic code |
| 19:06 | callenbot | weavejester: and a global state that gets injected into templates is more to the point. |
| 19:06 | weavejester | Yes, although I get nervous around dynamic scope. |
| 19:06 | callenbot | weavejester: Flask seems to manage with g |
| 19:06 | weavejester | It's shorter to write, but less flexible. |
| 19:07 | weavejester | Well, sure, you can do it - but it's technically not as useful as lexical scope. Whatever the language. |
| 19:08 | callenbot | weavejester: well I need access to some kind of global request-lifecycle state that can be auto-included in template context so that I can {% if (logged_in (:user context)) %} in my templates. |
| 19:08 | callenbot | weavejester: and I am not going to kick around a context/options/user state manually between every view -> template flow. |
| 19:08 | weavejester | callenbot: Oh, I'm not saying you shouldn't do it. |
| 19:08 | callenbot | I use computers so that I can do less repetitious work, not more. |
| 19:09 | callenbot | weavejester: how could it bite me, outside of aleph? |
| 19:09 | weavejester | It's just one of those things, like macros, that should be used with caution. |
| 19:09 | callenbot | I'm cautiously impatient with kicking state around manually. |
| 19:09 | weavejester | callenbot: It won't bite you, I don't think. Unless you explicitly open up a new thread, you should be good. |
| 19:10 | weavejester | It's just harder to compose functions with dynamic scope. |
| 19:11 | weavejester | Effectively you're adding another variable to every function within the request |
| 19:11 | weavejester | Which is fine, but the more variables you have, the more things that can go wrong. |
| 19:12 | gfredericks | also laziness |
| 19:12 | weavejester | Laziness? |
| 19:12 | clojurebot | laziness means not traversing anything twice |
| 19:12 | seangrove | Anyone using carica with lein-cljsbuild? It doesn't seem to be picking up on the different config files |
| 19:12 | gfredericks | any unrealized lazy values returned get realized without the binding |
| 19:14 | gfredericks | is it fair to say that the only thing gained from the existence of &form is the symbol that referred to the current macro? |
| 19:23 | Brave | s |
| 19:24 | Brave | www.akran.net |
| 19:32 | augustl | Clojure/west ticket booked, gonna be good! |
| 19:32 | augustl | weavejester: did you find any good information about the XHR + CSRF token stuff? |
| 19:33 | weavejester | augustl: Oh, sorry, I haven't had time to look into it quite yet. |
| 19:33 | weavejester | augustl: Ring 1.2 should be released within a week or two, however, which should free up some time. |
| 19:36 | augustl | weavejester: I see, no probs |
| 19:36 | augustl | I'll see if I can find some information and post it to the pull req |
| 19:44 | callenbot | weavejester: thanks for the pointes |
| 19:44 | callenbot | pointers* |
| 19:44 | callenbot | gfredericks: you too |
| 19:45 | cbp` | mm i think korma should allow multiple relations between 2 tables or accept a vector of foreign keys |
| 19:55 | seangrove | Ah, had to `lein trampoline with-profile prod cljsbuild prod` |
| 20:00 | sshack | Anyone here got a java library with JNI component working with clojure/lein before? |
| 20:04 | augustl | sshack: yeah, I just did that a couple of days ago |
| 20:04 | augustl | sshack: I also blogged about it, perhaps you'll find it useful :) http://augustl.com/blog/2013/using_zeromq_from_clojure/ |
| 20:04 | sshack | Did you have any issues? I've got a vendor supplied Jar and JNI dylib for mathematica. It's having a problem finding the dynlib part. |
| 20:05 | sshack | This is clojuratica, fwiw. |
| 20:05 | sshack | Reading that now. |
| 20:05 | augustl | sshack: the method I outline works fine, the actual "reusable" part is -Djava.library.path |
| 20:06 | sshack | Is there a way I can add that to my leon project file? |
| 20:06 | sshack | s/leon/lein/ |
| 20:06 | augustl | see the blog post :) |
| 20:06 | sshack | It's loading. I got into swap here doing a db ingest... |
| 20:06 | sshack | Time for more memory. |
| 20:07 | augustl | hah |
| 20:07 | augustl | sshack: :jvm-opts ["-Djava.library.path=../jzmq-2.1.0-SNAPSHOT/lib"]} |
| 20:08 | augustl | I hardcode that into my project.clj, and assume that the jni module exists in ../ |
| 20:09 | sshack | Makes sense. |
| 20:09 | sshack | Wish there were an easier way though. |
| 20:10 | sshack | by easier, I mean, cleaner/more well defined. |
| 20:12 | sshack | Wait, what is :native-path? |
| 20:15 | arrdem | you guys know of an emacs plugin for HTML editing? |
| 20:16 | arrdem | M-tab doesn't seem to work on tags by default. |
| 20:16 | augustl | sshack: :native-path is for output or something like that, don't remember |
| 20:16 | augustl | sshack: technomancy said he wanted a cleaner way to do this than -Djava.library.path |
| 20:18 | augustl | I wonder if there's some Right Way via maven to work with JNI modules |
| 20:19 | augustl | with rubygems, for example, the gems with native extensions compile themselves upon install |
| 20:19 | sshack | I am wondering that too. complicating this is it's a vendor library. It's not something that could be added to some public maven repo. |
| 20:21 | augustl | sshack: that's the problem with the jzmq module, it can't be added to a shared repo |
| 20:21 | augustl | the .jar file you build also contain .c files and is related to the ZeroMQ installation on your box |
| 20:21 | augustl | so it has to be built for each machine |
| 20:21 | sshack | As soon as this import finishes, I'll play with this stuff. |
| 20:22 | augustl | sshack: I have 17 days uptime and still no page outs, lots of RAM ftw |
| 20:23 | sshack | Great. |
| 20:38 | casperc | Anyone know of a way to trace how long individual function calls take in eg a namespace? |
| 20:39 | casperc | something like what clojure,tools.trace does, but it doesn't seem to be able to trace time taken |
| 20:43 | warz | hrm, so maven has all of the required jars on my system already. is there a way to include that top level maven directory on the class path, and itll recursively look in there for dependencies? |
| 20:45 | tmciver | warz: if you're using lein, it should be using ~/.m2 already |
| 20:48 | warz | im building a plugin for use in a minecraft server, and everything needs to be available on the class path, if i dont build an uberjar. uberjars are fine i guess, though. |
| 20:48 | warz | just get a little large. |
| 21:51 | amalloy | gfredericks: &form also has metadata |
| 21:51 | gfredericks | amalloy: oh interesting; good point |
| 21:52 | amalloy | of particular importance, it has :line metadata |
| 21:53 | gfredericks | oh how did that get there? |
| 21:54 | gfredericks | looks like all lists have it at compile-time? |
| 21:54 | amalloy | yeah |
| 21:54 | gfredericks | ,(meta (read-string "(+ 1 2)")) |
| 21:54 | clojurebot | nil |
| 21:54 | gfredericks | I guess that means the normal reader is different from read-string |
| 22:08 | sshack | augustl: I got my JNI going. |
| 22:09 | sshack | :native-path didn't work, and I will investigate. |
| 22:10 | sshack | I ended up monkeying with the jvm-opts |
| 22:10 | sshack | :jvm-opts ["-Djava.library.path=/Applications/Mathematica.app/SystemFiles/Links/JLink/SystemFiles/Libraries/MacOSX-x86-64"] |
| 22:10 | sshack | Nast, put it works. I can factor an integer. |
| 22:17 | doc_brown | i am looking at some code ... im seeing after every defn a string describing the function followed by a newline and '[]' |
| 22:17 | doc_brown | whats up with the '[]' ? and the uncommented string ? |
| 22:17 | gfredericks | [] would be the argument list |
| 22:17 | gfredericks | so the function has no arguments |
| 22:17 | gfredericks | the string is a docstring, which is a feature of defn |
| 22:17 | doc_brown | ooh |
| 22:17 | doc_brown | gotcha |
| 22:18 | doc_brown | the new lines threw me off |
| 22:18 | gfredericks | the string gets added as metadata on the var, which can be useful for tooling; also see clojure.repl/doc, which prints out docstrings |
| 22:18 | doc_brown | kk |
| 22:18 | gfredericks | ,(doc first) |
| 22:18 | clojurebot | "([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil." |
| 22:18 | gfredericks | ^ that was trivial for clojurebot to do because the docstring is available at runtime |
| 22:19 | doc_brown | what was the comma for ? |
| 22:19 | gfredericks | to make clojurebot eval the expression |
| 22:19 | doc_brown | ah |
| 23:40 | doc_brown | and where does Thread come from? |
| 23:40 | doc_brown | i see a call to it with future ... (future (Thread/sleep 3000) ...) |
| 23:40 | doc_brown | is that in clojure.core ? |
| 23:42 | Sgeo | It's from Java |
| 23:42 | Sgeo | It's java.lang.Thread |
| 23:43 | Sgeo | sleep is a static method on java.lang.Thread. in Java it would be called similarly to Thread.sleep(3000) |
| 23:45 | doc_brown | ah ok |
| 23:46 | ChongLi | whoa, wait a minute doc. are you telling me that my mother has got the hots for me? |
| 23:49 | tmciver | You made a time machine . . . out of a Delorian? |
| 23:49 | ChongLi | whoa, this is heavy |
| 23:51 | tmciver | doc_brown: biff_tannen hangs out here once in a while. I hear that he kills you ove a matter of 80 dollars. |
| 23:55 | doc_brown | shot in the back? |
| 23:55 | doc_brown | over a matter of 80 dollars !? |