Fork me on GitHub
#clojure-uk
<
2020-08-18
>
dharrigan05:08:59

Good Morning!

dominicm08:08:01

Morning 🙂

dominicm08:08:06

Wait a minute...

danstone15:08:04

I wish there was a channel to post for feedback on lib ideas, cold-shower/sanity-check type stuff. What happens if I post it here... I mean, I'm in the UK right. I've posted here before...

danstone15:08:45

Obviously don't use this, still needs a lot of work before its done. I mean I need to do my full property test suite...

danstone15:08:40

• Would people use it? 'is it worth the effort getting it lib quality' • I am worried about misuse of auto-idx • I am worried people might not understand what the hell this is even about.

danstone15:08:35

As this is quite general purpose I'd hope it'd be useful quite broadly on most kinds of non-trivial application.

danstone15:08:59

This sort of library I feel needs a massively high quality bar so I will probably spend a lot of time on it before I release it, hence my request for a cold shower.

danstone15:08:21

Don't want to do a load of work that produces something nobody wants to use.

Jakob Durstberger15:08:46

I am quite a Clojure noob, so I am not quite sure what I’d use that for. Maybe it would be possible to add some examples?

danstone15:08:11

I don't know if I'd recommend this for beginners, but I think a section on what your options are and where this fits would be good.

mccraigmccraig15:08:45

(having only looked at the README) i would like clojurescript support - we manually construct secondary indexes on a few collections in our re-frame app-db map

danstone15:08:28

Yes this would be very suitable for re-frame

danstone15:08:58

as your collections are not opaque, they look and smell exactly like normal collections all the subscription invalidation would work on these whilst still providing some nifty query support

danstone15:08:32

I would be looking to do a clojurescript implementation at some point, but my dream would be somebody would help me with that.

danstone15:08:27

I'd probably polish the clj implementation first to test the waters and see if there is demand

Jakob Durstberger15:08:46

I am fine with it not being suitable for beginners, but I’d least like to understand where I could (maybe) apply it. So one day I could go “ah, maybe lib x would be good here”

danstone15:08:13

@UM8P1G72Q I agree, I'm gonna work on something in the readme 🙂

danstone15:08:30

readme is normally more work than the actual lib tbh

danstone15:08:17

@UM8P1G72Q see the Why section I just added? Does that clarify at all?

Jakob Durstberger16:08:18

Yeah that’s quite useful 🙂 Two comments. “… introducing incidental complexity to their signatures, which I find very, very smelly.” • I only know inherent and accidental complexity, I assume you mean the later? • “which I find very, very smelly” To me that is not helpful. Why is it smelly? Is it because it creates unnecessary coupling or any other “metric” that is more objective?

rickmoynihan16:08:13

Interesting lib… I think I see the usecase, as I’ve built secondary indexes too… particularly in reagent/re-frame app dbs. However I tend not to do so much of this now, as we use an indexed in memory graph database to do this sort of thing. i.e if you’re maintaining various secondary indexes you’re probably also approaching wanting a query language too. That said I can imagine there are still uses. Anyway in terms of what I think would benefit this: 1. better more explicit examples that show the data and results too. Eliding them means readers are just guessing at what things do. 2. Benchmarks 3. Comparison or suggestions for alternative approaches, e.g. in memory databases, perhaps also memoize or core.cache is better for some smaller use cases, also perhaps specter?

rickmoynihan16:08:25

Also to be clear I think cljc support rather than just cljs support would be useful (i.e. working isomorphically in both environments)

danstone16:08:37

yea, I would attempt a .cljc first. I believe though if your .jar contains both a idx.cljs and idx.clj file the runtime will pick the right one? I am worried the branches will noise up the code, I mean there is a lot of java-specific stuff in there.

rickmoynihan16:08:38

yes you can organise it like that — or with reader conditionals.

rickmoynihan16:08:37

Regarding the database point, I seem to recall cgrand making a good point on this… which is that using complex clojure datastrutures as databases is similar to using a hierarchical database from the 1960s. A model that was essentially destroyed by the relational model — because they’re painful to query, update, index etc. I find that argument quite compelling, though I guess I didn’t have idx at the time… Curious what your thoughts are about this and that spectrum of options though

danstone16:08:11

I live and breath relational data, and long for the day that programming with logic, rules and relations is the norm (no pun intended). This lib is not really trying to compete with databases though. If you can pour all of your data into datascript and use that great.

danstone16:08:56

A lot of use cases for idx will be internally in functions where you whack on an auto-idx do some work and then unwrap and return. Much like you would use a transient.

danstone16:08:54

In the large use relational databases, in the small use databases when it makes sense. Use idx for ad-hoc collection indexing as you would group-by.

dominicm19:08:52

Love this library. Been watching it since you created it.

dominicm19:08:43

