soegaard2
2022-4-12 15:32:30

Before I spend energy on completing my implementation - is there an implementation of “Python counters” anywhere?

https://docs.python.org/3/library/collections.html#collections.Counter


laurent.orseau
2022-4-12 15:37:47

If you search for freq or frequenc on the online docs you may get a number of related results. Usually simpler implementations than python’s Counter though


laurent.orseau
2022-4-12 15:40:56

There’s also one in the main distr somewhere but I can never remember where (math/distributions ? plot ? )


laurent.orseau
2022-4-12 15:41:09

There’s also occurrences in bazaar/dict



soegaard2
2022-4-12 15:45:03

I can’t find bazaar in the online docs?


laurent.orseau
2022-4-12 15:46:34

It’s because it’s not documented (on purpose). Feel free to steal the code anyway: https://github.com/Metaxal/bazaar/blob/master/dict.rkt#L91


soegaard2
2022-4-12 15:46:49

Ah!


samdphillips
2022-4-12 16:12:11

In some ways it sounds like a multiset or a bag.


samdphillips
2022-4-12 16:12:20

There is a multiset in Rebellion


laurent.orseau
2022-4-12 16:13:09

The result is certainly a multiset. I guess @soegaard2’s question is about how to collect rather than represent


soegaard2
2022-4-12 16:20:33

Exactly.


soegaard2
2022-4-12 16:20:49

I’ll check multiset.


sschwarzer
2022-4-12 21:16:54

In my opinion something that’s not documented may as well not exist; at least non-discoverability is a big problem.


soegaard2
2022-4-12 21:19:39

I think Laurent is using bazaar the same way I am using this-and-that.


samdphillips
2022-4-12 21:20:08

Documentation might imply support.


soegaard2
2022-4-12 21:21:00

@samdphillips Did you catch my answer on a “repl for sketching” - or did get lost in the noise?


samdphillips
2022-4-12 21:22:21

I saw. I’ll paste my thoughts over in the thread.


laurent.orseau
2022-4-12 21:26:30

Yes, bazaar is undocumented because it’s not meant for being used as a library. It’s a collection of half-baked utilities, and sometimes some of them make it out to their own library. Surprisingly, it’s been quite stable anyway, but backward compatibility is at my discretion.