Skip to content

Instantly share code, notes, and snippets.

@timsgardner
Created November 20, 2014 06:26
Show Gist options
  • Save timsgardner/6dfef2bef752a61480d6 to your computer and use it in GitHub Desktop.
Save timsgardner/6dfef2bef752a61480d6 to your computer and use it in GitHub Desktop.
using clojure.core.protocols;
using clojure.lang;
using compile__stub.clojure.core;
using Microsoft.Scripting.Utils;
using System;
using System.Collections;
using System.Runtime.CompilerServices;
namespace clojure.core
{
[Serializable]
public class VecSeq : VecSeq20763, ISeq, IType, IChunkedSeq, InternalReduce, Seqable
{
//
// Static Fields
//
protected internal static Var const__0;
protected internal static object const__11;
protected internal static Var const__12;
protected internal static Var const__13;
protected internal static Var const__14;
protected internal static Keyword const__15;
protected internal static Var const__16;
protected internal static object const__17;
protected internal static object const__18;
protected internal static object const__10;
protected internal static Var const__1;
protected internal static Var const__2;
protected internal static object const__3;
protected internal static Var const__4;
protected internal static object const__5;
protected internal static Var const__9;
protected internal static object const__8;
protected internal static Var const__7;
protected internal static Var const__6;
//
// Fields
//
public new readonly int offset;
public new readonly int i;
public new readonly object anode;
public new readonly object vec;
public new readonly object am;
//
// Constructors
//
public VecSeq (object obj, object obj2, object obj3, int num, int num2)
{
this.am = obj;
this.vec = obj2;
this.anode = obj3;
this.i = num;
this.offset = num2;
}
static VecSeq ()
{
VecSeq.const__0 = RT.var ("clojure.core", "+");
VecSeq.const__1 = RT.var ("clojure.core", "<");
VecSeq.const__2 = RT.var ("clojure.core", "count");
VecSeq.const__3 = (object)0;
VecSeq.const__4 = RT.var ("clojure.core", "inc");
VecSeq.const__5 = (object)1;
VecSeq.const__6 = RT.var ("clojure.core", "next");
VecSeq.const__7 = RT.var ("clojure.core", "instance?");
VecSeq.const__8 = (object)RT.classForName ("clojure.lang.Counted");
VecSeq.const__9 = RT.var ("clojure.core", "identical?");
VecSeq.const__10 = (object)RT.classForName ("clojure.lang.Sequential");
VecSeq.const__11 = (object)RT.classForName ("System.Collections.IEnumerable");
VecSeq.const__12 = RT.var ("clojure.core", "seq");
VecSeq.const__13 = RT.var ("clojure.core", "nil?");
VecSeq.const__14 = RT.var ("clojure.core", "first");
VecSeq.const__15 = RT.keyword (null, "else");
VecSeq.const__16 = RT.var ("clojure.core", "bit-and");
VecSeq.const__17 = (object)65504;
VecSeq.const__18 = (object)32;
}
//
// Static Methods
//
public static object __interop_chunkedNext20777 (object arg)
{
CallSite<Func<CallSite, object, object>> sf;
return (sf = __InternalDynamicExpressionInits_20773.sf3).Target (sf, arg);
}
public static object __interop_chunkedNext20778 (object arg)
{
CallSite<Func<CallSite, object, object>> sf;
return (sf = __InternalDynamicExpressionInits_20773.sf4).Target (sf, arg);
}
public static object __interop_count20774 (object arg)
{
CallSite<Func<CallSite, object, object>> sf;
return (sf = __InternalDynamicExpressionInits_20773.sf0).Target (sf, arg);
}
public static VecSeq20763 __interop_ctor_20776 (Type arg, object __temp_1, object __temp_2, object __temp_3, int __temp_4, long __temp_5)
{
CallSite<Func<CallSite, Type, object, object, object, int, long, object>> sf;
return (VecSeq20763)(sf = __InternalDynamicExpressionInits_20773.sf2).Target (sf, arg, __temp_1, __temp_2, __temp_3, __temp_4, __temp_5);
}
public static VecSeq20763 __interop_ctor_20779 (Type arg, object __temp_1, object __temp_2, object __temp_3, long __temp_4, long __temp_5)
{
CallSite<Func<CallSite, Type, object, object, object, long, long, object>> sf;
return (VecSeq20763)(sf = __InternalDynamicExpressionInits_20773.sf5).Target (sf, arg, __temp_1, __temp_2, __temp_3, __temp_4, __temp_5);
}
public static object __interop_next20775 (object arg)
{
CallSite<Func<CallSite, object, object>> sf;
return (sf = __InternalDynamicExpressionInits_20773.sf1).Target (sf, arg);
}
public static IPersistentVector getBasis ()
{
return RT.vector (new object[] {
((IObj)Symbol.intern (null, "am")).withMeta ((IPersistentMap)RT.map (new object[] {
RT.keyword (null, "tag"),
Symbol.intern (null, "clojure.core.ArrayManager")
})),
((IObj)Symbol.intern (null, "vec")).withMeta ((IPersistentMap)RT.map (new object[] {
RT.keyword (null, "tag"),
Symbol.intern (null, "clojure.core.IVecImpl")
})),
Symbol.intern (null, "anode"),
((IObj)Symbol.intern (null, "i")).withMeta ((IPersistentMap)RT.map (new object[] {
RT.keyword (null, "tag"),
Symbol.intern (null, "int")
})),
((IObj)Symbol.intern (null, "offset")).withMeta ((IPersistentMap)RT.map (new object[] {
RT.keyword (null, "tag"),
Symbol.intern (null, "int")
}))
});
}
//
// Methods
//
public override IChunk chunkedFirst ()
{
return (IChunk)new ArrayChunk ((object)this.am, (object)this.anode, this.offset, ((ArrayManager)this.am).alength ((object)this.anode));
}
public override ISeq chunkedMore ()
{
object obj = VecSeq.__interop_chunkedNext20778 (this);
object obj2 = obj;
object obj3;
return (ISeq)(((obj3 = obj2) == null || (obj3 is bool && !(bool)obj3)) ? PersistentList.EMPTY : obj2);
}
public override ISeq chunkedNext ()
{
long num = Numbers.add ((long)this.i, (long)((ArrayManager)this.am).alength ((object)this.anode));
return (ISeq)((num >= (long)RT.count ((object)this.vec)) ? null : VecSeq.__interop_ctor_20779 (typeof(VecSeq), this.am, this.vec, ((IVecImpl)this.vec).arrayFor (RT.intCast (num)), num, 0));
}
public override ISeq cons (object obj)
{
return (ISeq)new Cons ((object)obj, (ISeq)this);
}
public override IPersistentCollection cons (object obj)
{
throw new NotImplementedException ();
}
public override int count ()
{
long num = 1;
object obj = ((IFn)VecSeq.const__6.getRawRoot ()).invoke (this);
object obj2;
object arg_95_0;
while ((obj2 = obj) != null && (!(obj2 is bool) || (bool)obj2)) {
if (obj is Counted) {
arg_95_0 = Numbers.add (num, (object)VecSeq.__interop_count20774 (obj));
IL_95:
return RT.intCast ((object)arg_95_0);
}
long arg_84_0 = Numbers.inc (num);
obj = ((IFn)VecSeq.const__6.getRawRoot ()).invoke (obj);
num = arg_84_0;
}
arg_95_0 = num;
goto IL_95;
}
public override IPersistentCollection empty ()
{
return (IPersistentCollection)PersistentList.EMPTY;
}
public override bool equiv (object obj)
{
object arg_141_0;
if (Util.identical ((object)this, (object)obj)) {
arg_141_0 = true;
}
else {
bool flag = obj is Sequential;
if ((!flag) ? (obj is IEnumerable) : flag) {
object obj2 = this;
object obj3 = ((IFn)VecSeq.const__12.getRawRoot ()).invoke (obj);
while (!Util.identical ((object)obj2, (object)null)) {
bool flag2 = Util.equiv ((object)((IFn)VecSeq.const__14.getRawRoot ()).invoke (obj2), (object)((IFn)VecSeq.const__14.getRawRoot ()).invoke (obj3));
if (!flag2) {
arg_141_0 = flag2;
goto IL_141;
}
object arg_F9_0 = ((IFn)VecSeq.const__6.getRawRoot ()).invoke (obj2);
obj3 = ((IFn)VecSeq.const__6.getRawRoot ()).invoke (obj3);
obj2 = arg_F9_0;
}
arg_141_0 = Util.identical ((object)obj3, (object)null);
}
else {
object obj4;
arg_141_0 = (((obj4 = VecSeq.const__15) == null || (obj4 is bool && !(bool)obj4)) ? null : false);
}
}
IL_141:
return RT.booleanCast ((object)arg_141_0);
}
public override object first ()
{
return ((ArrayManager)this.am).aget ((object)this.anode, this.offset);
}
public override bool HasArity (int num)
{
return false;
}
public override object internal_reduce (object obj, object obj2)
{
object obj3 = obj2;
long num = Numbers.add ((long)this.i, (long)this.offset);
while (num < (long)RT.count ((object)this.vec)) {
object obj4 = ((IVecImpl)this.vec).arrayFor (RT.intCast (num));
object obj5 = ((IFn)new clojure/core/VecSeq$fn__20766__20770 (obj4, this.am, obj, num, obj3)).invoke ();
object arg_79_0 = obj5;
num = (65504 & Numbers.add (num, 32));
obj3 = arg_79_0;
}
return obj3;
}
public override ISeq more ()
{
object obj = VecSeq.__interop_next20775 (this);
object obj2 = obj;
object obj3;
return (ISeq)(((obj3 = obj2) == null || (obj3 is bool && !(bool)obj3)) ? PersistentList.EMPTY : obj2);
}
public override ISeq next ()
{
return (ISeq)((Numbers.inc ((long)this.offset) >= (long)((ArrayManager)this.am).alength ((object)this.anode)) ? VecSeq.__interop_chunkedNext20777 (this) : VecSeq.__interop_ctor_20776 (typeof(VecSeq), this.am, this.vec, this.anode, this.i, Numbers.inc ((long)this.offset)));
}
public override ISeq seq ()
{
return (ISeq)this;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment