本文整理汇总了C#中IFn.applyTo方法的典型用法代码示例。如果您正苦于以下问题:C# IFn.applyTo方法的具体用法?C# IFn.applyTo怎么用?C# IFn.applyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFn
的用法示例。
在下文中一共展示了IFn.applyTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: swap
public object swap(IFn f, Object x, Object y, ISeq args)
{
for (; ; )
{
object v = deref();
object newv = f.applyTo(RT.listStar(v, x, y, args));
Validate(newv);
if (_state.CompareAndSet(v, newv))
{
NotifyWatches(v, newv);
return newv;
}
}
}
示例2: alterRoot
public object alterRoot(IFn fn, ISeq args)
{
object newRoot = fn.applyTo(RT.cons(_root, args));
Validate(getValidator(), newRoot);
object oldroot = _root;
_root = newRoot;
++_rev;
NotifyWatches(oldroot,newRoot);
return newRoot;
}
示例3: alterMeta
public IPersistentMap alterMeta(IFn alter, ISeq args)
{
_meta = (IPersistentMap)alter.applyTo(new Cons(_meta, args));
return _meta;
}
示例4: alter
public object alter(IFn fn, ISeq args)
{
set(fn.applyTo(RT.cons(deref(), args)));
return this;
}
示例5: DoCommute
/// <summary>
/// Post a commute on a ref in this transaction.
/// </summary>
/// <param name="r">The ref.</param>
/// <param name="fn">The commuting function.</param>
/// <param name="args">Additional arguments to the function.</param>
/// <returns>The computed value.</returns>
internal object DoCommute(Ref r, IFn fn, ISeq args)
{
if (!_info.IsRunning)
throw _retryex;
if (!_vals.ContainsKey(r))
{
object val = null;
try
{
r.EnterReadLock();
val = r.TryGetVal();
}
finally
{
r.ExitReadLock();
}
_vals[r] = val;
}
List<CFn> fns;
if (! _commutes.TryGetValue(r, out fns))
_commutes[r] = fns = new List<CFn>();
fns.Add(new CFn(fn, args));
object ret = fn.applyTo(RT.cons(_vals[r], args));
_vals[r] = ret;
return ret;
}