workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
(context is everything <@Berry> :slightly_smiling_face: )
2017-11-06T23:46:49.000046
Daniell
clojurians
clojure
I assume that code is inside a macro...?
2017-11-06T23:47:05.000195
Daniell
clojurians
clojure
you have to use a gensym in your example
2017-11-06T23:47:34.000132
Jonas
clojurians
clojure
sorry, was afk rewriting the function as a macro
2017-11-07T00:00:32.000074
Berry
clojurians
clojure
yeah, this is part of a macro, and yes, I ended up using gensym
2017-11-07T00:00:40.000185
Berry
clojurians
clojure
those are just a part of the name of a function though, not syntaxes, which is why they weren't included
2017-11-07T01:42:43.000173
Margaret
clojurians
clojure
seems like it is similar to `&lt;symbol&gt;?` predicate suffix
2017-11-07T01:44:36.000066
Jonas
clojurians
clojure
<https://clojure.org/guides/weird_characters#__code_symbol_code_predicate_suffix>
2017-11-07T01:44:38.000115
Jonas
clojurians
clojure
fair
2017-11-07T01:51:50.000099
Margaret
clojurians
clojure
<@Charlie> <@Jonas> <@Raul> There is also the Clojure cheatsheet, with the <http://clojure.org|clojure.org> version here <https://clojure.org/api/cheatsheet> which has a link to this page that has some other variants that enable searching, but unfortunately not for the special characters. There is a dedicated section of the cheatsheet to most of the special characters you will find in Clojure, near the 'bottom left' of the page. It has links to other docs for most of them, including a link at the top of that section to Clojure guide page linked earlier: <https://clojure.org/guides/weird_characters>
2017-11-07T03:07:51.000320
Micha
clojurians
clojure
is anyone familiar with scala interop? I need to construct a case object, but can't figure out how to do this from clojure
2017-11-07T03:20:22.000089
Jena
clojurians
clojure
I need to create one of these case objects: <https://apache.googlesource.com/kafka/+/HEAD/core/src/main/scala/kafka/admin/RackAwareMode.scala>
2017-11-07T03:21:09.000286
Jena
clojurians
clojure
Hey all! I'm trying to rewrite core.async-based code into aleph/manifold one, and can't figure out what would be equivalent for something like this: ``` (go-loop [x 0] (if (&gt; x 3) x (do (&lt;! (timeout 1000)) (recur (inc x))))) ``` the main problem is timeout, I have no idea what's the right way to do it with manifold deferred's: I'm making an http request with aleph and want to retry for a few times with growing backoff. Manifold docs have `Thread/sleep` somewhere, but I'm a bit scared about that one. :slightly_smiling_face: Any pointers maybe?
2017-11-07T03:26:51.000148
Ignacia
clojurians
clojure
<@Ignacia> maybe `manifold.deferred/timeout!` is useful.
2017-11-07T03:31:08.000268
Jena
clojurians
clojure
``` ;; o (if (p/&gt;= g t) (float 255.0) (float 0.0)) ;; o (if (p/&lt; g t) (float 0.0) (float 255.0) ) ``` ^-- these two lines should do the same thing right ? I'm doing image processing, getting different results, and completely baffled
2017-11-07T03:31:23.000355
Berry
clojurians
clojure
what's the `p/` namespace?
2017-11-07T03:32:15.000064
Jena
clojurians
clojure
<https://github.com/ztellman/primitive-math/blob/master/src/primitive_math/Primitives.java> <@Jena>
2017-11-07T03:32:51.000246
Berry
clojurians
clojure
oh, it fails when t = NaN
2017-11-07T03:34:33.000252
Berry
clojurians
clojure
<@Jena> maybe, but then I have to find deferred to timeout on then...
2017-11-07T03:41:42.000142
Ignacia
clojurians
clojure
not really, let's say <http://clojure.com|clojure.com> responds fast enough, but with an error, and we want to retry it few times in a row with growing backoff
2017-11-07T04:03:30.000309
Ignacia
clojurians
clojure
in this case we're doing http/get, and *then* there needs to be a Thread/sleep or something similar
2017-11-07T04:03:59.000285
Ignacia
clojurians
clojure
like, between `http/get` and `d/recur`
2017-11-07T04:04:24.000109
Ignacia
clojurians
clojure
ah ok, so in my example, you would want to wait before calling `d/recur`?
2017-11-07T04:06:14.000074
Jena
clojurians
clojure
yeah!
2017-11-07T04:06:21.000106
Ignacia
clojurians
clojure
in current core.async code it looks like this: ``` (def process-message [...] (go ... (when retry? (&lt;! (timeout next-backoff-ms)) (process-message client url args success? ack-fn async-exception-fn (assoc retry-params :retry-attempt (inc retry-attempt))))))) ```
2017-11-07T04:06:54.000124
Ignacia
clojurians
clojure
try this: ``` (def case-disabled RackAwareMode.Disabled$.MODULE$) ``` Haven’t tested that out but basing this on this stackoverflow discussion <https://stackoverflow.com/questions/2561415/how-do-i-get-a-scala-case-object-from-java>
2017-11-07T04:13:01.000030
Cecilia
clojurians
clojure
tbh, in such a situation i'd just run a function in a java executor, so i can use 'Thread/sleep' safely
2017-11-07T04:20:24.000162
Jena
clojurians
clojure
Found a solution:
2017-11-07T04:27:16.000100
Jena
clojurians
clojure
```(import 'kafka.admin.RackAwareMode$Enforced$) (kafka.admin.RackAwareMode$Enforced$/MODULE$) ```
2017-11-07T04:27:21.000240
Jena
clojurians
clojure
<@Jena> hm, that's an option, thanks!
2017-11-07T04:35:26.000008
Ignacia
clojurians
clojure
Hi! It seems that the community has pretty much settled on using this convention for test files: <http://www.lispcast.com/clojure-test-directory> (putting the test files in a separate directory that mimics the same structure as the main project). I find it pretty tedious to mimic the directory structure, and I'd like to have the tests close to the code since I will often look at them in conjunction. Does anyone have any suggestions on how to accomplish this? I would of course like to exclude the test files from production builds.
2017-11-07T05:08:37.000016
Adrien
clojurians
clojure
How deep is your directory structure? o.0 We are normally only creating a couple of extra directories for a new project. Most tooling that creates projects/files, like boot (and I assume lein) can also be make to create the test file in the expected place when you tell it to create the source one...
2017-11-07T05:13:50.000329
Mallie
clojurians
clojure
Not super deep, but I find it annoying in general to have to change the same thing in several places. I also see tests as a form of documentation, and that would be nice to have as close to the code as possible.
2017-11-07T05:16:45.000376
Adrien
clojurians
clojure
Why? It's just opening files. Does it really matter where they are? Especially if the structure is the same apart from the first word being `src` or `test`. You can even shell glob it when opening in most editors. Regardless, that is the same as the Java expectation, and as far as I am aware all tooling expects that structure. You *could* write a boot task that for example copies files named without `_test` into a `src` dir under `build` with the same structure and ones with `_test` into a `test` dir under `build` and then make all other boot jobs run from that dir with the structure it expects, but that seems like a lot of work. I assume you could do something similar with lein
2017-11-07T05:21:22.000345
Mallie
clojurians
clojure
I find it definitely matters where the files are located when exploring a project. For example, if the tests where located next to the code, I could immediately see if the module I'm currently working on has any tests associated with it by seeing if there is a test file in the module or not. I agree that writing any sort of complex task is not worth it, however.
2017-11-07T05:28:56.000101
Adrien
clojurians
clojure
I have seen several Clojars deployment tutorials that claim you can enter a public GPG key in your profile there, but I do not see this anywhere in the site. What a I missing?
2017-11-07T05:29:15.000129
Marnie
clojurians
clojure
Hi, someone work with Immutant 2 and protobuff. When i try to convert stream -&gt; clojure hash map (in safary) i catch ```java.io.IOException: UT000034: Stream is closed``` but in chrome/firefox/ie all work fine
2017-11-07T06:05:01.000369
Francene
clojurians
clojure
if you want to use clojure.test on a macro, i gather you'd have to do something like `(eval '(my-macro ...))` if the macro could throw an assertion and your `is` test is in fact testing for `thrown?`, right?
2017-11-07T06:47:21.000079
Marnie
clojurians
clojure
like `(is (thrown? AssertionError (eval '(some-macro {:e :hi}))))`
2017-11-07T06:48:11.000351
Marnie
clojurians
clojure
because otherwise the assertion is thrown when the test file is compiled for me
2017-11-07T06:48:52.000213
Marnie
clojurians
clojure
<@Marnie> Clojars dropped using your GPG key - it was used to verify that the artifacts you uploaded were signed by you when trying to promote to the "releases" repo, which was removed. See <https://github.com/clojars/clojars-web/issues/415> for rationale
2017-11-07T07:02:31.000109
Candi
clojurians
clojure
but i cannot use `lein deploy clojars` without it failing with GPG errors
2017-11-07T07:07:40.000196
Marnie
clojurians
clojure
Ah, that is a different case - that's lein trying to use gpg to sign your artifacts before sending them to clojars
2017-11-07T07:09:28.000286
Candi
clojurians
clojure
Have you looked at <https://github.com/technomancy/leiningen/blob/stable/doc/GPG.md>?
2017-11-07T07:11:06.000169
Candi
clojurians
clojure
only too many times
2017-11-07T07:14:03.000055
Marnie
clojurians
clojure
i think i'll give up on it for now
2017-11-07T07:14:25.000213
Marnie
clojurians
clojure
You can disable signing by setting `:sign-releases` to false for clojars: <https://github.com/technomancy/leiningen/blob/stable/doc/GPG.md#signing-a-file>
2017-11-07T07:15:16.000353
Candi
clojurians
clojure
I believe this should do it (in project.clj): `:repositories [["clojars" {:url "<https://clojars.org/repo>" :sign-releases false}]]`
2017-11-07T07:16:20.000151
Candi
clojurians
clojure
is that an actual url with `/repo` or do i put one in there for my own app? i've tried this both ways and get weird errors about "missing connectors" and stuff
2017-11-07T07:18:31.000449
Marnie
clojurians
clojure
That's the actual url - it's not project-specific
2017-11-07T07:19:31.000377
Candi
clojurians
clojure
ok, i'll try it again in a little while, thanks
2017-11-07T07:20:57.000216
Marnie
clojurians
clojure
my data_readers.clj looks like this: ``` {monitor/date monitor.utils/parse-date} ``` I start a REPL, refresh (as in, I load all the namespaces) and this happens: ``` user&gt; #monitor/date "2016 3 1" IllegalStateException Attempting to call unbound fn: #'monitor.utils/parse-date clojure.lang.Var$Unbound.throwArity (Var.java:43) user&gt; @#'monitor.utils/parse-date #function[monitor.utils/parse-date] ``` why?
2017-11-07T07:24:16.000037
Ted
clojurians
clojure
how does one supress the default logger with jetty, which is set to info, ``` 2017-11-07 13:33:20.868:INFO::main: Logging initialized @3013ms ..etc... ```
2017-11-07T07:34:09.000308
Lily
clojurians
clojure
<@Lily> it depends on the logging lib you're using - with timbre you can configure it directly in Clojure, clojure.tools.looging uses underlying java libs which usually means using properties or XML files for configuration
2017-11-07T07:43:35.000271
Terra
clojurians
clojure
yes it's a mystery to me what logging lib is printing this, since this is always by default with jetty, has never bothered me. Im creating terminal app and it's distracting. Looking at ring/ring-jetty-adapter dependencies, there's no logging lib there, guessing it's coming from org.eclipse.jetty/jetty-server "9.2.21.v20170120". So maybe there's some java option I could set?
2017-11-07T07:46:36.000348
Lily
clojurians
clojure
maybe I found it with quick google search `-Dorg.eclipse.jetty.LEVEL=ERR`
2017-11-07T07:48:01.000197
Lily
clojurians
clojure
ok this fixed it `:jvm-opts ["-Dorg.eclipse.jetty.LEVEL=OFF"]` in case someone googles the slack logs.
2017-11-07T07:51:09.000114
Lily
clojurians
clojure
<@Adrien> you can technically add tests in any file, including the file with the implementation
2017-11-07T08:00:20.000071
Herminia
clojurians
clojure
the reason they're in a different directory is so that you can exclude them from production deployments
2017-11-07T08:00:44.000293
Herminia
clojurians
clojure
The latter
2017-11-07T08:04:05.000307
Sonny
clojurians
clojure
You still need to require monitor.utils before you use the tagged literal, otherwise Clojure can’t find the constructor function
2017-11-07T08:09:02.000396
Sonny
clojurians
clojure
if you add the `:test` metadata to a function, and that contains something callable, that will be run when you execute clojure.test/run-all-tests
2017-11-07T08:59:48.000208
Margaret
clojurians
clojure
if it contains test/is etc. it will work just like a deftest
2017-11-07T09:00:01.000488
Margaret
clojurians
clojure
I don't think `lein test` likes this, but making a task that loads your namespaces and runs clojure.test/run-all-tests is not hard at all - you can even just run your tests from the repl
2017-11-07T09:00:54.000125
Margaret
clojurians
clojure
as far as I know this feature is out of date - it wasn't being handled properly(?) and nobody had the expertise or energy to manage it correctly iirc
2017-11-07T09:01:48.000181
Margaret
clojurians
clojure
Thanks for the reply! I know that's why it's in a different directory. My question was wether it's possible to exclude them anyway without too much hassle.
2017-11-07T09:28:42.000397
Adrien
clojurians
clojure
Clojure 1.9.0-RC1 is out -- no different than beta4. Start your engines
2017-11-07T11:18:56.000798
Guillermo
clojurians
clojure
<@Guillermo> any changelog?
2017-11-07T12:22:34.000600
Geneva
clojurians
clojure
it's in the repo
2017-11-07T12:22:56.000370
Guillermo
clojurians
clojure
<https://github.com/clojure/clojure/blob/master/changes.md> this?
2017-11-07T12:23:12.000624
Geneva
clojurians
clojure
yup
2017-11-07T12:23:16.000211
Guillermo
clojurians
clojure
I was commenting a few days ago that I was having trouble calling some Clojure functions (i.e. implemented in Clojure) from my Java app. I managed to make some progress, and to call a few functions from clojure.core -- but I still haven't been able to call any Clojure functions that I've implemented myself in my own Clojure libraries. It always results in an error saying the function is unbound.
2017-11-07T14:14:07.000518
Lisette
clojurians
clojure
I'm suspecting that perhaps the clojure.core functions that I call are all static - and thus defined.. and perhaps the reason I'm not able to call my own functions is related to my 'main' being a Java 'main' instead of a Clojure 'main'.. and perhaps this is resulting in the Clojure functions never getting bound in the first place due to some binding step getting skipped? (since this would only occur automatically with a Clojure main?) Anyway - trying to come up with theories/solutions.
2017-11-07T14:15:23.000684
Lisette
clojurians
clojure
<@Lisette> you need to load the namespaces you want to call functions in
2017-11-07T14:18:25.000216
Aldo
clojurians
clojure
using for instance `require`
2017-11-07T14:18:42.000579
Aldo
clojurians
clojure
clojure.core is the only namespace loaded by default
2017-11-07T14:19:01.000341
Aldo
clojurians
clojure
"clojure.core is the only namespace loaded by default" - that helps explain what I'm seeing a lot. On Friday, I had difficulty calling 'require' in particular for some reason -- but I'll get back to trying that right now.
2017-11-07T14:20:24.000534
Lisette
clojurians
clojure
Clojure.var("clojure.core","require").invoke("you-ns-here"); should do the trick
2017-11-07T14:20:52.000379
Aldo
clojurians
clojure
ok. I had tried this (code follows):
2017-11-07T14:22:29.000604
Lisette
clojurians
clojure
` String mumbojumbo_ns_name = System.getProperty("mumbo.jumbo.system"); IFn require = Clojure.var("clojure.core", "require"); Object mumbojumbo_ns_sym = Clojure.read(mumbojumbo_ns_name); Object ns = require.invoke(mumbojumbo_ns_sym);`
2017-11-07T14:22:41.000146
Lisette
clojurians
clojure
but keep getting: Exception in thread "main" java.lang.Exception: prefix cannot be nil, compiling:(NO_SOURCE_PATH:0:0)
2017-11-07T14:23:02.000426
Lisette
clojurians
clojure
I'll try what you suggested
2017-11-07T14:23:07.000105
Lisette
clojurians
clojure
When I try the code you suggest, I get this error (I've been seeing this over the past few days as I try it):
2017-11-07T14:24:37.000648
Lisette
clojurians
clojure
```Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character```
2017-11-07T14:24:43.000582
Lisette
clojurians
clojure
oh sorry you need to symbolify it
2017-11-07T14:25:49.000094
Aldo
clojurians
clojure
Clojure.var("clojure.core","require").invoke(Clojure.var("clojure.core","symbol").invoke("your-ns-here"))
2017-11-07T14:26:16.000588
Aldo
clojurians
clojure
Wow. I think that's done it. Thank you :slightly_smiling_face:
2017-11-07T14:29:00.000316
Lisette
clojurians
clojure
my previous attempt was along the right lines.. but just wrong.
2017-11-07T14:29:14.000328
Lisette
clojurians
clojure
does anyone here use VS Code for clojure?
2017-11-07T14:55:13.000259
Christin
clojurians
clojure
<@Christin> There's a <#C6H9FUNET|vscode> channel -- no idea how active it is tho'...
2017-11-07T15:15:32.000258
Daniell
clojurians
clojure
thanks!
2017-11-07T15:42:56.000294
Christin
clojurians
clojure
Hello guys, I am looking for a solution for background jobs which should survive Tomcat server restart or moving application to another VM on AWS. I found <https://github.com/metametadata/byplay> which looks really promising because we are already using Postgres on separate machine and jobs shouldn't do any heavy lifting (mostly tasks like send email to a user after 2 weeks and stuff like that). Do you think it's feasible to use DB as a persistent storage for jobs or should I look somewhere else?
2017-11-07T15:58:25.000585
Salvador
clojurians
clojure
there are far worse ways to do that, I am unfamiliar with byplay, but it sounds perfectly reasonable
2017-11-07T16:08:49.000236
Rebeca
clojurians
clojure
the idea of long running transactions doesn't sound great, in the past I've worked on systems that used postgres advisory locks instead, but I am not sure that is any better
2017-11-07T16:11:33.000039
Rebeca
clojurians
clojure
Long running transaction are the only part I am worried about because there can be possibly hundreds of jobs waiting to execute and I am not sure how it can affect performance of the DB
2017-11-07T16:32:20.000126
Salvador
clojurians
clojure
I would be shocked if any database had a problem storing hundreds of things
2017-11-07T16:35:05.000158
Rebeca
clojurians
clojure
Storing it's not the issue I thought that lot of opened transactions might be
2017-11-07T16:36:23.000396
Salvador
clojurians
clojure
generally job systems won't leave a transaction open. workers claim jobs, then relinquish them in two separate tx'es
2017-11-07T16:37:45.000079
Guillermo
clojurians
clojure
having the number of open transactions scale with the number of stored jobs would be the result of a very special system
2017-11-07T16:37:53.000311
Rebeca
clojurians
clojure
Ok, I've probably misunderstood the byplay documentation. It seems like worth trying to me, I am building a system with hundreds of users at maximum who generates some background tasks from time to time so it should scale
2017-11-07T16:41:11.000438
Salvador