<commit_before>//  Copyright (c) 2015 <NAME>. All rights reserved.

public enum Neutral: DebugPrintable {
	// MARK: Constructors

	public static func application(f: Neutral, _ v: Value) -> Neutral {
		return .Application(Box(f), v)
	}


	// MARK: Quotation

	public func quote(n: Int) -> Term {
		return analysis(
			ifFree: {
				$0.analysis(
					ifGlobal: const(Term.free($0)),
					ifLocal: const(Term.free($0)),
					ifQuote: Term.bound)
			},
			ifApplication: { Term.application($0.quote(n), $1.quote(n)) })
	}


	// MARK: Analyses

	public func analysis<T>(@noescape #ifFree: Name -> T, @noescape ifApplication: (Neutral, Value) -> T) -> T {
		switch self {
		case let .Free(n):
			return ifFree(n)
		case let .Application(n, v):
			return ifApplication(n.value, v)
		}
	}

<commit_msg>Quoted neutral terms are adjusted appropriately.<commit_after>//  Copyright (c) 2015 <NAME>. All rights reserved.

public enum Neutral: DebugPrintable {
	// MARK: Constructors

	public static func application(f: Neutral, _ v: Value) -> Neutral {
		return .Application(Box(f), v)
	}


	// MARK: Quotation

	public func quote(n: Int) -> Term {
		return analysis(
			ifFree: {
				$0.analysis(
					ifGlobal: const(Term.free($0)),
					ifLocal: const(Term.free($0)),
					ifQuote: { Term.bound(n - $0 - 1) })
			},
			ifApplication: { Term.application($0.quote(n), $1.quote(n)) })
	}


	// MARK: Analyses

	public func analysis<T>(@noescape #ifFree: Name -> T, @noescape ifApplication: (Neutral, Value) -> T) -> T {
		switch self {
		case let .Free(n):
			return ifFree(n)
		case let .Application(n, v):
			return ifApplication(n.value, v)
		}
	}


{'fraction_non_alphanumeric': 0.1574130567419158, 'fraction_numerical': 0.012202562538133009, 'mean_word_length': 3.2377260981912146, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '6473513', 'n_tokens_mistral': 674, 'n_tokens_neox': 566, 'n_words': 153}