//  Copyright © 2015 Rob Rix. All rights reserved.

enum ABT<Applied, Recur> {
	case Variable(Name)
	case Abstraction(Name, Recur)
	case Constructor(Applied)
}

indirect enum ABTTerm {
	case In(Set<Name>, ABT<AST<ABTTerm>, ABTTerm>)

	var freeVariables: Set<Name> {
		guard case let .In(variables, _) = self else { return [] }
		return variables
	}
}

enum AST<Recur> {
	case Lambda(Recur)
	case Application(Recur, Recur)
}

//  Copyright © 2015 Rob Rix. All rights reserved.

enum ABT<Applied, Recur> {
	case Variable(Name)
	case Abstraction(Name, Recur)
	case Constructor(Applied)
}

indirect enum ABTTerm {
	case In(Set<Name>, ABT<AST<ABTTerm>, ABTTerm>)
}

enum AST<Recur> {
	case Lambda(Recur)
	case Application(Recur, Recur)
}

--- 
+++ 
@@ -8,6 +8,11 @@
 
 indirect enum ABTTerm {
 	case In(Set<Name>, ABT<AST<ABTTerm>, ABTTerm>)
+
+	var freeVariables: Set<Name> {
+		guard case let .In(variables, _) = self else { return [] }
+		return variables
+	}
 }
 
 enum AST<Recur> {
Add a property returning the free variables in a term.
