workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
<@Lisette> this repo works <https://github.com/noisesmith/clj-jsvc-adapter/blob/master/src/java/org/noisesmith/Cljsvc.java>
2017-11-03T15:37:00.000212
Margaret
clojurians
clojure
<@Floretta> you don’t have to ask to ask, and there’s a <#C053AK3F9|beginners> channel you can use at your discretion
2017-11-03T15:37:23.000570
Margaret
clojurians
clojure
coo. thanks
2017-11-03T15:37:59.000513
Floretta
clojurians
clojure
<@Margaret> Hmm. Apparently, Eclipse simply tells me clojure.java.api.Clojure doesn't exist when I'm pulling 1.8.0 (and it results in spurious error indicators everywhere), but it actually works fine. I don't have that problem when I pull 1.7.0.
2017-11-03T15:39:02.000250
Lisette
clojurians
clojure
But if I ask in the #beginner room then won't it just be all beginner there and no one to help me? :stuck_out_tongue:
2017-11-03T15:39:08.000144
Floretta
clojurians
clojure
<@Lisette> well that’s weird
2017-11-03T15:39:23.000145
Margaret
clojurians
clojure
<@Floretta> Oh no, there’s lots of folks that go there looking for people to help
2017-11-03T15:40:07.000093
Marx
clojurians
clojure
<@Margaret> Actually - I stand corrected. The error indicators disappeared - seems I rebuilt/ran too fast. Cleaning my .m2 org/clojure stuff may have been the solution. Thanks.
2017-11-03T15:40:11.000199
Lisette
clojurians
clojure
:thumbsup:
2017-11-03T15:42:01.000012
Margaret
clojurians
clojure
they vary widely in quality and generality though which is why it’s not as obvious as you may think on what to add
2017-11-03T16:28:58.000097
Sonny
clojurians
clojure
Does anyone know if there is a website / post that outlines some of the main Clojure libraries (e.g. Ring, Compojure, Yada, http-kit, Aleph, etc), what each one does and how they similar / differ to each other, which are currently preferred, etc.?
2017-11-03T16:35:07.000484
Senaida
clojurians
clojure
if it doesn't exist it would be an interesting project
2017-11-03T16:37:23.000331
Herlinda
clojurians
clojure
Agreed
2017-11-03T16:37:33.000053
Senaida
clojurians
clojure
I know JUXT have the Clojure Radar
2017-11-03T16:38:13.000365
Senaida
clojurians
clojure
I tried to write something similar except it took into account the participation in the community of the library author. I got stuck on the calculating library author scores
2017-11-03T16:39:01.000243
Herlinda
clojurians
clojure
<https://juxt.pro/radar.html>
2017-11-03T16:39:20.000253
Senaida
clojurians
clojure
Actually, that looks like a good overview
2017-11-03T16:39:54.000155
Senaida
clojurians
clojure
<https://www.clojure-toolbox.com/>
2017-11-03T16:39:57.000330
Jonas
clojurians
clojure
not sure how up to date it is
2017-11-03T16:40:03.000668
Jonas
clojurians
clojure
Thanks Adrian :+1: That's a pretty large list of libraries
2017-11-03T16:40:57.000054
Senaida
clojurians
clojure
I thought of clojure-toolbox too, but it only categorizes, it doesn’t really compare them
2017-11-03T16:58:44.000574
Margaret
clojurians
clojure
Hi, I'm experiencing a strange behaviour with cljs-http, I don't seem to be able to get the response values outside of the go block. Inside the go block everything's fine, but when I return a value outside of it, I get a `#object[cljs.core.async.impl.channels.ManyToManyChannel]`. Does anybody know what I'm doing wrong?
2017-11-04T05:30:41.000002
Chang
clojurians
clojure
<@Chang> <https://clojuredocs.org/clojure.core.async/go> &gt; Returns a channel which will receive the result of the body when completed
2017-11-04T05:39:12.000010
Terra
clojurians
clojure
<@Terra> sigh, this means I can't make go return a normal value? If I need to put the value in an atom I'm loosing the decoupling (it's better than using callbacks, but still...)
2017-11-04T06:41:10.000025
Chang
clojurians
clojure
Go is not blocking so you cannot return a normal value. If you want that just leave out the go macro.
2017-11-04T07:10:43.000021
Karolyn
clojurians
clojure
Or possibly you just want to &lt;!! The returning channel to block the outer thread.
2017-11-04T07:11:54.000033
Karolyn
clojurians
clojure
Out of curiosity, does anyone know why `if-some?` isn't part of the language? I found myself writing `(if (some? some-value))` pretty often and ended up writing a macro for it: `if-some?`. Just thinking that maybe I missed something, and that there's already a better way to accomplish the same outcome. Here's how I use it: <https://github.com/pcolliander/api-test/commit/655d1347e085d5c688b8e2a38581ebfe0a2b53e9>
2017-11-04T08:13:31.000045
Earlene
clojurians
clojure
You could make the same case for many predicates, like if-every?, etc. doesn't make sense to bloat the lang API or mix abstractions like that.
2017-11-04T08:22:05.000038
Marnie
clojurians
clojure
It's simple enough to combine them, your macro literally just adds one hyphen and removes two parens, a net one character change, right?
2017-11-04T08:23:59.000035
Marnie
clojurians
clojure
guess that's true, yeah just did it for readability
2017-11-04T08:30:31.000012
Earlene
clojurians
clojure
Is the regular syntax hard to read? Adding macros often makes things harder to read because it's not always clear what the macros are doing. Always prefer the core language to writing new macros until the benefits of a macro are obvious.
2017-11-04T08:48:36.000036
Marnie
clojurians
clojure
<@Karolyn> yes, I realized that. my expectation was for go to be a full continuation, I guess that's not true.
2017-11-04T09:17:33.000089
Chang
clojurians
clojure
i'm in the browser, so no &lt;!! :slightly_smiling_face:
2017-11-04T09:19:02.000055
Chang
clojurians
clojure
<@Earlene> notice there's also `if-some` which is similar to `if-let`. you can also just use `if` if you can accept both `nil` and `false`
2017-11-04T14:08:13.000076
Terra
clojurians
clojure
Hi guys
2017-11-04T14:25:38.000049
Mallory
clojurians
clojure
why this case don't work <https://gist.github.com/aibrahim/f78e6bb6ff1e41bd35883ead380db615> ?
2017-11-04T14:28:51.000051
Mallory
clojurians
clojure
Maybe it’s because the call to `eval` tries to resolve `core/one` and not `foo/one`?
2017-11-04T14:35:59.000047
Keva
clojurians
clojure
<@Keva> so what do you think to make this clean in the code?
2017-11-04T14:45:47.000027
Mallory
clojurians
clojure
(def numbers '(foo/one foo/two foo/three))
2017-11-04T14:46:13.000049
Mallory
clojurians
clojure
?
2017-11-04T14:46:13.000117
Mallory
clojurians
clojure
then eval?
2017-11-04T14:46:17.000041
Mallory
clojurians
clojure
it’s not that common to use eval
2017-11-04T14:51:37.000091
Jonas
clojurians
clojure
but when I do, i often explicitly set the ns when calling eval
2017-11-04T14:51:57.000001
Jonas
clojurians
clojure
something like
2017-11-04T14:52:01.000066
Jonas
clojurians
clojure
```(binding [*ns* (the-ns 'foo)] (eval numbers))```
2017-11-04T14:52:51.000024
Jonas
clojurians
clojure
<@Jonas> thanks but can i you try this example at your machine
2017-11-04T14:59:26.000084
Mallory
clojurians
clojure
it's still not working
2017-11-04T14:59:44.000068
Mallory
clojurians
clojure
that will result in an error if foo/one is not a function
2017-11-04T14:59:52.000015
Margaret
clojurians
clojure
eval on a list calls it
2017-11-04T14:59:57.000040
Margaret
clojurians
clojure
perhaps you want `(map (comp deref resolve) numbers)` but really hte important question is why you are even indirecting things this way
2017-11-04T15:00:27.000169
Margaret
clojurians
clojure
<@Jonas> thanks man done now using yours it's my fault
2017-11-04T15:02:17.000098
Mallory
clojurians
clojure
<@Margaret> bad practice, i'm still working on this
2017-11-04T15:02:33.000085
Mallory
clojurians
clojure
you can use `(def numbers '(list one two three))`
2017-11-04T15:03:02.000087
Jonas
clojurians
clojure
sure, that would get you the right answer, but using clojure's compiler to make your code work at runtime is like using a fork lift to carry your lunch box
2017-11-04T15:03:43.000117
Margaret
clojurians
clojure
eval is a big heavy slow tool, meant for hard weird structural problems
2017-11-04T15:04:02.000015
Margaret
clojurians
clojure
sometimes it’s fun to drive around a fork lift :slightly_smiling_face:
2017-11-04T15:04:08.000012
Jonas
clojurians
clojure
not for getting some values from symbols
2017-11-04T15:04:09.000063
Margaret
clojurians
clojure
if you want the performance penalty and code that is hard to reason about, go for it I guess
2017-11-04T15:04:39.000084
Margaret
clojurians
clojure
but really at that point just use mutation, it's easier to wrap your head around and performs much better
2017-11-04T15:05:01.000131
Margaret
clojurians
clojure
eval is a great way to get really hard to fix bugs
2017-11-04T15:05:17.000124
Margaret
clojurians
clojure
yea, i’m not suggesting to use it for production projects
2017-11-04T15:05:17.000136
Jonas
clojurians
clojure
but sometimes it’s fun to just tinker with
2017-11-04T15:05:43.000060
Jonas
clojurians
clojure
and sometimes it's a very big benefit using it
2017-11-04T15:06:00.000011
Mallory
clojurians
clojure
even in production
2017-11-04T15:06:05.000030
Mallory
clojurians
clojure
which is?
2017-11-04T15:06:07.000070
Margaret
clojurians
clojure
eval
2017-11-04T15:06:15.000020
Mallory
clojurians
clojure
no, what's the benefit?
2017-11-04T15:06:19.000093
Margaret
clojurians
clojure
I’ve used it for a project that is similar to the ipython notebooks
2017-11-04T15:06:37.000035
Jonas
clojurians
clojure
sure - you're making a compilation and code evaluation tool, that makes sense
2017-11-04T15:06:59.000030
Margaret
clojurians
clojure
yea
2017-11-04T15:07:32.000026
Jonas
clojurians
clojure
<@Margaret> well, what is the best practice in my situation above , how can do this ?
2017-11-04T15:08:00.000022
Mallory
clojurians
clojure
<@Margaret> list with other vars in it and maybe i have deeper like this
2017-11-04T15:08:23.000035
Mallory
clojurians
clojure
```(def one 1) (def two 2) (def three 3) (def numbers [one two three])```
2017-11-04T15:09:27.000052
Jonas
clojurians
clojure
<@Mallory> if you need runtime lookup rather than compile time, you can explicitly look up the vars with resolve and dereference them
2017-11-04T15:10:38.000017
Margaret
clojurians
clojure
it's cleaner to actually access the namespace as <@Jonas> shows there
2017-11-04T15:10:51.000087
Margaret
clojurians
clojure
ah
2017-11-04T15:11:02.000065
Mallory
clojurians
clojure
that's helpful for me
2017-11-04T15:11:08.000088
Mallory
clojurians
clojure
thanks guys
2017-11-04T15:11:15.000020
Mallory
clojurians
clojure
the thing about this is that when eval results in a weird and hard to reproduce behavior in clojure, it's not because your notebook is poorly designed, its because the user fed it bad code
2017-11-04T15:11:32.000128
Margaret
clojurians
clojure
but what I see people trying to do (like in this example here) is use eval to glue things together, and in that case you get a weird hard to weed out runtime error that is your fault, not the user's
2017-11-04T15:12:33.000079
Margaret
clojurians
clojure
agreed. using `eval` is almost never the right tool
2017-11-04T15:12:37.000044
Jonas
clojurians
clojure
there’s a lot of blog articles that talk about how cool lisps are because lisps have `eval` and macros. I think that’s why you sometimes get new folks to clojure trying those things out. on the one hand, using macros or `eval` is probably not the best solution to most problems, but on the other hand it’s a fun part of the language to play with if you’ve come from other languages that don’t make features like `eval` or macros as easy
2017-11-04T15:16:44.000030
Jonas
clojurians
clojure
I cannot reformat the json response (ring response) I am getting after a simple get request to my database. I would like fetch data from my database and formate the data into a map. below is the format I would like to get back from my json resonse in postman. Could someone please help format the response.? does any have an example project i Could look at? Below is the code flow.... [ {:first-name "mike", :last-name "tall" :team "football"}, {:first-name "nick", :last-name "tall" :team "york"}, {:first-name "ball", :last-name "tall" :team "sea"} ]
2017-11-04T17:03:13.000022
Lisha
clojurians
clojure
hi! I'm trying to understand how to use "component". I've created a component to handle configuration variables. This is then given to the component that manages my MongoDb connection. However, how do I get the Mongo component in that namespace that is actually calling Mongo? I mean of course I could turn that namespace into a component as well, but it a seems too much for me, since this namespace holds no state overwise (it just takes the mongo connection as parameter and returns some data). Of course one way would be to store the system map in some central namespace as a var and in such cases reach out for that.. but that is explicitly discouraged in the component documentation.. so what to do instead?
2017-11-04T17:09:01.000014
Lieselotte
clojurians
clojure
the component is a value that can be passed to functions
2017-11-04T17:09:57.000020
Margaret
clojurians
clojure
you don't need to store it, your app can pass the components to things that use them
2017-11-04T17:10:16.000125
Margaret
clojurians
clojure
in my production app, the mongo functions are passed a component that contains the mongo connection and db, you might even want to skip the component and just pass the connection, which should be a value in the component, to the functions that use it
2017-11-04T17:11:38.000033
Margaret
clojurians
clojure
does 'float-array' return an immutable? if yes, what does NOT return an immutable if no, how do I set elements of a float-array ?
2017-11-04T17:13:29.000009
Berry
clojurians
clojure
there is no such thing as an immutable array, you can use aset
2017-11-04T17:13:55.000029
Margaret
clojurians
clojure
see also amap, areduce, etc. etc.
2017-11-04T17:14:12.000039
Margaret
clojurians
clojure
``` (def x (float-array (range 1000))) (aset x 20 0) ```
2017-11-04T17:14:28.000116
Berry
clojurians
clojure
no matching method found aset
2017-11-04T17:14:33.000029
Berry
clojurians
clojure
```+user=&gt; (doc aset) ------------------------- clojure.core/aset ([array idx val] [array idx idx2 &amp; idxv]) Sets the value at the index/indices. Works on Java arrays of reference types. Returns val. nil ```
2017-11-04T17:15:12.000124
Margaret
clojurians
clojure
0 isn't a float, that's the non matching method
2017-11-04T17:15:29.000050
Margaret
clojurians
clojure
also why a float array instead of double array?
2017-11-04T17:15:40.000002
Margaret
clojurians
clojure
hmm, 0.0 doesn't work either, I need (float 0.0)
2017-11-04T17:15:57.000028
Berry
clojurians
clojure
I'm interfacing with some gpu / ndarray stuff that uses floats
2017-11-04T17:16:07.000020
Berry
clojurians
clojure
right, 0.0 isn't a float, it's a double
2017-11-04T17:16:08.000084
Margaret
clojurians
clojure
<@Margaret> that's OK, but how does *that* code get the component that is calling the mongoDB functions? I mean my call chain is Jetty -&gt; Pedestal -&gt; Some business logic namespace that is pure functions -&gt; MongoDb namespace. Currently I have a component for Jetty, Pedestal and Mongo
2017-11-04T17:16:57.000035
Lieselotte
clojurians
clojure
your handler should be using the component, your app startup can deliver the component to the handler for example
2017-11-04T17:17:40.000051
Margaret