Beispiel #1
0
        public override string ToString()
        {
            var abbreviation = DatumHelpers.isQuote(First);

            if (abbreviation != null)
            {
                var quoted = Second as Pair;
                if (quoted != null)
                {
                    return(string.Format("{0}{1}", abbreviation, quoted.First));
                }
            }
            var   writer = new Writer();
            Pair  tail;
            Datum next = this;

            while ((tail = asPair(next)) != null)
            {
                writer.Write(tail.First);
                next = tail.Second;
            }
            if (next != Null.Instance)
            {
                writer.Write(".");
                writer.Write(next);
            }
            return(writer.GetString());
        }
 public static object CastObject(this Datum d)
 {
     return(DatumHelpers.castObject(d));
 }
 public static int CastInt(this Datum d)
 {
     return(DatumHelpers.castInt(d));
 }
 public static string CastString(this Datum d)
 {
     return(DatumHelpers.castString(d));
 }
 public static Symbol CastSymbol(this Datum d)
 {
     return(DatumHelpers.castSymbol(d));
 }
 public static Symbol ToSymbol(this string identifier)
 {
     return(DatumHelpers.symbol(identifier));
 }
 public static Datum ToAtom(this object o)
 {
     return(DatumHelpers.atom(o));
 }
 public static Datum ToList(this IEnumerable <Datum> datums)
 {
     return(DatumHelpers.compound(datums.ToArray()));
 }
 public static IEnumerable <Datum> Enumerate(this Datum list)
 {
     return(DatumHelpers.enumerate(list));
 }
Beispiel #10
0
 public static string CastIdentifier(this Datum d)
 {
     return DatumHelpers.getIdentifier(d);
 }