本文整理汇总了C#中clojure.lang.Symbol.meta方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.meta方法的具体用法?C# Symbol.meta怎么用?C# Symbol.meta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clojure.lang.Symbol
的用法示例。
在下文中一共展示了Symbol.meta方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Namespace
/// <summary>
/// Construct a namespace with a given name.
/// </summary>
/// <param name="name">The name.</param>
Namespace(Symbol name)
: base(name.meta())
{
_name = name;
_mappings.Set(RT.DEFAULT_IMPORTS);
_aliases.Set(RT.map());
}
示例2: 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);
}
示例3: 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);
}