Deep Equality (lazy)

by Ricardo “Rudxain” Fernández Serrata

Version 1 (September 26, 2023)

Download (76 downloads)

It relies on jsonEncode() to check if 2 flat or nested containers (or any values) are equal.

This delegates the job of iteration and recursion to the built-in JSON stringifier/serializer and compares the equality of the returned texts.

This is too strict when dealing with dictionaries, because the entry order matters. This means that if 2 dictionaries are equal, but the order of the entries is different, the output will be 0 instead of 1 (0 means different, 1 is equal)

For example, if the inner dictionary of A was {"hey": 2, "abc": 0, "empty": [[]]}, its entry order differs from that of B, which will make the flow print "a != b".

This is only useful if you need low block-count or if you are too lazy to 📋CP any of my 2 other flows. I haven't measured the performance, but most AM expressions evaluate faster than the execution of blocks, so this is very likely to be faster than any statement-based implementation.

Simplified: llamalab.com/automate/community/flows/39235

Rudxain profile: llamalab.com/automate/community/flows/42921

LICENSE: https://unlicense.org

3.0 average rating from 1 reviews

5 stars
0
4 stars
0
3 stars
1
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.