Deep Equality (lazy)

by Ricardo Fernández Serrata

Version 1 (June 5, 2021)

Download (5 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.


3.0 average rating from 1 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Rate and review within the app in the Community section.