This language bar is your friend. Select your favorite languages!

Idiom #114 Test deep equality

Set boolean b to true if objects x and y contain the same values, recursively comparing all referenced elements in x and y.
Tell if the code correctly handles recursive types.

let b = x == y;
void main()
{
    Bar x, y;
    b = deeplyEqual(x, y));
}
-1
import "reflect"
b := reflect.DeepEqual(x, y)
b = x == y
1
$b = ($x == $y);
b = x == y
x = [[1],[2,[3]]]
x << x  
y =  [[1],[2,[3]]]
y << y
b = x == y # => true
case class A(a: Int, b: Float, c: String)
val x = A(1,2.2f,"hello")
val y = A(1,2.2f,"hello")

b = x == y 

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org