workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | We put Clojure 1.9.0 into production today. We've been on RC builds in production for a while so it was uneventful (as all of our Clojure version upgrades are!). | 2017-12-19T20:26:11.000029 | Daniell |
clojurians | clojure | Isn't it boring to be on an actual release though? :) | 2017-12-19T21:03:08.000166 | Rene |
clojurians | clojure | <https://clojuredocs.org/clojure.string/capitalize> <-- I can't believe there is a builtin function for this. | 2017-12-19T21:45:26.000219 | Berry |
clojurians | clojure | I'm already looking forward to 1.10-alpha1!!! :slightly_smiling_face: | 2017-12-19T21:50:45.000234 | Daniell |
clojurians | clojure | <@Berry> Even after seven years of Clojure, I still find new-to-me functions in the core namespaces :slightly_smiling_face: | 2017-12-19T21:52:07.000033 | Daniell |
clojurians | clojure | my jvm is crashing after some time developing. this is a mixed clojure+java projects and I'm using plugins like virgil (to reload java classes). I get the crash log but no core dump even though jvm said it wrote it (probably just need to change location). so.. first question, is this something that is more or less expected or a strong indication of a bug? | 2017-12-19T21:58:57.000190 | Douglass |
clojurians | clojure | asking because to me this seems suspiciously like the classic PermGen OoM error with plain Java but could also be just my previous experiences. I'm on 1.8 java, the mem consumption doesn't look too bad to the OS but I haven't visualvm'd this yet. I'm new to Clojure but know my java, so I'm not sure whether I should stress out about it at this point or not. This is not in production yet but I really wouldn't like to find out at that time | 2017-12-19T22:08:00.000273 | Douglass |
clojurians | clojure | clojure.string/capitalize is a very strange thing to have in Clojure, I agree. It also has a subtle bug. (Hint: Java strings, and thus Clojure strings, are represented in memory encoded as UTF-16) | 2017-12-19T22:32:12.000030 | Micha |
clojurians | clojure | but such corner cases of Unicode are best left for more comprehensive libraries like ICU4J | 2017-12-19T22:34:40.000128 | Micha |
clojurians | clojure | Sounds very unusual to me, but I don't use Virgil so it may be an issue with that. | 2017-12-19T22:47:52.000027 | Daniell |
clojurians | clojure | I've been doing Clojure for over seven years and my experience -- both of the REPL when developing locally and of Clojure in heavy production use -- is that it's rock solid. | 2017-12-19T22:49:22.000011 | Daniell |
clojurians | clojure | really hope that DL4Clj could be updated more efficiently. | 2017-12-19T23:33:55.000083 | Barrie |
clojurians | clojure | <https://github.com/hswick/jutsu.ai> | 2017-12-20T03:43:38.000203 | Katharyn |
clojurians | clojure | is there something that makes the stack traces a bit more human readable? using vanilla `lein run` at the moment
at least something that highlights the stack lines which are in my code, as opposed to clojure.lang... | 2017-12-20T03:55:14.000453 | Elizbeth |
clojurians | clojure | Not sure if Ultra does exactly that, but you could give it a go: <https://github.com/venantius/ultra> | 2017-12-20T05:36:02.000308 | Elijah |
clojurians | clojure | It's good indeed
<https://camo.githubusercontent.com/c7aa908e62bbcebfba552b9137fefcaf4fa9cfc3/68747470733a2f2f76656e616e746975732e6769746875622e696f2f756c7472612f696d616765732f636f6c6f72697a65642d746573742d737461636b74726163652e706e67> | 2017-12-20T06:26:59.000145 | Heriberto |
clojurians | clojure | Also <https://clojure-expectations.github.io> could help with test stacktraces. | 2017-12-20T06:33:31.000157 | Heriberto |
clojurians | clojure | I'm translating this to Clojure. Is there a amore idiomatic way instead of converting the while loop into a loop-recur?
```
;; private static byte[] toByteArray(InputStream inputStream)
;; throws IOException
;; {
;; ByteArrayOutputStream baos = new ByteArrayOutputStream();
;; byte buffer[] = new byte[8192];
;; while (true)
;; {
;; int read = inputStream.read(buffer);
;; if (read == -1)
;; {
;; break;
;; }
;; baos.write(buffer, 0, read);
;; }
;; return baos.toByteArray();
;; }
```
It's fine to get either a byteArray or a string as output -- this data won't be too large -- it's the error msg (or stdout) of a very simple process). | 2017-12-20T07:26:43.000282 | Berry |
clojurians | clojure | <@Berry>
```
(do
(... read ...)
(while (not= read -1)
( ... write ...)
(... read ...))
(.toByteArray baos))
``` | 2017-12-20T07:30:00.000257 | Heriberto |
clojurians | clojure | I don't think there's `do-while` in Clojure. | 2017-12-20T07:31:06.000204 | Heriberto |
clojurians | clojure | ```(doseq [r (take-while #(not= -1 %) (repeatedly #(.read is buff)))] (.write baos buffer 0 r))``` | 2017-12-20T07:33:00.000098 | Kareen |
clojurians | clojure | according to <https://clojuredocs.org/clojure.core/slurp> , slurp takes IhnputStream as an argument too | 2017-12-20T07:33:01.000371 | Berry |
clojurians | clojure | so that whole thing should be reduced to slurp | 2017-12-20T07:33:10.000158 | Berry |
clojurians | clojure | something like this if you want, or slurp if it's good eno- ^ | 2017-12-20T07:33:24.000001 | Kareen |
clojurians | clojure | (last part of question says "either a byteArray or a string as output") | 2017-12-20T07:33:26.000301 | Berry |
clojurians | clojure | yeah, the `java whiles` really do not translate well to idiomatic clojure | 2017-12-20T07:33:53.000240 | Berry |
clojurians | clojure | slurp worked | 2017-12-20T07:35:51.000378 | Berry |
clojurians | clojure | a quick question. This to me was perhaps not what I expected:
```
((every-pred =) 1 2)
=> true
```
I assume this is caused by the fact that `(= 1) => true` and that `every-pred` applies every predicate to one argument at a time, is there anything in clojure core that would do this but apply all arguments to the predicates | 2017-12-20T11:12:07.000807 | Joette |
clojurians | clojure | the docs for `every-pred` are not entirely conclusive here:
> Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false.
, but I guess I can see why it's implemented this way | 2017-12-20T11:13:42.000470 | Joette |
clojurians | clojure | <@Joette> probably you’d need to use ```(every? (every-pred pos? (partial > 0)) '(1 2 3 -1))``` | 2017-12-20T11:34:49.000338 | Tameka |
clojurians | clojure | or `not-every?` | 2017-12-20T11:35:26.000545 | Tameka |
clojurians | clojure | depends what you’re trying to achieve | 2017-12-20T11:35:33.000637 | Tameka |
clojurians | clojure | oh I see what you mean | 2017-12-20T11:36:28.000498 | Tameka |
clojurians | clojure | nvm the above :smile: | 2017-12-20T11:36:51.000159 | Tameka |
clojurians | clojure | Hey, so I know the Clojure philosophy is, wrt errors and stack traces, barf everything and let the tools sort it out. Is there a REPL tool to sort it out? Something usable with `lein repl`? | 2017-12-20T11:39:40.000771 | Detra |
clojurians | clojure | <@Detra> you mean something to make stacktrace and error more human friendly ? | 2017-12-20T11:51:35.000486 | Jami |
clojurians | clojure | Yes | 2017-12-20T11:52:04.000623 | Detra |
clojurians | clojure | I have stack traces that contain prn-str data (from pedestal) that exceed my 5000 line scrollback. | 2017-12-20T11:52:54.000297 | Detra |
clojurians | clojure | you can use <https://github.com/AvisoNovate/pretty> | 2017-12-20T11:53:23.000078 | Jami |
clojurians | clojure | (different question) do you know if Clojure support as many characters for keywords as for strings ? | 2017-12-20T11:55:03.000566 | Jami |
clojurians | clojure | I need to handle JSON documents, and the library is converting each JSON key to a keyword instead of a string | 2017-12-20T11:55:40.000554 | Jami |
clojurians | clojure | I'm worried that some characters will not be handled well as keywords | 2017-12-20T11:56:21.000609 | Jami |
clojurians | clojure | If you pr-str/read-string it, this will definitely cause problems. I'm pretty sure that `keyword` does not validate the contents of the namespace or name, and they are stored as Java `String`. | 2017-12-20T11:57:55.000348 | Detra |
clojurians | clojure | <@Jami> Hmm. It might not deal with the crazy amount of data in `ex-info` but this seems nice. Also `ultra` which uses it seems pretty useful. | 2017-12-20T12:01:36.000158 | Detra |
clojurians | clojure | Keywords are made of strings. If you are programatically creating and using them you should be fine | 2017-12-20T12:27:49.000495 | Sonny |
clojurians | clojure | But don’t expect to be necessarily be able to print and read as data | 2017-12-20T12:28:25.000103 | Sonny |
clojurians | clojure | Also keep in mind that keywords are interned so there are memory effects if using a large number of arbitrary keywords | 2017-12-20T12:29:08.000834 | Sonny |
clojurians | clojure | it’s entirely valid (IMHO preferable) to just tell the json library not to keywordize - both clojure.data.json and cheshire let you choose, and almost everything else is using one of those | 2017-12-20T12:45:02.000530 | Margaret |
clojurians | clojure | our codebase has a bunch of nonsense for handling numbers that got turned to strings when they were keys in json, then turned into keywords when retrieved from the json… huge headache | 2017-12-20T12:46:07.000593 | Margaret |
clojurians | clojure | we haven't really had any issues like that, and we tend to keywordize pretty often | 2017-12-20T12:59:20.000346 | Ambrose |
clojurians | clojure | not everywhere, though, have to do it judiciously | 2017-12-20T13:00:00.000277 | Ambrose |
clojurians | clojure | <@Ambrose> yeah the problem was that the people integrating monger (the clojure mongodb wrapper) didn’t realize keywordizing was optional, and didn’t sanitize the data to make sense for mongo insertion (eg. avoiding numeric keys), and by the time it was pointed out that we had other options the inconsistency of number / string / keyword in the data keys was baked into all the code consuming the data | 2017-12-20T13:11:44.000132 | Margaret |
clojurians | clojure | ah | 2017-12-20T13:21:36.000245 | Ambrose |
clojurians | clojure | yeah, only way to avoid situations like that is mandating thorough code review from more experienced people | 2017-12-20T13:22:20.000348 | Ambrose |
clojurians | clojure | which can be hard to do if most people on the team are still somewhat unfamiliar with clojure and/or its libraries' conventions | 2017-12-20T13:22:45.000398 | Ambrose |
clojurians | clojure | right, a few iffy decisions made in the beginning (“move fast and break things!“) then years of pain | 2017-12-20T13:26:32.000566 | Margaret |
clojurians | clojure | even experience people often get really annoyed when keys aren't keywords and write elaborate mapping layers | 2017-12-20T13:26:36.000126 | Rebeca |
clojurians | clojure | it drives me nuts | 2017-12-20T13:26:48.000396 | Rebeca |
clojurians | clojure | (the mapping layers) | 2017-12-20T13:26:55.000500 | Rebeca |
clojurians | clojure | yeah - it’s a weird thing that causes so much bs | 2017-12-20T13:26:56.000329 | Margaret |
clojurians | clojure | it's probably because you can't use `(keyname map)` syntax to get values when `keyname` isn't keyword. | 2017-12-20T13:28:32.000511 | Heriberto |
clojurians | clojure | Clojure encourages keywording | 2017-12-20T13:28:48.000724 | Heriberto |
clojurians | clojure | `get` is only 3 chars | 2017-12-20T13:30:22.000238 | Kareen |
clojurians | clojure | Honestly, keywordizing user input is one of the biggest time sinks in the clojure community. | 2017-12-20T13:30:37.000101 | Ferdinand |
clojurians | clojure | and the benefits of not having to convert from/to keywords are way more than saving 3 characters | 2017-12-20T13:30:39.000631 | Kareen |
clojurians | clojure | ^^ | 2017-12-20T13:30:41.000306 | Ferdinand |
clojurians | clojure | <@Heriberto> I would be quite upset if I saw `(:1234 foo)` in my codebase, those keywords existed because nobody realized how easy it would be to not create them | 2017-12-20T13:30:43.000491 | Margaret |
clojurians | clojure | not even considering that you can still do `(my-map "my-key")` | 2017-12-20T13:31:10.000238 | Kareen |
clojurians | clojure | not a big fan of using maps as functions, personally, have to do a double-take to realize that it's a map and not a function defined elsewhere | 2017-12-20T13:36:14.000245 | Ambrose |
clojurians | clojure | The only thing I find a little confusing in this situation is that the external keys may come in via strings - and you leave them that way, but internally you probably have maps you make with keywords (in clj-land). so now you have both and that can get awkward or error prone | 2017-12-20T13:36:24.000184 | Petronila |
clojurians | clojure | However, it typically is ok. You just sort of have to make those boundaries clear | 2017-12-20T13:36:38.000149 | Petronila |
clojurians | clojure | <@Ambrose> but the nice thing is you can swap it out later for a function with no change to the code | 2017-12-20T13:37:02.000167 | Sandy |
clojurians | clojure | <@Petronila> if the key comes in via user input, I prefer to make the key a string | 2017-12-20T13:37:06.000372 | Margaret |
clojurians | clojure | and for reasons that should be obvious, I don’t use the same data structure to look up based on user input and compiled code | 2017-12-20T13:37:50.000459 | Margaret |
clojurians | clojure | I mean, lisps are about arbitrary code at runtime and all but I like to pretend I’m not absolutely bonkers | 2017-12-20T13:38:18.000237 | Margaret |
clojurians | clojure | is there a lot of expressive power gained from the whole IFn thing where keywords and collections can be in function position? as a newb I was totally surprised the first time I saw that, and I’m not 100% sold that the terseness is actually better for readability (echoing <@Kareen>’s statement that get is only 3 chars). but maybe it is nice to have once you get used to it? | 2017-12-20T13:38:27.000312 | Thu |
clojurians | clojure | @justinlee it’s often that I discover some function that I wrote can be replaced by a simple hash-map, and since hash maps are much less powerful than functions it’s always a win to do that substitution | 2017-12-20T13:39:25.000513 | Margaret |
clojurians | clojure | that’s a refactor that would be impossible if hash-maps didn’t implement IFn | 2017-12-20T13:39:40.000435 | Margaret |
clojurians | clojure | <@Thu> it really is convenient, esp when you can use them HOF (e.g. `(map :foo my-coll)`), but it's also really important to know when reaching for that conveniency causes unnecessary performance issues or having to handle conversions down the line | 2017-12-20T13:40:07.000266 | Kareen |
clojurians | clojure | Seem like it could come in handy in threading macros too. Random thought. | 2017-12-20T13:40:27.000549 | Merri |
clojurians | clojure | right -it can make chained data access in nested data much cleaner | 2017-12-20T13:40:59.000117 | Margaret |
clojurians | clojure | <@Merri> but similarly to what I was saying about not using the same data for user input lookup and program lookup, I also don’t tend to write code such that user input comes in deeply nested, and yes I would absolutely use keywords for program created nested data structures | 2017-12-20T13:42:38.000208 | Margaret |
clojurians | clojure | and this doesn’t run into the problems with keyword/ string cross conversion we were discussing | 2017-12-20T13:42:59.000387 | Margaret |
clojurians | clojure | ¥es indeed. When first starting with clojure I spent lots of time converting everything to keywords since it “looks prettier”. Esp with JSON there are dark corners to get caught in like you mentioned. | 2017-12-20T13:45:17.000173 | Merri |
clojurians | clojure | also I can’t recommend transit enough if you need to write data to json (or external storage in general) in one place and then read it from another | 2017-12-20T13:46:04.000032 | Margaret |
clojurians | clojure | if I was remaking our app all the mongo insertions would be small json maps, with the indexed keys at the top, then a larger transit encoded payload under one key with the actual original clojure data embedded | 2017-12-20T13:46:53.000564 | Margaret |
clojurians | clojure | come to think of it I should make a small library that implements that pattern | 2017-12-20T13:47:22.000461 | Margaret |
clojurians | clojure | are you sure you would still use mongo :stuck_out_tongue: | 2017-12-20T13:48:43.000431 | Rebeca |
clojurians | clojure | <@Rebeca> heh there’s some out of band / external stuff behind that but fair point | 2017-12-20T13:49:34.000606 | Margaret |
clojurians | clojure | its been my experience that even with a "greenfield" project datastore choice is almost always dictated to you | 2017-12-20T13:51:51.000357 | Rebeca |
clojurians | clojure | glad to know it’s not just me | 2017-12-20T13:52:10.000415 | Margaret |
clojurians | clojure | in some ways it seems like validation of one of the core propositions of clojure, data is more important than programs | 2017-12-20T13:53:37.000094 | Rebeca |
clojurians | clojure | >wishes he’d never gotten excited about MongoDB all those years ago...
Me, 3 1/2 years ago: “Ah we’ll never get funding, I’ll make the app in Swift.” (Narrator: they did) | 2017-12-20T14:56:51.000363 | Williemae |
clojurians | clojure | I'm trying to rewrite:
```
Pointer kernelParameters = <http://Pointer.to|Pointer.to>(
<http://Pointer.to|Pointer.to>(new int[]{numElements}),
<http://Pointer.to|Pointer.to>(deviceInputA),
<http://Pointer.to|Pointer.to>(deviceInputB),
<http://Pointer.to|Pointer.to>(deviceOutput)
);
```
as
```
kparam (Pointer/to
(Pointer/to (int-array [numE]))
(Pointer/to devA)
(Pointer/to devB)
(Pointer/to devOut))
```
but I'm getting a "no matching method: to" on the first "Pointer/to" line -- this is despite I already have an `(:import [jcuda Pointer])` | 2017-12-20T16:12:45.000265 | Berry |
clojurians | clojure | I need some way to make a call tothis function:
<http://www.jcuda.org/jcuda/doc/jcuda/Pointer.html#to(jcuda.NativePointerObject...)> | 2017-12-20T16:13:54.000044 | Berry |
clojurians | clojure | is Pointer/to varargs? EDIT - yes, it is, and that means you need to put all the variable args into an array | 2017-12-20T16:16:01.000231 | Margaret |
clojurians | clojure | <@Berry> `<https://stackoverflow.com/questions/11702184/how-to-handle-java-variable-length-arguments-in-clojure>` | 2017-12-20T16:16:30.000424 | Randee |
clojurians | clojure | wow, that’s a lot of calls to into-array, if I were doing this I’d make a function that constructs the varargs and calls the method (or maybe a macro) | 2017-12-20T16:17:24.000041 | Margaret |
clojurians | clojure | <@Randee>: thanks! <@Margaret>: yeah, agreed, this is "1. make it work; 2. make it pretty" ; I'm currently on step 1 | 2017-12-20T16:20:50.000155 | Berry |
clojurians | clojure | I'm expecting:
```
devA (CUdeviceptr.)
_ (Pointer/to (to-array [devA]))
```
to work, but it's telling me "NO matching method Found to" | 2017-12-20T16:25:24.000278 | Berry |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.