workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
<@Margaret> that looks like an explanation! However I get ``` Caused by java.lang.RuntimeException Unable to resolve symbol: KafkaMetricsReporter$ in this context ``` I checked as well I can compile the Java code in the answer just fine I tried `(-&gt; KafkaMetricsReporter (.MODULE$) (.startReporters (VerifiableProperties. {})))` but then I get ``` Unhandled java.lang.IllegalArgumentException No matching field found: MODULE$ for class java.lang.Class ```
2017-10-30T14:54:41.000167
Jonnie
clojurians
clojure
Sorry, disregard the first point, I was missing an import for `KafkaMetricsReporter$`
2017-10-30T14:58:00.000483
Jonnie
clojurians
clojure
This worked! `(.startReporters (KafkaMetricsReporter$/MODULE$) (VerifiableProperties. props))`
2017-10-30T14:59:01.000512
Jonnie
clojurians
clojure
Thanks a lot!
2017-10-30T14:59:06.000228
Jonnie
clojurians
clojure
You have unnecessary parens around the access of the static MODULE$ value - they are accepted but not needed (see (Math/PI) for a more obvious version of what that is doing)
2017-10-30T15:05:06.000249
Margaret
clojurians
clojure
```user=&gt; (Math/PI) 3.141592653589793 user=&gt; Math/PI 3.141592653589793```
2017-10-30T15:10:00.000520
Margaret
clojurians
clojure
Hey folks, I've been working on a single-purpose lib for exploring complex data structures from the REPL as rapidly as possible, with minimum keystrokes. If that's something you spend time doing, I'd love for you to try it out &amp; let me know how it goes. I'll eventually post it in <#C06MAR553|announcements>, but I'm hoping to get feedback from a few more people first. Thanks! <https://github.com/eggsyntax/datawalk>
2017-10-30T15:34:06.000439
Lavenia
clojurians
clojure
it also accepts `(. MATH PI)` - which is pretty much only useful for writing macros
2017-10-30T15:36:40.000203
Margaret
clojurians
clojure
I know about core/bean but does any other lib/function exist that would also allow customizing what to read and include public members as well, not just bean methods?
2017-10-30T16:16:50.000013
Douglass
clojurians
clojure
<https://github.com/arohner/clj-wallhack> might be a good start
2017-10-30T16:18:10.000658
Rebeca
clojurians
clojure
oh that's specifically for reading specific protected members
2017-10-30T16:21:06.000090
Douglass
clojurians
clojure
seems like obj-&gt;map from <https://dzone.com/articles/clojure-converting-java-object> is close to what I need
2017-10-30T16:29:22.000242
Douglass
clojurians
clojure
it reflectively reads members private or otherwise
2017-10-30T16:39:01.000253
Rebeca
clojurians
clojure
what you want is to reflectively read members
2017-10-30T16:39:20.000627
Rebeca
clojurians
clojure
There's a gotcha hiding in using a keyword dispatch on multimethods with two args... can you see it?
2017-10-30T17:52:40.000368
Wendi
clojurians
clojure
```user=&gt; (defmulti m :type) #'user/m user=&gt; (defmethod m :t1 [a b] a) #object[clojure.lang.MultiFn 0x3eb5ed75 "clojure.lang.MultiFn@3eb5ed75"] user=&gt; (m {} :t1) {}```
2017-10-30T17:52:43.000488
Wendi
clojurians
clojure
heh
2017-10-30T18:07:45.000019
Kareen
clojurians
clojure
I'm doing lexing via regex. Is there a re-find which takes an index as an argument? I want to say (search for this regex, but pretend the start of the string is at index i). This is to avoid constant calls to substring.
2017-10-30T19:41:12.000229
Berry
clojurians
clojure
is there a clojure builtin for `(when x (f x))` ? it seems like the type of thing someone has assigned a word to
2017-10-30T19:47:28.000171
Berry
clojurians
clojure
`(some-&gt; x (f))`
2017-10-30T19:49:43.000131
Margaret
clojurians
clojure
for your lexer, do you plan on support laziness? ie. being able to parse a stream without consuming the whole stream?
2017-10-30T19:50:26.000122
Jonas
clojurians
clojure
there’s several options for readers in java as well as things like `java.util.Scanner`
2017-10-30T19:50:57.000211
Jonas
clojurians
clojure
that may makes things easier
2017-10-30T19:51:11.000233
Jonas
clojurians
clojure
for eg, <https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html#next(java.util.regex.Pattern)>
2017-10-30T19:51:39.000131
Jonas
clojurians
clojure
<@Berry> regarding regex with settable input position, I bet Scanner would help <https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html>
2017-10-30T19:51:55.000187
Margaret
clojurians
clojure
oh, haha
2017-10-30T19:52:05.000109
Margaret
clojurians
clojure
:stuck_out_tongue:
2017-10-30T19:52:08.000202
Jonas
clojurians
clojure
your link is much better. not sure why the first result that came up for me was for java 1.5
2017-10-30T19:53:05.000018
Jonas
clojurians
clojure
<@Margaret> <@Jonas>: I forgot to mention, this is a *.cljc file, so I need jvm + js // I guess I should now look into js regex libraries :slightly_smiling_face:
2017-10-30T20:00:29.000150
Berry
clojurians
clojure
re-find has been great so far in that it works in both
2017-10-30T20:00:37.000298
Berry
clojurians
clojure
looks like this has a similar api <http://sstephenson.github.io/strscan-js/>
2017-10-30T20:02:04.000060
Margaret
clojurians
clojure
<@Berry> also double check if subs is actually a problem - it should be cheap (on the jvm at least) since java strings are immutable
2017-10-30T20:03:23.000147
Margaret
clojurians
clojure
<@Margaret>: some-&gt; is precisely what I need -- thanks
2017-10-30T20:13:31.000048
Berry
clojurians
clojure
though it appears that example can besimplified to (some-&gt; x f)
2017-10-30T20:13:48.000073
Berry
clojurians
clojure
I like to use parens with arrow macros, it's a personal style preference
2017-10-30T20:15:00.000204
Margaret
clojurians
clojure
<@Sonny> I can't see this would ever be desirable behaviour but could be surprising. Do you think a patch would be considered? Something which did (k arg1) instead of (apply k args) for the keyword case.
2017-10-30T20:34:56.000113
Wendi
clojurians
clojure
There are other variadic cases where I don’t think this would work
2017-10-30T21:40:41.000095
Sonny
clojurians
clojure
Fair enough.
2017-10-30T22:25:16.000225
Wendi
clojurians
clojure
It'd seem a shame to make a special case check for keyword? of the dispatch method
2017-10-30T22:26:16.000081
Wendi
clojurians
clojure
I don’t understand why you have [a b] in that method - that just seems wrong
2017-10-30T22:40:27.000003
Sonny
clojurians
clojure
Yes, the code works but is surprising.
2017-10-30T22:48:09.000245
Wendi
clojurians
clojure
Say we have a multi-method which takes two args and we want to dispatch on a keyword from the first arg.
2017-10-30T22:48:20.000341
Wendi
clojurians
clojure
The code does that. The dispatch keyword is called as a function (get) which can take one or two args.
2017-10-30T22:48:55.000110
Wendi
clojurians
clojure
When get doesn't find the keyword the second arg is returned.
2017-10-30T22:49:07.000246
Wendi
clojurians
clojure
That's the oddness. We expect the dispatch-fn to return nil but it returns `:t1`.
2017-10-30T22:49:40.000064
Wendi
clojurians
clojure
To avoid this we need something like ```(defmulti m (fn [a b] (:type a)))```
2017-10-30T22:51:17.000155
Wendi
clojurians
clojure
That’s what you should have. The prior example is wrong
2017-10-30T23:40:39.000054
Sonny
clojurians
clojure
Fair enough. Thanks.
2017-10-31T00:26:55.000068
Wendi
clojurians
clojure
Hi, is there a name for the common design pattern of letting an HOF accept extra arguments that will be applied to the given function, e.g `swap!` or `update` ?
2017-10-31T05:53:45.000460
Rosia
clojurians
clojure
The succession model is a term I've heard
2017-10-31T07:11:37.000287
Fe
clojurians
clojure
that has more to do with describing behaviour than api
2017-10-31T07:20:19.000325
Kareen
clojurians
clojure
if I have a local jar file, how can I include it in a project? i.e where should the jar be located and what do I need to add to the project file? (lein 2)
2017-10-31T08:14:36.000029
Jacob
clojurians
clojure
Maybe this helps <https://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/>
2017-10-31T09:06:24.000036
Cecilia
clojurians
clojure
Yeah, I just wasnt sure if 2011 was out of date...
2017-10-31T09:18:15.000176
Jacob
clojurians
clojure
Playing around with `clj`, so I needed to figure out how it works, so I did
2017-10-31T09:28:12.000009
Virgil
clojurians
clojure
```14:27 $ clj --help Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*] ```
2017-10-31T09:28:17.000044
Virgil
clojurians
clojure
I might understand why `clj --help` mentions java, but I'd expect it to have a more specific help message?
2017-10-31T09:29:14.000376
Virgil
clojurians
clojure
Is it really so convoluted to add a local jar to a project?
2017-10-31T09:36:40.000312
Jacob
clojurians
clojure
Does anyone familiar with the salesforce API, know what would happen if I have push topic's set up to sync salesforce data to a standalone db, then a user's permissions change and the user is now long has access to a specific record, would the push topic send a `delete` update for the request that the user can no longer view?
2017-10-31T10:13:42.000227
Billye
clojurians
clojure
A noob question: is it possible to make a http HEAD request in clojure without reverting to javaland (HttpURLConnection) or pulling in a third party dependency?
2017-10-31T10:16:08.000416
Joette
clojurians
clojure
clojure.core has no http client unless you count slurp as one, and slurp doesn't support http methods options
2017-10-31T10:18:22.000297
Weston
clojurians
clojure
so yeah, interop or clj-http&amp;co
2017-10-31T10:18:48.000343
Weston
clojurians
clojure
I find myself writing a lot of code of the form `{:tag kw kw data ... other attribs ... }` for ecample `{:tag :pat :pat .... :name .... }` thi seems a bit redundant
2017-10-31T10:26:44.000406
Berry
clojurians
clojure
Good morning :slightly_smiling_face: Is anyone here familiar with Neanderthal? I'm trying to find some missing constants that are required in order to run the hello-world example. `(require '[uncomplicate.clojurecl.core :as uc])` from a repl in the example project gives me a `CompilerException java.lang.Exception: No namespace: uncomplicate.clojurecl.constants, compiling:(uncomplicate/clojurecl/core.clj:1:1)`. There is no `constants` namespace defined anywhere in the Neanderthal repo, and I can't find a repo in the Uncomplicate org that looks like it might have those constants.
2017-10-31T12:11:04.000460
Jesusa
clojurians
clojure
Obviously <@Jesusa> you haven't got the correct setup to use `neanderthal` <http://neanderthal.uncomplicate.org/articles/getting_started.html#installation> `ClojureCL` (OpenCL) not installed correct
2017-10-31T12:31:07.000836
Lovie
clojurians
clojure
you might like to try <#C08PLCRGT|uncomplicate>
2017-10-31T12:32:52.000331
Lovie
clojurians
clojure
Maybe I should go over the opencl install again via the Neandertal instructions. I already have webcl working in Firefox, and opencl working from Python.
2017-10-31T13:15:29.000860
Jesusa
clojurians
clojure
Thanks for the room link, I almost missed that
2017-10-31T13:16:39.000510
Jesusa
clojurians
clojure
is there a good word for 'compute a bunch of auxiliary / derived data for caching purposes' ? (informatically theoretically, it adds nothing new, but it precomputes a bunch of lookup tables / caches)
2017-10-31T13:38:53.000695
Berry
clojurians
clojure
it’s similar to how dynamic programming works, right? - organizing things so you can save and reuse partial calculations
2017-10-31T13:39:36.000177
Margaret
clojurians
clojure
'dynamic programming' is a very specific class of algorithms; where you save computation by remembering it in my case, I'm pre-building lookup tables -- it's not quite the same
2017-10-31T13:41:11.000720
Berry
clojurians
clojure
best word I have so far, is 'prep'
2017-10-31T13:41:18.000283
Berry
clojurians
clojure
any reason you aren’t using memoize?
2017-10-31T13:44:58.000360
Margaret
clojurians
clojure
err, so I have this structure which represents the 'precedence of each operator'
2017-10-31T13:54:47.000148
Berry
clojurians
clojure
so it's something like: [[:right "^"] [:left "*" "/"] [:left "+" "-"]]
2017-10-31T13:55:12.000394
Berry
clojurians
clojure
now, given two ops, I want to know which has a higher precedence .. so I need to 'invert' the above vector of vectors, and cache the results, to get something like: ^ -&gt; 3 * -&gt; 2 / -&gt; 2 + -&gt; 1 - -&gt; 1
2017-10-31T13:55:47.000109
Berry
clojurians
clojure
so I'm literally precomputing a map
2017-10-31T13:56:09.000568
Berry
clojurians
clojure
I'm not particularly happy with 'prep', but it's the best word I can think of
2017-10-31T13:56:41.000726
Berry
clojurians
clojure
why generalize it, why not just call it “build-precedence-map” or something mundane like that
2017-10-31T14:00:17.000930
Margaret
clojurians
clojure
do you anticipate this being a common type of task?
2017-10-31T14:00:25.000764
Margaret
clojurians
clojure
1. why do you believe i'm trying to 'generalize' it? 2. 'build-inverse-precedence-map' is perfectly valid, but I was hoping for a shorter word
2017-10-31T14:01:48.000006
Berry
clojurians
clojure
I'm not trying to 'write a more general function', I'm literally looking for a shorter func name.
2017-10-31T14:02:13.000129
Berry
clojurians
clojure
tough if we don't know exactly what it returns and how you'll use it. If it just returns -1,0,1, `compare-by-precedence`. If it returns the lower of the two `lower-precedence`, if it returns a vector of the two ops sorted, `sort-be-precedence`. If it returns a map that allows you to lookup by operator token then `make-precedence-map`
2017-10-31T14:08:29.000173
Willow
clojurians
clojure
ah, I see, I should have been clearer on input/output ``` input: {:tag :grammar ... :precs [[:right "^"] [:left "*" "/"] [:left "+" "-"]] } output add a field :inv-precs { "^" [3 :right] "*" [2 :left] "/" [2 :left] "+" [1 :left] "-" [1 :left]] ```
2017-10-31T14:20:10.000041
Berry
clojurians
clojure
i'm getting a compilation error in 1.9.0-beta3: `Caused by: java.lang.ClassNotFoundException: clojure.pprint` i definitely see it in the source/tests, and it's basically a new/empty project. any idea what i'm doing wrong?
2017-10-31T14:41:24.000129
Zola
clojurians
clojure
<@Zola> How did you create the project? Have you edited it at all? What command are you using that produces that error? What does the source look like that it is complaining about?
2017-10-31T14:46:37.000439
Daniell
clojurians
clojure
i used the lein-re-frame template and added just a few deps. you have a good point though... i'll start with a barebones project and rule out any weird dependency problems first.
2017-10-31T14:52:38.000379
Zola
clojurians
clojure
sounds like some code was assuming clojure.pprint is loaded on startup (a bad assumption)
2017-10-31T14:53:05.000213
Margaret
clojurians
clojure
dumb question i know, but why is that a bad assumption?
2017-10-31T14:56:34.000723
Zola
clojurians
clojure
there’s some tooling which requires clojure.pprint, that often runs on startup, but it’s not something you can count on
2017-10-31T14:56:58.000401
Margaret
clojurians
clojure
if you use a namespace, you should explicitly require it, even if it comes with clojure.core
2017-10-31T14:57:12.000682
Margaret
clojurians
clojure
ahh okay, thank you
2017-10-31T14:57:25.000170
Zola
clojurians
clojure
even for namespaces like <http://clojure.java.io|clojure.java.io> that are loaded by clojure.core itself, there’s no explicit promise that will be the case with the next clojure release, so it’s better to require it if you access it
2017-10-31T14:59:04.000024
Margaret
clojurians
clojure
got it :slightly_smiling_face:
2017-10-31T15:07:06.000326
Zola
clojurians
clojure
(by the way, that was exactly the problem)
2017-10-31T15:12:26.000035
Zola
clojurians
clojure
is a lambda function the same as a closure?
2017-11-01T02:32:23.000110
Corazon
clojurians
clojure
hey all - I'm having super slow compile times on my clojure app - I remember there being a way to report on which namespace the compiler is busy working on, but can't find it anywhere now?
2017-11-01T05:09:34.000194
Dimple
clojurians
clojure
I suspect one or two namespaces to be culprits, so would like to identify them and then see what I can do
2017-11-01T05:10:11.000169
Dimple
clojurians
clojure
<@Corazon> They are not the same. A lambda is a function as a value (you can assign it, pass it around, execute etc). A closure is an implementation detail. It has to do with visibility of symbols when the function is created inside another function (think of it as an implicit map). The inner function "closes over" the context of the outer function, thus creating a closure. This allows the inner fn to refer to symbols that are not declared locally to it. The wikipedia entry does a decent job describing it: <https://en.wikipedia.org/wiki/Closure_(computer_programming)>
2017-11-01T05:15:08.000219
Eliana
clojurians
clojure
Cool
2017-11-01T06:20:17.000151
Corazon