I haven't figured out yet if it would help me reorder elements in an array efficiently, but that would be great.

danstone07:08:25

@U09LZR36F I'm not exactly sure how this would help? Do you have an example of the problem at hand?

rickmoynihan08:08:42

@danstone: yeah that makes a lot of sense, I’ve just seen the changes you made to the why section in the README. I could certainly see myself using something like this.

dominicm08:08:57

@danstone if you have [1 2 3 4 5] and you want to place 5 between 2 and 3 that's annoyingly difficult to do efficiently.

dominicm08:08:31

The classic solution involves subvec and other magic :)

dominicm08:08:13

5 is not the best example there. Maybe placing 4 between 2 and 3. The instructions are arbitrary.

rickmoynihan08:08:33

Can idx could help with that? I might well be missing something.

danstone10:08:44

I mean you could use the sorted index to write a function that does that in a linear pass. If you want to do multiple reinsertions you might be able to use replace-by.

danstone10:08:56

(let [coll (auto-idx [1 2 3 4 5])
      target 5
      left (ascending coll identity <= 2)
      right (remove #{target} (ascending coll identity >= 3))]
  (concat left [target] right))
? @U09LZR36F

danstone10:08:59

idx really doesn't offer you anything you couldn't do yourself manually of course. (e.g I could create a sorted map there and do the same thing)

mccraigmccraig15:08:52

try it and see @danstone - what could possibly go wrong 😃

danstone15:08:35

I might go back to my its-not-going-to-work position that I held this morning before rafts of tweaks. Be gentle folks.

danstone15:08:56

^^ see thread

zyxmn15:08:43

Any chance we can get giphy integrated here ?

Jakob Durstberger15:08:27

I guess you can ask in #slack-help 🙂

Jakob Durstberger15:08:49

Though Sean Corfield is also in here 😄

alexlynham15:08:35

i think there's a giphy ban in this slack

zyxmn15:08:37

thanks , i've posted in slack-help

alexlynham15:08:41

possibly for the best tbh

alexlynham15:08:57

i don't think it would be popular

zyxmn15:08:56

sayonara freedom of expression 😞 . oh well hope they reconsider , ill wait and see what the moderators say on slack help

alexlynham15:08:28

not sure if serious not-sure-fry

Ben Hammond16:08:53

does giphy really improve signal:noise ratio? am I just a grumpy old man?

alexlynham16:08:16

it improves the gif ratio

alexlynham16:08:02

now @mccraigmccraig will vouch for the fact that i'm very pro gif but it's rarely if ever that i've missed the integration on this particular slack tbh

alexlynham16:08:21

(im not a racist, some of my best friends are gifs! etc)

mccraigmccraig16:08:22

@alex.lynham does indeed generally tend towards the pro end of the gif tendency spectrum

rickmoynihan16:08:07

seconded 😆 , though the gif choices can be very obscure — some arguably have an audience of 1.

alexlynham16:08:28

sometimes giphy gives you a weird one and you just have to take the bitter with teh better ya know

dharrigan16:08:58

I use gif keyboard for our slack at work

dharrigan16:08:34

personaly, I find it useful to lighten the mood or to have a nice little funny moment

dharrigan16:08:02

with /gifs you can choose what to send, it's not a random obscure gif

zyxmn16:08:42

It's just to lighten the mood as mentioned above .

seancorfield17:08:59

As @alex.lynham surmises, the Admin team discussed giphy and decided it was just too distracting and too open to abuse -- it can also be very bad for people who are photo-sensitive because of the "flashing" that you get with some results (it's also why we removed the :party-parrot: emoji -- although I see a couple of flashing emojis have come back).

Jakob Durstberger07:08:01

Can I just say how amazing I think it is that you are trying to be inclusive to people with photo-sensitivity.

dharrigan17:08:11

cute little doggie 🙂

seancorfield17:08:41

Sigh. Yes. It's not quite as bad as the parrot but it is really distracting and bad for folks who are sensitive to that kind of thing.

seancorfield17:08:33

I responded in #slack-help as well so there's a more public "official response".

seancorfield17:08:10

(and all accessibility concerns aside, we are on the free plan here and integrations are "precious" because they are very limited)

seancorfield17:08:07

I've been in several Slacks where animated emojis are banned out of consideration for people who are sensitive to flashing lights etc.

minimal17:08:28

there is the “Allow animated images and emoji” checkbox

seancorfield17:08:34

@minimal That's probably "new" since the policy was discussed. Nice to know.

minimal17:08:20

Yeah must be relatively new

seancorfield17:08:29

There are sometimes uses for animated images here: quick demos of features in tooling/editors -- but I'll mention it to the Admin Team...

seancorfield17:08:31

Ah, that's on a per-user preference basis -- so individual folks can opt out if they want (and if they know about it).