本文整理汇总了C#中clojure.lang.Symbol.withMeta方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.withMeta方法的具体用法?C# Symbol.withMeta怎么用?C# Symbol.withMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clojure.lang.Symbol
的用法示例。
在下文中一共展示了Symbol.withMeta方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: intern
public static Keyword intern(Symbol sym)
{
Keyword k = null;
WeakReference existingRef = _symKeyMap.Get(sym);
if (existingRef == null)
{
if (sym.meta() != null)
sym = (Symbol)sym.withMeta(null);
k = new Keyword(sym);
WeakReference wr = new WeakReference(k);
wr.Target = k;
existingRef = _symKeyMap.PutIfAbsent(sym, wr);
}
if (existingRef == null)
return k;
Keyword existingk = (Keyword)existingRef.Target;
if (existingk != null)
return existingk;
// entry died in the interim, do over
// let's not get confused, remove it. (else infinite loop).
_symKeyMap.Remove(sym);
return intern(sym);
}
示例2: intern
public static Keyword intern(Symbol sym)
{
if (sym.meta() != null)
sym = (Symbol)sym.withMeta(null);
// TODO: Analyze this code for improvements
Keyword k = new Keyword(sym);
//Keyword existing = _symKeyMap.PutIfAbsent(sym, k);
//return existing == null ? k : existing;
WeakReference wr = new WeakReference(k);
wr.Target = k;
WeakReference existingRef = _symKeyMap.PutIfAbsent(sym, wr);
if (existingRef == null)
return k;
Keyword existingk = (Keyword)existingRef.Target;
if (existingk != null)
return existingk;
// entry died in the interim, do over
// let's not get confused, remove it. (else infinite loop).
_symKeyMap.Remove(sym);
return intern(sym);
}