def define_mangled_name(name, *params):
    """Return a definition appropriate for use as the definition of a :name:
       mangled using :params: as unique particules.

       :params: must be an iterable of names that are to be used as parameter
       to the mangling macro. If no :params: are provided, the macro to be
       generated is assumed an object like macro. To generate a nullary
       function like macro, pass an empty string as sole argument.
    """
    nparams = len(params)
    base = "nstl_mangled_{}".format(name)
    if params and params[0].strip():
        cat_params = "(" + ", _, ".join((base, ) + params) + ")"
        body = "JOY_CAT{}{}".format(len(cat_params.split(",")), cat_params)
    else:
        body = base

    params = ("(" + ", ".join(params) + ")") if params else ""

    return "#define nstl_{}{} {}".format(name, params, body)