<commit_before>// vim:syntax=lpc
constant Integer 	= 1 << __LINE__;
constant String 	= 1 << __LINE__;
constant Object 	= 1 << __LINE__;
constant Program 	= 1 << __LINE__;
constant Mapping 	= 1 << __LINE__;
constant Array	 	= 1 << __LINE__;
constant Function	= 1 << __LINE__;


int(0..1) check(mixed var, mixed spec) {
    if (intp(spec)) {
	switch(spec) {
	case Integer: return intp(var);
	case String: return stringp(var);
	case Object: return objectp(var);
	case Program: return programp(var);
	case Mapping: return mappingp(var);
	case Array: return arrayp(var);
	case Function: return functionp(var);
	default:
	    throw(({"bad spec!"}));
	}
    } else if (mappingp(spec)) {
	if (mappingp(var)) {
	    VAR: foreach(var; mixed key; mixed value) {
		foreach(spec; mixed t_key; mixed t_value) {
		    if (check(key, t_key) && check(value, t_value)) {
			continue VAR;
		    }
		}

		return 0;
	    }
	} else {
	    return 0;
	}
    } else if (arrayp(spec)) {
	if (arrayp(var)) {
	    VAR: foreach(var;; mixed value) {
		foreach(spec;; mixed t_value) }
		    if (check(value, t_value)) {
			continue VAR;
		    }
		}

		return 0;
	    }
	} else {
	    return 0;
	}
    } else if (functionp(spec)) {
	return spec(var);
    } else if (objectp(spec)) {
	return spec->check(var);
    } else {
	throw(({"bad spec!"}));
    }

    return 1;
}<commit_msg>use `() in objects instead of ->check()<commit_after>// vim:syntax=lpc
constant Integer 	= 1 << __LINE__;
constant String 	= 1 << __LINE__;
constant Object 	= 1 << __LINE__;
constant Program 	= 1 << __LINE__;
constant Mapping 	= 1 << __LINE__;
constant Array	 	= 1 << __LINE__;
constant Function	= 1 << __LINE__;


int(0..1) check(mixed var, mixed spec) {
    if (intp(spec)) {
	switch(spec) {
	case Integer: return intp(var);
	case String: return stringp(var);
	case Object: return objectp(var);
	case Program: return programp(var);
	case Mapping: return mappingp(var);
	case Array: return arrayp(var);
	case Function: return functionp(var);
	default:
	    throw(({"bad spec!"}));
	}
    } else if (mappingp(spec)) {
	if (mappingp(var)) {
	    VAR: foreach(var; mixed key; mixed value) {
		foreach(spec; mixed t_key; mixed t_value) {
		    if (check(key, t_key) && check(value, t_value)) {
			continue VAR;
		    }
		}

		return 0;
	    }
	} else {
	    return 0;
	}
    } else if (arrayp(spec)) {
	if (arrayp(var)) {
	    VAR: foreach(var;; mixed value) {
		foreach(spec;; mixed t_value) }
		    if (check(value, t_value)) {
			continue VAR;
		    }
		}

		return 0;
	    }
	} else {
	    return 0;
	}
    } else if (callablep(spec)) {
	return spec(var);
    } else {
	throw(({"bad spec!"}));
    }

    return 1;
}
{'fraction_non_alphanumeric': 0.1522880720180045, 'fraction_numerical': 0.010502625656414103, 'mean_word_length': 3.084226646248086, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5416796', 'n_tokens_mistral': 1066, 'n_tokens_neox': 978, 'n_words': 268}