notjack
2021-2-1 08:14:14

That would be great, assuming enough people agree with that table’s opinions :p


laurent.orseau
2021-2-1 08:33:56

These are guidelines anyway, and the “consider using” is appropriate. There are some caveats though, in particular regarding efficiency. Last time I checked (some time ago), sets were much slower than hashes. An assoc list can have a very different performance than a hash which keys are lists.

Also: “A hash whose keys are symbols or strings —> A record” Only for fixed keys that are known in advance

Not sure about this one either: “A list of symbol-keyed hashes —> A table”


laurent.orseau
2021-2-1 08:34:25

But what would be even better is a table listing the properties of the different data structures (in particular in O notation)


notjack
2021-2-1 08:39:08

Both tables would be good. Property tables are great for comparing data structures. “Use this instead of this” tables are great for reviewing code. Straightforward substitution guidelines are easy for people to wrap their heads around.


laurent.orseau
2021-2-1 08:39:47

Agreed.


kellysmith12.21
2021-2-1 09:26:52

It is possible to dynamically build and use Rebellion records with arbitrary keys. (But I’d gladly take a dedicated reducer and a for form over keyword-apply)


laurent.orseau
2021-2-1 09:28:16

But if you add a key, you need to make a new record type, right?


laurent.orseau
2021-2-1 09:28:43

(I haven’t used them, I merely looked at the docs)


kellysmith12.21
2021-2-1 09:33:42

Rebellion has a record data type that is essentially a hash table keyed by keywords.


kellysmith12.21
2021-2-1 09:34:14

It’s a separate notion from define-record-type



laurent.orseau
2021-2-1 09:37:18

Aha! I hadn’t seen this, thanks. A little ambiguous maybe, this might need some clarification @notjack :slightly_smiling_face:


laurent.orseau
2021-2-1 09:39:37

Although this still mentions: > Use records instead of hash tables when keys are expected to be literal names written in source code. which doesn’t cover my usecase where I read keyword hashes from files then


kellysmith12.21
2021-2-1 09:47:43

As I hinted earlier, you can use keyword-apply to build records with arbitrary keys. However, proper support for dynamically building records is a future feature, if IIRC.


laurent.orseau
2021-2-1 09:50:44

I think I’ll stick with symbol hashes :slightly_smiling_face:


notjack
2021-2-1 22:19:36

rebellion/collection/record was one of the first things I made in rebellion, so, it’s not as worked-out as the other bits


notjack
2021-2-1 22:20:14

and I’m less sure it’s a good idea now


kellysmith12.21
2021-2-2 00:12:22

I was thinking rebellion/collection/record could be used to build a library for row types. But I suppose that such a thing could be build on top of rebellion/type/record.