def make_goal(func):
    """Decorator that turns a function of the form f(Substitution, ...) into
    a goal-creating function.

    For example:
        @make_goal
        def same(s, u, v):
            ...

    is equivalent to
        def same(u, v):
            def goal(s):
                ...
            return goal
    """

    def wrap(*args, **kwargs):
        def goal(s):
            return func(s, *args, **kwargs)

        return goal

    if func.__doc__ is not None:
        wrap.__doc__ = "produce a " + func.__doc__
    return wrap