protected BaseTemplate(IEnumerable <IToken> fTokens) : this( new ImmutableMap <TokenKey, IToken>(), ImmutableList.Empty <TokenReference>(), new ImmutableMap <InputKey, IInput>(), ProcessingQueue.Empty()) { foreach (var tok in fTokens) { if (tokenMap.ContainsKey(tok.Key)) { tokenSeq = tokenSeq.ConsLast(new TokenReference(tok.Key)); } else { foreach (var input in tok.Inputs) { if (!inputs.ContainsKey(input.Key)) { var newInput = input.Key.Type == InputType.Instance ? (IInput) new UnboundInput(input.Key) : new UnboundStaticInput(input.Key); inputs = inputs.Add(input.Key, newInput); } } tokenMap = tokenMap.Add(tok.Key, tok); tokenSeq = tokenSeq.ConsLast(new TokenReference(tok.Key)); } } }