本文整理汇总了C#中ScheminPair.Cons方法的典型用法代码示例。如果您正苦于以下问题:C# ScheminPair.Cons方法的具体用法?C# ScheminPair.Cons怎么用?C# ScheminPair.Cons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScheminPair
的用法示例。
在下文中一共展示了ScheminPair.Cons方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override IScheminType Execute(Environment env, Evaluator eval, ScheminPair args)
{
ScheminPair bindings = (ScheminPair) args.Car;
IScheminType expression = args.ElementAt(1);
ScheminPair first = new ScheminPair();
ScheminPair firstBinding = new ScheminPair(bindings.Car);
first = first.Append(new ScheminPrimitive("let"));
first = first.Append(firstBinding);
if (bindings.Cdr != null)
{
ScheminPair nextLet = new ScheminPair(bindings.Cdr);
nextLet = nextLet.Cons(new ScheminPrimitive("let*"));
nextLet = nextLet.Append(expression);
first = first.Append(nextLet);
}
else
{
first = first.Append(expression);
}
return first;
}
示例2: Execute
public override IScheminType Execute(Environment env, Evaluator eval, ScheminPair args)
{
ScheminPair listArg = (ScheminPair) args.Car;
ScheminPair reversed = new ScheminPair();
foreach (IScheminType type in listArg)
{
reversed.Cons(type);
}
return reversed;
}
示例3: Execute
public override IScheminType Execute(Environment env, Evaluator eval, ScheminPair args)
{
IScheminType function = args.Car;
ScheminPair argList = args.ListCdr();
ScheminPair toApply = (ScheminPair) args.ListCdr().Last();
ScheminPair list = new ScheminPair();
foreach (IScheminType type in toApply)
{
list = list.Append(type);
}
foreach (IScheminType type in argList)
{
if (type != toApply)
list = list.Cons(type);
}
list = list.Cons(function);
return list;
}
示例4: Parse
public ScheminPair Parse(List<Token> tokens, bool quoteLists)
{
TransformQuoteTokens(tokens);
int currentPosition = 0;
ScheminPair totalParsed = new ScheminPair();
while (currentPosition < tokens.Count)
{
totalParsed = totalParsed.Append(ParseTopLevel(tokens, ref currentPosition));
}
return totalParsed.Cons(new ScheminPrimitive("begin"));
}