A distance spec is a list with eval(X, x0, ctx) and/or
eval_batch(X, X0, ctx). It may optionally define setup(X) to precompute
a context (e.g., scaling).
Examples
is_distance(distance_l2())
#> [1] TRUE
is_distance(list(eval = function(X, x0, ctx) rep(0, nrow(X))))
#> [1] TRUE