/
IPersistentVector.cs
54 lines (49 loc) · 2.29 KB
/
IPersistentVector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Copyright (c) David Miller. All rights reserved.
* The use and distribution terms for this software are covered by the
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
* which can be found in the file epl-v10.html at the root of this distribution.
* By using this software in any fashion, you are agreeing to be bound by
* the terms of this license.
* You must not remove this notice, or any other, from this software.
**/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace clojure.lang
{
/// <summary>
/// Represents an immutable vector (int-indexing).
/// </summary>
public interface IPersistentVector: Associative, Sequential, IPersistentStack, Reversible, Indexed
{
/// <summary>
/// Gets the number of items in the vector.
/// </summary>
/// <returns>The number of items.</returns>
/// <remarks>Not sure why you wouldn't use <c>count()</c> intead.</remarks>
int length();
/// <summary>
/// Return a new vector with the i-th value set to <c>val</c>.
/// </summary>
/// <param name="i">The index of the item to set.</param>
/// <param name="val">The new value</param>
/// <returns>A new (immutable) vector v with v[i] == val.</returns>
IPersistentVector assocN(int i, object val);
/// <summary>
/// Creates a new vector with a new item at the end.
/// </summary>
/// <param name="o">The item to add to the vector.</param>
/// <returns>A new (immutable) vector with the objected added at the end.</returns>
/// <remarks>Overrides <c>cons</c> in <see cref="IPersistentCollection">IPersistentCollection</see> to specialize the return value.</remarks>
new IPersistentVector cons(Object o);
/// <summary>
/// Gets the number of items in the collection.
/// </summary>
/// <returns>The number of items in the collection.</returns>
/// <remarks>Overrides <c>count()</c> in both <see cref="IPersistentCollection">IPersistentCollection</see>
/// and <see cref="Counted">Counted</see> to resolve ambiguity for callers.</remarks>
new int count();
}
}