workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | <https://github.com/leonoel/task> | 2017-11-20T12:19:19.000507 | Lovie |
clojurians | clojure | <@Berry> core.cache has these sorts of things <https://github.com/clojure/core.cache> - it’s very flexible but not as easy to use as memoize | 2017-11-20T12:56:49.000411 | Margaret |
clojurians | clojure | the key thing for me that made core.cache “click” is that nothing in core.cache knows or cares how your mutable storage is implemented - it has a bunch of functions that accept an immutable hash map, and return an immutable hash-map, and it’s your job to figure out what to do with that hash-map in your app | 2017-11-20T12:57:36.000249 | Margaret |
clojurians | clojure | compare to memoize, which implicitly uses an atom holding an immutable hash-map that you never touch directly | 2017-11-20T12:57:52.000537 | Margaret |
clojurians | clojure | oh, sadly core.cache isn’t cljs compatible- I wonder what else is out there | 2017-11-20T12:59:33.000272 | Margaret |
clojurians | clojure | that was it, thanks <@Lovie> | 2017-11-20T13:13:08.000355 | Guillermo |
clojurians | clojure | How can I run `lein` in verbose mode and see the source paths that are used | 2017-11-20T13:55:12.000236 | Jayne |
clojurians | clojure | I have set source path in `:dev` profile | 2017-11-20T13:55:48.000427 | Jayne |
clojurians | clojure | `:source-paths ["dev/src/clj" "dev/resources" "test/resources"]` | 2017-11-20T13:56:09.000353 | Jayne |
clojurians | clojure | <@Jayne> One option: run `(clojure.java.classpath/classpath-directories)` in your repl | 2017-11-20T13:56:34.000441 | Randee |
clojurians | clojure | my main file is not able to find other files in source paths | 2017-11-20T13:57:12.000545 | Jayne |
clojurians | clojure | <@Jayne> if you look at the classpath in the running repl, all your source directories need to be on the class path (and the namespace needs to form a path starting at a classpath entry matching the namespace name) | 2017-11-20T14:00:03.000248 | Margaret |
clojurians | clojure | ```(System/getProperty "java.class.path")``` | 2017-11-20T14:00:31.000782 | Margaret |
clojurians | clojure | a “source path” is a leaky leiningen abstraction, all clojure itself cares about is the classpath | 2017-11-20T14:02:24.000363 | Margaret |
clojurians | clojure | <@Margaret> I do see the directory in class path | 2017-11-20T14:02:29.000539 | Jayne |
clojurians | clojure | but I get file not found | 2017-11-20T14:02:46.000278 | Jayne |
clojurians | clojure | when I do `lein uberjar` | 2017-11-20T14:02:53.000353 | Jayne |
clojurians | clojure | then the path to your file does not match the namespace, or it failed to load for some other reason and you misunderstood the error | 2017-11-20T14:02:56.000345 | Margaret |
clojurians | clojure | `Exception in thread "main" java.io.FileNotFoundException: Could not locate ****/system__init.class or ****/system.clj on classpath., compiling:(server.clj:1:1)` | 2017-11-20T14:03:45.000496 | Jayne |
clojurians | clojure | well, the part where the problem is would be in the **** somewhere - double check that `-` is translated to `_` and that the file path from the classpath root matches the full namespace | 2017-11-20T14:04:53.000712 | Margaret |
clojurians | clojure | **** is just a single word | 2017-11-20T14:05:33.000723 | Jayne |
clojurians | clojure | name of our project | 2017-11-20T14:05:39.000392 | Jayne |
clojurians | clojure | without any `-` or `_` | 2017-11-20T14:06:03.000516 | Jayne |
clojurians | clojure | and you have a /****/system.clj on the classpath during uberjar creation? | 2017-11-20T14:06:16.000474 | Margaret |
clojurians | clojure | How can I check the classpath while uberjar ? | 2017-11-20T14:06:55.000622 | Jayne |
clojurians | clojure | ```lein with-profile uberjar cp``` | 2017-11-20T14:07:39.000482 | Margaret |
clojurians | clojure | yeah <@Margaret> its not there | 2017-11-20T14:09:00.000134 | Jayne |
clojurians | clojure | Its in dev profile | 2017-11-20T14:09:08.000223 | Jayne |
clojurians | clojure | dev profile is for things you only use in dev | 2017-11-20T14:09:18.000151 | Margaret |
clojurians | clojure | and isn’t dev profile loaded by default ? | 2017-11-20T14:09:19.000185 | Jayne |
clojurians | clojure | no | 2017-11-20T14:09:22.000169 | Margaret |
clojurians | clojure | `lein with-profile dev uberjar` | 2017-11-20T14:09:40.000124 | Jayne |
clojurians | clojure | it’s specifically for things you want during dev but not while making an artifact | 2017-11-20T14:09:40.000417 | Margaret |
clojurians | clojure | should this work ? | 2017-11-20T14:09:47.000154 | Jayne |
clojurians | clojure | don’t do that! if you need the source files in your uberjar, put them in the normal source paths, don’t put them in dev | 2017-11-20T14:10:05.000728 | Margaret |
clojurians | clojure | if you add the dev profile to your uberjar command, you also pull in things that are only needed during dev (especially a risk with tools like cider that add to your dev profile) | 2017-11-20T14:10:40.000230 | Margaret |
clojurians | clojure | it would also mean your test files would end up in the jar - not usually what people want | 2017-11-20T14:11:01.000158 | Margaret |
clojurians | clojure | Thanks <@Margaret> I was stuck on it for some time. Didnt know how to check class path. | 2017-11-20T14:17:18.000592 | Jayne |
clojurians | clojure | Can you please explain this command ```lein with-profile uberjar cp``` in one line | 2017-11-20T14:17:37.000386 | Jayne |
clojurians | clojure | it says “use the uberjar configuration, and run the cp command” | 2017-11-20T14:18:07.000117 | Margaret |
clojurians | clojure | “lein cp” would run lein with the default profile and show the classpath | 2017-11-20T14:18:24.000188 | Margaret |
clojurians | clojure | you can also use `lein with-profile +foo ...` to merge rather than replace profiles | 2017-11-20T14:18:55.000398 | Margaret |
clojurians | clojure | okay so `:uberjar` it self is a profile | 2017-11-20T14:19:22.000121 | Jayne |
clojurians | clojure | ? | 2017-11-20T14:19:23.000021 | Jayne |
clojurians | clojure | one that comes as default with lein ? | 2017-11-20T14:19:42.000285 | Jayne |
clojurians | clojure | uberjar is a profile, yes - you can see a lot more example and info in the output of `lein help sample` | 2017-11-20T14:19:45.000181 | Margaret |
clojurians | clojure | Thanks <@Margaret>. | 2017-11-20T14:20:02.000549 | Jayne |
clojurians | clojure | any recommendations of mocking libraries ?? | 2017-11-20T14:43:11.000619 | Anneliese |
clojurians | clojure | clojure folks tend to avoid mocking | 2017-11-20T14:47:44.000562 | Guillermo |
clojurians | clojure | depends on the features you need, but we (CircleCI) use <https://github.com/circleci/bond> | 2017-11-20T14:48:14.000481 | Mia |
clojurians | clojure | I have had good success in the past with making protocols that represent external side-effects (e.g. a mail server) and then reifying dummy impls. | 2017-11-20T14:49:01.000372 | Guillermo |
clojurians | clojure | very simple and light | 2017-11-20T14:49:04.000018 | Mia |
clojurians | clojure | <@Guillermo> but how can i test a function that depends on another one that calls external systems or has side effect | 2017-11-20T14:49:08.000536 | Anneliese |
clojurians | clojure | <@Guillermo> I got your point | 2017-11-20T14:49:35.000137 | Anneliese |
clojurians | clojure | if you feel the need to mock, you might have a global that needs to be an argument. | 2017-11-20T14:49:44.000651 | Guillermo |
clojurians | clojure | ^^ that’s an awesome way to think about it | 2017-11-20T14:50:10.000319 | Mia |
clojurians | clojure | (I'm speaking in vast generalities) | 2017-11-20T14:50:12.000614 | Guillermo |
clojurians | clojure | ideally the external functionality has a thin wrapper that you can easily cover with integration tests, and you can pass in an alternate stub implementation for testing things that use it | 2017-11-20T14:50:15.000405 | Margaret |
clojurians | clojure | (I think this expands on what ghadi was saying) | 2017-11-20T14:50:27.000175 | Margaret |
clojurians | clojure | sometimes it’s even worth making a protocol, in order to have two implementations (the stub and the one that uses some external / stateful / side effecting resource) | 2017-11-20T14:51:28.000375 | Margaret |
clojurians | clojure | If you're using Ring or similar, you can make a middleware that inserts the appropriate implementation into the request context, that way you don't have to grab it from a global var | 2017-11-20T14:52:59.000583 | Guillermo |
clojurians | clojure | <@Margaret> <@Guillermo> I got the point but I really don't know why we should avoid mocks? aren't they easier than stubing protocols? | 2017-11-20T14:54:07.000467 | Anneliese |
clojurians | clojure | they lead to unneeded complexity, you end up wrangling an implicit global state in order to verify something that shouldn’t care about it | 2017-11-20T14:54:53.000484 | Margaret |
clojurians | clojure | with-redefs for example causes a multitude of problems, including preventing parallel testing | 2017-11-20T14:55:15.000675 | Margaret |
clojurians | clojure | if you really want the easier / global / implicit thing, at least implement it in terms of something that uses an explicit argument to the function - you can easily build implicit / global / stateful out of explicit immutable arguments, but it is much harder to go the other way | 2017-11-20T14:56:25.000530 | Margaret |
clojurians | clojure | valid point but this will add too many types and records which i try to avoid most of the time | 2017-11-20T14:57:24.000054 | Anneliese |
clojurians | clojure | you can do it without a protocol or record - I only mention using a protocol (which in my practice means using a reify in the test, and either a record or reify in the implementation) - because that can simplify the swapping of implementations | 2017-11-20T14:58:38.000324 | Margaret |
clojurians | clojure | if you prefer functions, use functions, it does work | 2017-11-20T14:58:49.000176 | Margaret |
clojurians | clojure | <@Margaret> thnx | 2017-11-20T15:00:34.000385 | Anneliese |
clojurians | clojure | Standard environment. Yeah, it takes a little bit, but it's a lot easier now that there are no restrictions on what classes to use. Let me know if you have specific questions and if there's interest, I might publish it as a lein plugin. | 2017-11-20T15:06:12.000158 | Ed |
clojurians | clojure | are there any known gotchas involving partial application around a `stest/instrument`ed function ? | 2017-11-20T15:23:19.000251 | Edward |
clojurians | clojure | I get this error
`Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method, or the namespace has not been AOT-compiled.` | 2017-11-20T15:45:25.000327 | Jayne |
clojurians | clojure | you can run an uberjar without AOT if you can specify the java command line: `java -cp my-uber.jar clojure.main -m my.ns` | 2017-11-20T15:47:32.000093 | Margaret |
clojurians | clojure | if you need the jar to be startable or loaded by some other java process, you probably need aot though | 2017-11-20T15:47:53.000064 | Margaret |
clojurians | clojure | Thanks <@Margaret>. I was missing `(:gen-class)` | 2017-11-20T15:53:19.000100 | Jayne |
clojurians | clojure | in the main file | 2017-11-20T15:53:22.000196 | Jayne |
clojurians | clojure | I have a `wrap-auth` fn in compojure-api, and an endpoint where I'd like it to be conditionally applied
contingent on a query parameter
is that possible? | 2017-11-20T16:33:22.000631 | Lori |
clojurians | clojure | ex, either they're authenticated, or a query param has a valid signature (in which case, non-authd is fine) | 2017-11-20T16:34:00.000193 | Lori |
clojurians | clojure | yes, you can make a middleware that either returns the handler unchanged, or applies a middleware, based on some property of the request-map | 2017-11-20T16:51:15.000409 | Margaret |
clojurians | clojure | something like `(defn conditional-middleware [pred? middleware handler] (fn [request] (if (pred? request) ((middleware handler) request) (handler request))))` | 2017-11-20T16:52:22.000176 | Margaret |
clojurians | clojure | if you don’t like `((` you can use let to bind the wrapped handler | 2017-11-20T16:52:43.000473 | Margaret |
clojurians | clojure | oh nice, I think that'll work thank you! | 2017-11-20T16:53:00.000509 | Lori |
clojurians | clojure | the devilish thing with ring is it’s very flexible and things like this are easy to apply, but it can be very hard to debug when you have enough wrappers like this - my theory is that pedestal interceptors are an improvement as they are data you can investigate on the fly but haven’t used them in anger | 2017-11-20T16:54:20.000446 | Margaret |
clojurians | clojure | I'm in the same camp, anytime I can convert "effects" to data, it tends to be a win | 2017-11-20T16:57:46.000109 | Lori |
clojurians | clojure | Ring is also rather anti-async, you can bolt-in async stuff, but it doesn't work super well. | 2017-11-20T17:11:35.000027 | Sandy |
clojurians | clojure | from r/Clojure/ :slightly_smiling_face: | 2017-11-20T17:40:56.000206 | Lovie |
clojurians | clojure | relatedly, I have a `:path-param` that I'm trying to pull off the `request` in my `wrap`per
but the best I can find on there is `:path-info` which has my route un-parsed
is there place I can get a parsed `:path-param`, eg for `myroute/:x`, `(get-in request [:path-params??? :x)` | 2017-11-20T18:10:51.000424 | Lori |
clojurians | clojure | basically "no" | 2017-11-20T18:24:34.000059 | Rebeca |
clojurians | clojure | longer answer is it depends on which library you using for routing | 2017-11-20T18:24:57.000078 | Rebeca |
clojurians | clojure | even longer is it depends on which library you use for routing and if you use it to do routing before or after your middleware is run | 2017-11-20T18:25:58.000231 | Rebeca |
clojurians | clojure | Using bidi and yada you can get this, I suspect bidi with Ring would get you most of the way there too. If I understand the question correctly | 2017-11-20T19:00:05.000018 | Shira |
clojurians | clojure | G’day all. Is the closure.algo.generic really the only standard-ish library fmap? That’s astounding! Is there a transducer for it? I like the look of <@Eunice> but might be a bit much stuff for all I need (at the moment)... mind you I’ll probably use ap and lift soon enough. | 2017-11-21T04:51:06.000021 | Pattie |
clojurians | clojure | Here's a preview of the latest setup I'm working with. Main draw back at the moment is no nrepl support, but using a socket repl. Definitely a couple of other rough edges, but thought I'll share. For anyone else interested, feel free to reach out. <https://gist.github.com/alpeware/f18bef80cb521347d22b85f1ad07ada7> | 2017-11-21T04:53:48.000328 | Ed |
clojurians | clojure | <@Pattie> by fmap you mean monads? Then yes, monad usage is quite rare in Clojure except when no other approach will work (for example in test.check). | 2017-11-21T08:41:07.000464 | Sandy |
clojurians | clojure | In general Clojure tends to drive abstractions with data, and data interpreters/compilers instead of directly with functional composition. | 2017-11-21T08:41:57.000613 | Sandy |
clojurians | clojure | hey all. I’ve got a function that provides me with a list of all the possible combinations of values from two lists:
```
(defn all-combinations
"Return all possible combinations of values from as and bs collections."
[as bs] (apply concat (for [a as] (for [b bs] [a b]))))
``` | 2017-11-21T09:17:45.000635 | Timmy |
clojurians | clojure | I’d like to do this to a list of lists rather than just a pair of lists. | 2017-11-21T09:18:26.000286 | Timmy |
clojurians | clojure | Has anyone got any hints for doing so neatly? | 2017-11-21T09:18:37.000191 | Timmy |
clojurians | clojure | <@Timmy> Perhaps <https://github.com/clojure/math.combinatorics> | 2017-11-21T09:26:27.000160 | Adrien |
clojurians | clojure | Thanks <@Adrien> cartesian-product looks just the job | 2017-11-21T09:27:03.000394 | Timmy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.