[svn] r6610: nemerle/trunk/lib/narray.n
malekith
svnadmin at nemerle.org
Mon Sep 4 09:35:37 CEST 2006
Log:
Fix some typos.
Author: malekith
Date: Mon Sep 4 09:35:36 2006
New Revision: 6610
Modified:
nemerle/trunk/lib/narray.n
Modified: nemerle/trunk/lib/narray.n
==============================================================================
--- nemerle/trunk/lib/narray.n (original)
+++ nemerle/trunk/lib/narray.n Mon Sep 4 09:35:36 2006
@@ -65,29 +65,29 @@
}
/** Convert collection to array. */
- public ToArray[T] (this sourse : SCG.ICollection[T]) : array [T]
+ public ToArray[T] (this source : SCG.ICollection[T]) : array [T]
{
- if (sourse is null)
+ if (source == null)
array (0)
else
{
- def tmp = array (sourse.Count);
- sourse.CopyTo (tmp, 0);
+ def tmp = array (source.Count);
+ source.CopyTo (tmp, 0);
tmp
}
}
/** Convert sequence to array. */
- public ToArray[T] (this sourse : SCG.IEnumerable [T]) : array [T]
+ public ToArray[T] (this source : SCG.IEnumerable [T]) : array [T]
{
- match (sourse)
+ match (source)
{
| coll is SCG.ICollection[T] => coll.ToArray();
| null => array (0);
| _ =>
def dest = SCG.List();
- foreach (elem in sourse)
+ foreach (elem in source)
dest.Add(elem);
dest.ToArray()
@@ -95,35 +95,35 @@
}
/**
- * Convert collection of one type to array of another type.
+ * Convert a collection of one type to an array of another type.
*/
- public ToArray[From, To] (this sourse : SCG.ICollection[From],
+ public ToArray[From, To] (this source : SCG.ICollection[From],
f : From -> To) : array [To]
{
- if (sourse is null)
+ if (source == null)
array (0)
else
{
- def tmp = array (sourse.Count);
- sourse.CopyTo (tmp, 0);
+ def tmp = array (source.Count);
+ source.CopyTo (tmp, 0);
tmp.ConvertTo (f)
}
}
/**
- * Convert sequence of one type to array of another type.
+ * Convert a sequence of one type to an array of another type.
*/
- public ToArray[From, To] (this sourse : SCG.IEnumerable [From],
+ public ToArray[From, To] (this source : SCG.IEnumerable [From],
f : From -> To) : array [To]
{
- match (sourse)
+ match (source)
{
| coll is SCG.ICollection[From] => coll.ToArray (f);
| null => array (0);
| _ =>
def dest = SCG.List();
- foreach (elem in sourse)
+ foreach (elem in source)
dest.Add(f (elem));
dest.ToArray()
@@ -131,15 +131,15 @@
}
/** Convert sequence to array with filtration. */
- public ToArrayFiltered[T] (this sourse : SCG.IEnumerable [T], isMatch : T -> bool) : array [T]
+ public ToArrayFiltered[T] (this source : SCG.IEnumerable [T], isMatch : T -> bool) : array [T]
{
- match (sourse)
+ match (source)
{
| null => array (0);
| _ =>
def dest = SCG.List();
- foreach (elem when isMatch(elem) in sourse)
+ foreach (elem when isMatch(elem) in source)
dest.Add(elem);
dest.ToArray()
@@ -469,57 +469,57 @@
/**
* Cast array to covariant subtype.
*/
- public ToBase[Derive, Base] (this sourse : array [Derive]) : array [Base]
+ public ToBase[Derive, Base] (this source : array [Derive]) : array [Base]
where Base: class
where Derive: Base, class
{
- (sourse : object) :> array [Base]
+ (source : object) :> array [Base]
}
/**
* Convert array of one type to other.
*/
- public ConvertTo[From, To] (this sourse : array [From], f : From -> To) : array [To]
+ public ConvertTo[From, To] (this source : array [From], f : From -> To) : array [To]
{
- mutable dest = array(sourse.Length);
+ mutable dest = array(source.Length);
- for (mutable i = 0; i < sourse.Length; i++)
- dest[i] = f (sourse[i]);
+ for (mutable i = 0; i < source.Length; i++)
+ dest[i] = f (source[i]);
dest;
}
/** Attention! It's inplace sort. */
- public SortInplace[T] (this sourse : array [T], comparison : System.Comparison[T]) : array [T]
+ public SortInplace[T] (this source : array [T], comparison : System.Comparison[T]) : array [T]
{
- System.Array.Sort(sourse, comparison);
- sourse
+ System.Array.Sort(source, comparison);
+ source
}
//FixMe: narray.n(457,37,457,58): error : Internal compiler error, please report
// a bug to bugs.nemerle.org. Yon ``False'' failed in file generation/Typer4.n, line 186:
///** Attention! It's inplace sort. */
- //public Sort[T, Val] (this sourse : array [T], getComparableValue : T -> Val) : array [T]
+ //public Sort[T, Val] (this source : array [T], getComparableValue : T -> Val) : array [T]
// where Val: System.IComparable[Val]
//{
// def Cmp(x : T, y : T) : int
// {
// getComparableValue(x).CompareTo(getComparableValue(y))
// }
- // System.Array.Sort.[T](sourse, System.Comparison.[T](Cmp));
- // sourse
+ // System.Array.Sort.[T](source, System.Comparison.[T](Cmp));
+ // source
//}
- public Clone[T](this sourse : T) : T
+ public Clone[T](this source : T) : T
where T: System.ICloneable
{
- (sourse.Clone() :> T)
+ (source.Clone() :> T)
}
/** Convert array to string. */
- public ToString['a] (this sourse : array ['a], separator : string) : string
+ public ToString['a] (this source : array ['a], separator : string) : string
{
- string.Join(separator, sourse.ConvertTo(value => value.ToString()));
+ string.Join(separator, source.ConvertTo(value => value.ToString()));
}
}
} /* end of namespace */
More information about the svn
mailing list