workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | `(sequence (comp (xflog) (filter odd?) (map inc)) (range 5))` | 2017-12-14T09:26:16.000456 | Jami |
clojurians | clojure | it works as expected, but you could extend it to include a tag (e.g. "before filter odd?") | 2017-12-14T09:26:46.000765 | Jami |
clojurians | clojure | Who did say anything about running stuff explicitly in browser? o_O | 2017-12-14T09:46:00.000736 | Cecilia |
clojurians | clojure | This is <#C03S1KBA2|clojure> not <#C03S1L9DN|clojurescript> | 2017-12-14T09:46:16.000399 | Cecilia |
clojurians | clojure | Do it with a socket repl and it'd be pretty easy | 2017-12-14T09:47:06.000094 | Sandy |
clojurians | clojure | and besides, CUDA was specifically mentioned as a potential target | 2017-12-14T09:49:03.000879 | Cecilia |
clojurians | clojure | <@Kalyn> Or use the debug atom trick. Something like
```
(defonce a (atom []))
(def dbg-xf (map (fn [x] (swap! a conj x) x)))
(comment
;; The atom now contains every value that passed through dbg-xf
@a
)
``` | 2017-12-14T10:18:31.000922 | Giovanna |
clojurians | clojure | Or just `(def logging-xf (map (fn [x] (prn x) x)))` | 2017-12-14T10:19:54.000029 | Giovanna |
clojurians | clojure | True, but qqq clearly asked for a way to go both to cuda and webassembly. | 2017-12-14T11:38:59.000669 | Daine |
clojurians | clojure | <@Kalyn> you can also just use a plain old debugger like the one available in Cursive. You can also use scope-capture as a more powerful version of the debug atom trick, which also supports a form of breakpoint (disclaimer: I'm the author!): <https://github.com/vvvvalvalval/scope-capture> | 2017-12-14T12:09:35.000445 | Danyel |
clojurians | clojure | `scope-capture` is great | 2017-12-14T12:46:03.000326 | Petronila |
clojurians | clojure | I’m using it a lot nowadays | 2017-12-14T12:46:11.000620 | Petronila |
clojurians | clojure | I'm not asking for "Clojure -> Cuda" or "Clojure -> WebAssembly"
I want "very restricted DSL -> Cuda" and "very restricted DSL -> WebAssembly"
this "very restricted DSL", expressed as Clojure Data, is NOT FULL CLOJURE -- in particular, I do NOT want to emscriptsen the entire JVM
I want a very restricted DSL for describing manipulations on tensors of floats -- and compiling this DSL to WebAssembly / CUDA
the main relation to CLojure is that I want to implement this very-restricted-dsl via clojure data | 2017-12-14T14:00:44.000124 | Berry |
clojurians | clojure | I have a system.edn file that needs a database url that I don't want to check in to source control. How can I introduce a variable into an edn data structure? | 2017-12-14T16:01:28.000029 | Lenita |
clojurians | clojure | <@Lenita> there are a bunch of config libs for Clojure, here’s some examples: | 2017-12-14T16:13:31.000462 | Noella |
clojurians | clojure | <https://github.com/tolitius/cprop> | 2017-12-14T16:13:32.000451 | Noella |
clojurians | clojure | <https://github.com/juxt/aero> | 2017-12-14T16:13:35.000351 | Noella |
clojurians | clojure | <https://github.com/levand/immuconf> | 2017-12-14T16:13:39.000374 | Noella |
clojurians | clojure | they all manage secrets, different environments etc | 2017-12-14T16:14:03.000145 | Noella |
clojurians | clojure | <@Noella> those all look like good options. thanks! | 2017-12-14T16:15:52.000773 | Lenita |
clojurians | clojure | cprop is nice! | 2017-12-14T16:17:25.000179 | Leann |
clojurians | clojure | <@Noella> I've always used environment variables. That way I can have an .env.example file people can copy and modify to their likings and not check it in | 2017-12-14T16:35:18.000035 | Malissa |
clojurians | clojure | the environment-variable approach is also great when paired with direnv <https://direnv.net/> | 2017-12-14T16:43:13.000621 | Basil |
clojurians | clojure | This is exactly what spectrum does: <https://github.com/arohner/spectrum> | 2017-12-14T17:29:30.000247 | Silas |
clojurians | clojure | Still in early alpha. Show your support if you like it. | 2017-12-14T17:29:43.000313 | Silas |
clojurians | clojure | I think eval runs in its own environment, which means within eval, you have not instrumented the divide function. That's my guess at least. | 2017-12-14T17:32:25.000461 | Silas |
clojurians | clojure | Try:
```
(defmacro divide-by-foo []
(divide 6 :foo))
```
Instead, after having instrumented divide. This will make a call to divide at macro-expansion time which should fail validation of the spec by instrument. | 2017-12-14T17:33:01.000116 | Silas |
clojurians | clojure | I’m using jvisualvm to successfully profile my app, locally, on macOS 10.12. It works correctly through several jvm reboots, and jvisualvm suddenly fails to connect with “Failed to create JMX connection to target application.” I wasn’t explicitly creating JMX connections beforehand. Rebooting my mac fixes it, but is there any way to solve it without rebooting? | 2017-12-14T17:42:34.000424 | Sidney |
clojurians | clojure | are you using the same version of the jvm each time? | 2017-12-14T17:54:38.000043 | Rebeca |
clojurians | clojure | <https://bugs.openjdk.java.net/browse/JDK-8023786> | 2017-12-14T17:55:36.000385 | Rebeca |
clojurians | clojure | I should be. I’m just in the same terminal window and `lein repl`ing each time | 2017-12-14T17:58:13.000022 | Sidney |
clojurians | clojure | once it’s hosed, restarting both my clojure jvm and the visualvm process doesn’t fix it | 2017-12-14T18:00:47.000434 | Sidney |
clojurians | clojure | and then after rebooting my mac, it works until I reboot my clojure app ~5 times | 2017-12-14T18:01:20.000201 | Sidney |
clojurians | clojure | is visualvm forking something off that’s sticking around? | 2017-12-14T18:01:24.000007 | Charity |
clojurians | clojure | That’s super spooky | 2017-12-14T18:01:32.000245 | Charity |
clojurians | clojure | could be, but I’m not finding anything obvious | 2017-12-14T18:01:46.000015 | Sidney |
clojurians | clojure | there are no `java` processes running | 2017-12-14T18:01:53.000123 | Sidney |
clojurians | clojure | what version of the jvm? | 2017-12-14T18:02:05.000417 | Rebeca |
clojurians | clojure | something about port acquisition logic? | 2017-12-14T18:02:09.000184 | Margaret |
clojurians | clojure | ```$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)``` | 2017-12-14T18:02:22.000317 | Sidney |
clojurians | clojure | I feel like this code can be much shorter: I'm trying to tokenize a string via . a list of regexps:
```
(defn- token-len [t]
(count (:str t)))
(defn lex [pats s]
"lex :: obj.pats -> string -> [obj.token]"
(let [regexps (mapv pat->regexp pats)]
(loop [tokens []
s s]
(if (empty? s)
tokens
(let [token (first (keep #(regexp-match % s) regexps))]
(assert token (str "failed to tokenize substring: " s))
(assert (> (token-len token) 0)
(str "empty token: " token " s: " s))
(recur (conj tokens token)
(subs s (token-len token))))))))
``` | 2017-12-14T18:12:26.000171 | Berry |
clojurians | clojure | <https://clojuredocs.org/clojure.core/subs> <-- does clojure not offer an O(1) time substring ? | 2017-12-14T18:18:20.000440 | Berry |
clojurians | clojure | No. Clojure doesn’t have a string type and just uses Java’s strings. If Java’s strings don’t have it Clojure doesn’t have it. | 2017-12-14T18:21:59.000190 | Charity |
clojurians | clojure | you’d think with immutable String you could make an immutable CharSequence that used an indexed range of a string - except of course unicode we can’t have it because unicode | 2017-12-14T18:23:10.000215 | Margaret |
clojurians | clojure | since you can’t guarantee that the index of a string by character starts at any given byte | 2017-12-14T18:24:15.000240 | Margaret |
clojurians | clojure | (without an O(n) scan that is) | 2017-12-14T18:24:31.000182 | Margaret |
clojurians | clojure | ztellman has a new immutable strings implementation in his bifrucan library that gives you log(n) substringing I think | 2017-12-14T18:24:36.000196 | Charity |
clojurians | clojure | cool | 2017-12-14T18:24:43.000213 | Margaret |
clojurians | clojure | the problem with java's strings is the lack of a tree structure, so you can can't just hold a reference to the parts you need, your substring ends up holding a reference to the whole string | 2017-12-14T18:25:20.000074 | Rebeca |
clojurians | clojure | which was causing enough of a memory issue that they switched from what you propose (substring returning a special string that refers to the other string with offsets) to substring returning a copy | 2017-12-14T18:26:23.000196 | Rebeca |
clojurians | clojure | seems like a case of "people cut self with scissors; let's ban all scissors" | 2017-12-14T18:27:40.000116 | Berry |
clojurians | clojure | I don't see an argument against .substring-ref and .substring-copy | 2017-12-14T18:27:58.000035 | Berry |
clojurians | clojure | but you could make a CharSequence that is cheap to construct from a String and uses a simple tree of some sort - and if code breaks when you use CharSequence instead of String the code is bad | 2017-12-14T18:28:03.000350 | Margaret |
clojurians | clojure | instead of just deciding upfront that all has to be copies | 2017-12-14T18:28:09.000191 | Berry |
clojurians | clojure | <https://dev.clojure.org/jira/browse/CLJ-112> I opened this issue in assembla before clojure was on jira (after asking rich about it on irc) | 2017-12-14T18:29:41.000108 | Rebeca |
clojurians | clojure | I think you can with UTF-16, which is what java uses no? | 2017-12-14T18:49:56.000003 | Silas |
clojurians | clojure | ```UTF-16 requires either 16 or 32 bits to encode a character``` | 2017-12-14T18:55:21.000043 | Margaret |
clojurians | clojure | you have to walk the string up to the point of your index to find its byte offset | 2017-12-14T18:55:32.000200 | Margaret |
clojurians | clojure | cite: <https://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings> | 2017-12-14T18:56:11.000220 | Margaret |
clojurians | clojure | Indexes into Java strings are indexes of 16-bit values, whether they are in the middle of a 32-bit code point or not. | 2017-12-14T19:06:50.000073 | Micha |
clojurians | clojure | Does Clojure have a library for "generalized regular expressions"
standard regular expression:
input = string (pretend its a vector of chars)
regex = option ?, repeat *, atleast-one +, way to specify single char / set of chars
generalized regular expression:
input = vector of arbitrary clojure data
regex = option ?, repeat *, atleats-one +, predicates ... that given an element, returns true/fase, indicating whether it's 'in the set' or not
is there any library for this? | 2017-12-14T19:06:59.000101 | Berry |
clojurians | clojure | so indexing is O(1), but isn't guaranteed to be the index of a full Unicode character. | 2017-12-14T19:07:09.000368 | Micha |
clojurians | clojure | I guess spec kind of does it, but it'd be nice if there was a library dedicated to this | 2017-12-14T19:07:21.000043 | Berry |
clojurians | clojure | oh - so `subs` can return garbage? | 2017-12-14T19:07:28.000099 | Margaret |
clojurians | clojure | sure | 2017-12-14T19:07:32.000018 | Micha |
clojurians | clojure | TIL ```=> (subs "💩" 1)
"?"``` | 2017-12-14T19:08:11.000081 | Margaret |
clojurians | clojure | There have been bugs related to this in Windows applications, I've heard. | 2017-12-14T19:08:13.000252 | Micha |
clojurians | clojure | I’m not surprised in the least - I would have expected subs to index by character not by pair of bytes | 2017-12-14T19:08:42.000217 | Margaret |
clojurians | clojure | There are libraries that can turn Java strings into sequences of Unicode code points, but then there are also complexities in Unicode like modifying graphemes (I think they are called) that can require understanding sequences of multiple Unicode code points, if you want to know how many "graphical things to display" | 2017-12-14T19:09:19.000211 | Micha |
clojurians | clojure | I have heard that Perl for about a decade has strings that are something like UTF-8 in memory, but if you index them by integer, they actually take the variable-number-of-byte encoding into account and give you the index of the i-th Unicode character. | 2017-12-14T19:10:30.000335 | Micha |
clojurians | clojure | I suspect that they might even implement some kind of caching of 'character index' -> 'byte offset' under the hood if you index the same string many times, but haven't looked. | 2017-12-14T19:11:01.000179 | Micha |
clojurians | clojure | why do you say spec kind of does that? spec internally uses parsing with derivatives which can parse context free languages which are a super set of regular languages | 2017-12-14T19:12:40.000243 | Rebeca |
clojurians | clojure | There might be something like that out there that may be more performance-optimized than spec's current implementation. Certainly I have heard of such things in languages other than Clojure. | 2017-12-14T19:13:48.000295 | Micha |
clojurians | clojure | I don't know how optimized the implementation is, but Racket has something like this: <https://docs.racket-lang.org/reference/match.html> | 2017-12-14T19:15:36.000117 | Micha |
clojurians | clojure | Maybe core.match does this? I haven't used it myself. | 2017-12-14T19:18:05.000284 | Micha |
clojurians | clojure | thanks, that results in ```ClassCastException hex.genmodel.easy.RowData cannot be cast to clojure.lang.IPersistentCollection clojure.core/conj--5112 (core.clj:82)
``` | 2017-12-14T19:19:19.000060 | Debby |
clojurians | clojure | ended up with this, suboptimal but works: ```(defn ->row-data [m]
(let [row (RowData.)]
(doseq [[k v] m]
(. row put k v))
row))``` | 2017-12-14T19:19:45.000311 | Debby |
clojurians | clojure | <@Berry> <http://clojuredocs.org/clojure.core/subs> | 2017-12-14T19:41:55.000171 | Micha |
clojurians | clojure | The older Java versions, pre 7u6, effectively gave you the choice between reference or copy, by substring always creating a reference, and String constructor allowing you to manually create a copy, if you knew you wanted one. With newer versions of Java, they changed the default, and without a library implementation that works via references you can't get the reference behavior. I suspect they did a lot of performance-testing on real applications before making such an implementation change. | 2017-12-14T19:43:34.000004 | Micha |
clojurians | clojure | <@Berry> considered using instaparse ? | 2017-12-14T19:52:48.000181 | Sandy |
clojurians | clojure | Or are you writing a parser to get experience writing parsers? | 2017-12-14T19:53:04.000102 | Sandy |
clojurians | clojure | I asked before, then lost the response. Are the clojure d videos up somewhere? | 2017-12-14T19:53:29.000298 | Glory |
clojurians | clojure | instaparse only supports strings; I think he was asking about what spec currently does | 2017-12-14T19:53:39.000155 | Edelmira |
clojurians | clojure | <https://groups.google.com/forum/#!topic/clojure/BBWc3c40RDI> | 2017-12-14T20:02:53.000204 | Daniele |
clojurians | clojure | Seems not :confused: | 2017-12-14T20:02:57.000156 | Daniele |
clojurians | clojure | <@Sandy>: yeah, what <@Edelmira> said: I want things that can do "regex" over arbitrary data, instead of just strings | 2017-12-14T20:51:13.000068 | Berry |
clojurians | clojure | "regex" over vector of arbitrary data | 2017-12-14T20:51:23.000025 | Berry |
clojurians | clojure | one of these days I really should finish my implementation of OMeta in Clojure | 2017-12-14T20:53:22.000043 | Sandy |
clojurians | clojure | is that the VRPI project ? | 2017-12-14T20:54:18.000087 | Berry |
clojurians | clojure | That sounds like what you're looking for, a generalized parsing system for both strings, and sequences of stuff | 2017-12-14T20:54:19.000286 | Sandy |
clojurians | clojure | ? | 2017-12-14T20:54:41.000156 | Sandy |
clojurians | clojure | I believe OMeta was from this lab: <http://www.vpri.org/> | 2017-12-14T20:55:04.000105 | Berry |
clojurians | clojure | But yeah, you should finish your OMeta in Clojure project. I feel like 90% of my clojure needs can be solved by "if only <@Sandy> finished those projects ...." | 2017-12-14T20:55:30.000135 | Berry |
clojurians | clojure | Last I worked on it was before spec existed. I think there's a lot of overlap there. OMeta is a bit like a DSL for spec and conform with polymorphism added | 2017-12-14T20:57:05.000077 | Sandy |
clojurians | clojure | <https://en.wikipedia.org/wiki/OMeta> is confusing me. Is OMeta a Turing-Complete language, or is it on the same laevel as regex/cfg ? | 2017-12-14T21:14:10.000211 | Berry |
clojurians | clojure | sad :( at least in the end i ended up refactoring the code to use simple functions instead, because multimethods wasn't the correct approach | 2017-12-14T22:23:38.000091 | Ahmad |
clojurians | clojure | thanks for taking your time! | 2017-12-14T22:23:48.000016 | Ahmad |
clojurians | clojure | I recall reading somewhere that due to some design decision, Clojure runs into problems if one has top-level files, i.e.
`src/a.cljc` -> `(ns a)` results in problems
can anyone point me at the article I'm referring to? | 2017-12-15T01:20:27.000110 | Berry |
clojurians | clojure | It’s not so much Clojure, as it is the JVM | 2017-12-15T01:39:46.000089 | Sandy |
clojurians | clojure | I don’t think that’s a fully valid package name | 2017-12-15T01:39:59.000089 | Sandy |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.