GLEAM (BEAM language)

%3 cluster_6232e2a6_39de_4afb_b2d2_c1148d379189 GLEAM (BEAM language) _f0dec2bf_20ec_4970_9f30_45f85d18ab6a Erlang __0:cluster_6232e2a6_39de_4afb_b2d2_c1148d379189->_f0dec2bf_20ec_4970_9f30_45f85d18ab6a
    pub type Tree(value) {
      Leaf(value)
      Node(Tree(value), Tree(value))
    }

    pub fn any(tree: Tree(a), check: fn(a) -> Bool) -> Bool {
      case tree {
        Leaf(i) -> check(i)
        Node(left, right) -> any(left, check) || any(right, check)
      }
    }

    pub fn has_even_leaf(tree: Tree(Int)) -> Bool {
      any(tree, fn(i) {
        i % 2 == 0
      })
    }