public override string DisplayObject() { StringBuilder repr = new StringBuilder("("); repr.Append(DisplayValue()); CTObject tail = cdr; while (true) { if (tail.GetType() == typeof(CTPair)) { CTPair rest = (CTPair)tail; repr.Append(" ").Append(rest.DisplayValue()); tail = rest.cdr; } else { if (tail.GetType() != typeof(CTEmptyList)) { repr.Append(" . ").Append(tail.DisplayObject()); } break; } } repr.Append(")"); return(repr.ToString()); }
private static void AssertNumber(string functionName, CTObject arg) { if (arg.GetType() != typeof(CTNumber)) { throw new TypeError(functionName, CTNumber.TypeName, arg.DisplayType()); } }
protected override bool IsEqualTo(CTObject obj) { if (obj.GetType() == typeof(CTPair)) { CTPair other = (CTPair)obj; return(other.car.Equals(car) && other.cdr.Equals(cdr)); } else { return(false); } }
protected override bool IsEqualTo(CTObject obj) { return(obj.GetType() == typeof(CTSymbol) && ((CTSymbol)obj).name.Equals(name)); }
protected override bool IsEqualTo(CTObject obj) { return(obj.GetType() == typeof(CTString) && ((CTString)obj).value.Equals(value)); }
protected override bool IsEqualTo(CTObject obj) { return(obj.GetType() == typeof(CTEmptyList)); }
protected override bool IsEqualTo(CTObject obj) { return(obj.GetType() == typeof(CTNumber) && ((CTNumber)obj).value == value); }
protected override bool IsEqualTo(CTObject obj) { return(obj.GetType() == typeof(CTUndefined)); }
public static CTObject IsNull(CTObject v) { return(Constants.ToCTBool(v.GetType() == typeof(CTEmptyList))); }